Comparing version 2.1.0 to 2.2.0
{ | ||
"name": "rfc6902", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Complete implementation of RFC6902 (patch and diff)", | ||
@@ -23,3 +23,3 @@ "keywords": [ | ||
"js-yaml": "3.10.0", | ||
"mocha": "^4.0.1", | ||
"mocha": "^3.5.3", | ||
"mocha-lcov-reporter": "1.3.0", | ||
@@ -26,0 +26,0 @@ "rollup": "^0.50.0", |
@@ -23,2 +23,4 @@ export interface PointerEvaluation { | ||
evaluate(object: any): PointerEvaluation; | ||
get(object: any): any; | ||
set(object: any, value: any): void; | ||
push(token: string): void; | ||
@@ -25,0 +27,0 @@ /** |
@@ -70,8 +70,16 @@ "use strict"; | ||
} | ||
return { | ||
parent: parent, | ||
key: token, | ||
value: object, | ||
}; | ||
return { parent, key: token, value: object }; | ||
} | ||
get(object) { | ||
return this.evaluate(object).value; | ||
} | ||
set(object, value) { | ||
for (var i = 1, l = this.tokens.length - 1, token = this.tokens[i]; i < l; i++) { | ||
// not sure if this the best way to handle non-existant paths... | ||
object = (object || {})[token]; | ||
} | ||
if (object) { | ||
object[this.tokens[this.tokens.length - 1]] = value; | ||
} | ||
} | ||
push(token) { | ||
@@ -78,0 +86,0 @@ // mutable |
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
44895
15
909