Comparing version 1.2.0 to 1.2.1
14
index.js
@@ -222,3 +222,3 @@ "use strict" | ||
path = `${data.pathProperty}${path}`; //get path ready for next iteratin | ||
data = Object.getPrototypeOf(data); | ||
data = Object.getPrototypeOf(data); //get parent | ||
if(data !== Object.prototype) { | ||
@@ -354,3 +354,3 @@ add2emitQueue.call(this, data.target, path, oldValue, value, changeType); | ||
else { | ||
return false; | ||
return true; //do nothing because there's nothing to delete | ||
} | ||
@@ -467,8 +467,14 @@ } | ||
static splitPath(path) { | ||
if(typeof path !== 'string' || path.length < 2) { | ||
if(typeof path !== 'string' || path === '') { | ||
return ['']; | ||
} | ||
let i = 0; | ||
if(path[0] === '.' || path[0] === '[') { | ||
i = 1; //loop will skip over openning '.' or '[' | ||
} | ||
var resultsArr = []; | ||
var tmp=''; | ||
for(let i=1; i < path.length; i++) { //i=1 and skip over '.' or '['] | ||
for(; i < path.length; i++) { | ||
let char = path[i]; | ||
@@ -475,0 +481,0 @@ if(char === '.' || char === '[') { |
{ | ||
"name": "proxserve", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Proxy Observe on objects and properties changes", | ||
@@ -5,0 +5,0 @@ "license": "Apache 2.0", |
@@ -606,2 +606,4 @@ "use strict" | ||
let path = Proxserve.splitPath('.level2_1.level3_1'); | ||
let path2 = Proxserve.splitPath('level2_1.level3_1'); | ||
expect(path).toEqual(path2); | ||
expect(path).toEqual(['level2_1','level3_1']); | ||
@@ -616,2 +618,4 @@ | ||
path = Proxserve.splitPath('.a'); | ||
path2 = Proxserve.splitPath('a'); | ||
expect(path).toEqual(path2); | ||
expect(path).toEqual(['a']); | ||
@@ -623,3 +627,3 @@ | ||
path = Proxserve.splitPath('New[0]new'); | ||
expect(path).toEqual(['ew','0new']); | ||
expect(path).toEqual(['New','0new']); | ||
@@ -626,0 +630,0 @@ path = Proxserve.splitPath('[1][0][new]'); |
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
50427
1057