Comparing version 0.1.0 to 0.1.2
30
index.js
@@ -94,3 +94,31 @@ "use strict"; | ||
return result; | ||
} | ||
}, | ||
transform: function(context, path, fn) { | ||
var pathParts = path.split('.'), | ||
lastPathIndex = pathParts.length - 1, | ||
pointer = context; | ||
pathParts.every(function(attribute, pathIndex) { | ||
if (isList(pointer)) { | ||
pointer.forEach(function(value, pointerIndex) { | ||
pointer[pointerIndex] = PickrBase.transform(value, pathParts.slice(pathIndex).join('.'), fn); | ||
}); | ||
return false; | ||
} | ||
if (!pointer[attribute]) { | ||
return false; | ||
} | ||
if (lastPathIndex === pathIndex) { | ||
pointer[attribute] = fn(pointer[attribute]); | ||
} | ||
pointer = pointer[attribute]; | ||
return true; | ||
}); | ||
return context; | ||
}, | ||
}; | ||
@@ -97,0 +125,0 @@ |
{ | ||
"name": "pickr", | ||
"version": "0.1.0", | ||
"version": "0.1.2", | ||
"description": "Data selector utility", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
17603
9
536
1