Skip to content

Commit

Permalink
Merge tag 'v2.1.2' into develop
Browse files Browse the repository at this point in the history
v2.1.2
  • Loading branch information
rhalff committed Nov 2, 2019
2 parents b18aaac + 0c8a4d8 commit ee628c2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# ChangeLog

## 2019-11-02 Version 2.1.1
* fix undefined key with root level array.

## 2019-11-02 Version 2.1.1
* Wrong array conversion when brackets are used (Reported by vladshcherbin #27)

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dot-object",
"version": "2.1.1",
"version": "2.1.2",
"description": "dot-object makes it possible to transform and read (JSON) objects using dot notation.",
"main": "dist/dot-object.js",
"authors": [
Expand Down
3 changes: 2 additions & 1 deletion dist/dot-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,8 @@
)
) {
if (isArray && this.useBrackets) {
return this.dot(obj[key], tgt, path.slice(0, -1).concat(path[path.length - 1] + index))
var previousKey = path[path.length - 1] || ''
return this.dot(obj[key], tgt, path.slice(0, -1).concat(previousKey + index))
} else {
return this.dot(obj[key], tgt, path.concat(index))
}
Expand Down
2 changes: 1 addition & 1 deletion dist/dot-object.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,8 @@ DotObject.prototype.dot = function (obj, tgt, path) {
)
) {
if (isArray && this.useBrackets) {
return this.dot(obj[key], tgt, path.slice(0, -1).concat(path[path.length - 1] + index))
var previousKey = path[path.length - 1] || ''
return this.dot(obj[key], tgt, path.slice(0, -1).concat(previousKey + index))
} else {
return this.dot(obj[key], tgt, path.concat(index))
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dot-object",
"description": "dot-object makes it possible to transform and read (JSON) objects using dot notation.",
"version": "2.1.1",
"version": "2.1.2",
"author": {
"name": "Rob Halff",
"email": "rob.halff@gmail.com"
Expand Down

0 comments on commit ee628c2

Please sign in to comment.