Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jauco/json-pointer into f…
Browse files Browse the repository at this point in the history
…ix-get-inherited-property
  • Loading branch information
manuelstofer committed Feb 24, 2015
2 parents a5aa152 + 12ea5ba commit c4dba14
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ api.get = function get (obj, pointer) {
refTokens = api.parse(pointer);
while (refTokens.length) {
tok = refTokens.shift();
if (!obj.hasOwnProperty(tok)) {
if (!(tok in obj)) {
throw new Error('Invalid reference token: ' + tok);
}
obj = obj[tok];
Expand All @@ -76,7 +76,7 @@ api.set = function set (obj, pointer, value) {
}
nextTok = refTokens[0];

if (!obj.hasOwnProperty(tok)) {
if (!(tok in obj)) {
if (nextTok.match(/^(\d+|-)$/)) {
obj[tok] = [];
} else {
Expand Down

0 comments on commit c4dba14

Please sign in to comment.