fix: sort filter unexpectedly modifies original array, #475

This commit is contained in:
Harttle
2022-02-20 13:03:40 +08:00
parent ab5e245fba
commit dbc0497386
4 changed files with 8 additions and 2 deletions
@@ -138,6 +138,10 @@ describe('filters/array', function () {
const c = { name: { first: 'Carol' } }
return test(tpl, { arr: [b, c, a, c] }, 'Alice Bob Carol Carol')
})
it('should not change the original array', () => {
const arr = ["one", "two", "three", "four", "five"]
return test("{{arr | sort}} {{arr}}", { arr }, 'fivefouronethreetwo onetwothreefourfive')
})
})
describe('uniq', function () {
it('should uniq string list', function () {