Comparing version 2.2.1 to 2.2.2
@@ -0,1 +1,6 @@ | ||
## v2.2.2 (2017-06-09) | ||
* Bug fix in `v2.2.1`... | ||
## v2.2.1 (2017-06-09) | ||
@@ -2,0 +7,0 @@ |
@@ -229,3 +229,8 @@ "use strict"; | ||
if (i === tokens.length - 1) { | ||
_data = simpleRemove(_data, token); | ||
if (isArray(_data)) { | ||
_data.splice(parseInt(token, 10), 1); | ||
} | ||
else { | ||
delete _data[token]; | ||
} | ||
return false; | ||
@@ -232,0 +237,0 @@ } |
{ | ||
"name": "dot-wild", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "Use powerful dot notation (dot path + wildcard) to manipulate properties of JSON", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -228,3 +228,3 @@ import * as assert from 'power-assert'; | ||
it('remove()', () => { | ||
it.only('remove()', () => { | ||
const t1 = { foo: { bar: 'baz' } }; | ||
@@ -323,3 +323,3 @@ const assertT1 = () => { | ||
const values = [ | ||
let values: any = [ | ||
1, | ||
@@ -335,2 +335,77 @@ 2, | ||
assert(result.length === 0); | ||
values = [ | ||
{ nest: [1, 2, 3] }, | ||
{ nest: [1, 2, 3] }, | ||
{ nest: [1, 2, 3] }, | ||
]; | ||
result = dot.remove(values, '0.nest.0'); | ||
assert.deepStrictEqual(result, [ | ||
{ nest: [2, 3] }, | ||
{ nest: [1, 2, 3] }, | ||
{ nest: [1, 2, 3] }, | ||
]); | ||
assert(result[0].nest.length === 2); | ||
values = [ | ||
[ | ||
[1, 2, 3], | ||
[1, 2, 3], | ||
[1, 2, 3], | ||
], | ||
[ | ||
[1, 2, 3], | ||
[1, 2, 3], | ||
[1, 2, 3], | ||
], | ||
]; | ||
result = dot.remove(values, '*.0'); | ||
assert.deepStrictEqual(result, [ | ||
[ | ||
[1, 2, 3], | ||
[1, 2, 3], | ||
], | ||
[ | ||
[1, 2, 3], | ||
[1, 2, 3], | ||
], | ||
]); | ||
assert(result[0].length === 2); | ||
assert(result[1].length === 2); | ||
result = dot.remove(values, '*.*.2'); | ||
assert.deepStrictEqual(result, [ | ||
[ | ||
[1, 2], | ||
[1, 2], | ||
[1, 2], | ||
], | ||
[ | ||
[1, 2], | ||
[1, 2], | ||
[1, 2], | ||
], | ||
]); | ||
assert(result[0][0].length === 2); | ||
assert(result[0][1].length === 2); | ||
assert(result[0][2].length === 2); | ||
assert(result[1][0].length === 2); | ||
assert(result[1][1].length === 2); | ||
assert(result[1][2].length === 2); | ||
result = dot.remove(values, '*.*.3'); | ||
assert.deepStrictEqual(result, [ | ||
[ | ||
[1, 2, 3], | ||
[1, 2, 3], | ||
[1, 2, 3], | ||
], | ||
[ | ||
[1, 2, 3], | ||
[1, 2, 3], | ||
[1, 2, 3], | ||
], | ||
]); | ||
}); | ||
@@ -337,0 +412,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43855
1008