nested-property
Advanced tools
Comparing version 0.0.7 to 1.0.1
@@ -93,3 +93,5 @@ /** | ||
return split.reduce(function (obj, prop, idx) { | ||
obj[prop] = obj[prop] || {}; | ||
const nextPropIsNumber = Number.isInteger(Number(split[idx + 1])); | ||
obj[prop] = obj[prop] || (nextPropIsNumber ? [] : {}) | ||
if (split.length == (idx + 1)) { | ||
@@ -96,0 +98,0 @@ obj[prop] = value; |
{ | ||
"name": "nested-property", | ||
"description": "Read, write or test a data structure's nested property via a string like 'my.nested.property'. It works through arrays and objects.'", | ||
"version": "0.0.7", | ||
"version": "1.0.1", | ||
"homepage": "https://github.com/cosmosio/nested-property", | ||
@@ -17,2 +17,8 @@ "licenses": [ | ||
"author": "Olivier Scherrer <pode.fr@gmail.com>", | ||
"contributors": [ | ||
{ | ||
"name": "Igor Barbosa", | ||
"url": "https://github.com/igor-barbosa" | ||
} | ||
], | ||
"keywords": [ | ||
@@ -36,3 +42,3 @@ "nested", | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "mocha test/" | ||
}, | ||
@@ -42,5 +48,5 @@ "main": "index.js", | ||
"chai": "~1.9.1", | ||
"mocha": "~1.18.2", | ||
"mocha": "^6.1.4", | ||
"sinon": "~1.12.2" | ||
} | ||
} |
@@ -184,2 +184,12 @@ Nested property | ||
### 1.0.1 - 22 JUNE 209 | ||
* Update to mocha 6.4.1 to remove security alerts on dependencies | ||
### 1.0.0 - 22 JUNE 2019 | ||
* Breaking Change: When calling `set()` with an integer in the path and `nested-property` creates an object at the location, the object is now an array instead of an object. Hopefully, no user of the `nested-property` package should have been expecting to see an object instead of an array, but this constitutes a breaking changes, hence the major update in the semver. | ||
Thanks [igor-barbosa](https://github.com/igor-barbosa) for the suggestion: [PR #2](https://github.com/cosmosio/nested-property/pull/2) | ||
### 0.0.7 - 09 AUG 2016 | ||
@@ -186,0 +196,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
12500
137
0
219