New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gedi

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gedi - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

161

gedi.js

@@ -202,49 +202,50 @@ //Copyright (C) 2012 Kory Nunn

function get(path, model) {
if (path) {
var memoiseObject = memoiseCache[path.toString()];
if(memoiseObject && memoiseObject.model === model){
return memoiseObject.value;
}
if (!path) {
return model;
}
var memoiseObject = memoiseCache[path.toString()];
if(memoiseObject && memoiseObject.model === model){
return memoiseObject.value;
}
var reference = model,
index = 0;
path = Path.parse(path);
if(path.isRoot()){
return model;
}
path = Path.parse(path);
if(path.isRoot()){
return reference;
}
var reference = model,
index = 0,
pathLength = path.length;
if(path.isAbsolute()){
index = 1;
}
if(path.isAbsolute()){
index = 1;
}
for(; index < path.length; index++){
var key = path[index];
for(; index < pathLength; index++){
var key = path[index];
if (reference === null || reference === undefined) {
break;
} else if (typeof reference[key] === "object") {
reference = reference[key];
}
else {
reference = reference[key];
if (reference == null) {
break;
} else if (typeof reference[key] === "object") {
reference = reference[key];
} else {
reference = reference[key];
// If there are still keys in the path that have not been accessed,
// return undefined.
if(index < path.length - 1){
reference = undefined;
}
break;
// If there are still keys in the path that have not been accessed,
// return undefined.
if(index < pathLength - 1){
reference = undefined;
}
break;
}
}
memoiseCache[path.toString()] = {
model: model,
value: reference
};
memoiseCache[path.toString()] = {
model: model,
value: reference
};
return reference;
}
return model;
return reference;
}

@@ -296,3 +297,4 @@

var index = 0;
var index = 0,
pathLength = path.length;

@@ -305,3 +307,3 @@ if(path.isAbsolute()){

for(; index < path.length; index++){
for(; index < pathLength; index++){
var key = path[index];

@@ -319,3 +321,3 @@

}
if (index === path.length - 1) {
if (index === pathLength - 1) {
// if we are at the end of the line, set to the model

@@ -349,3 +351,4 @@ reference[key] = value;

var index = 0;
var index = 0,
pathLength = path.length;

@@ -356,3 +359,3 @@ if(path.isAbsolute()){

for(; index < path.length; index++){
for(; index < pathLength; index++){
var key = path[index];

@@ -363,3 +366,3 @@ //if we have hit a non-object and we have more keys after this one

}
if (index === path.length - 1) {
if (index === pathLength - 1) {
// if we are at the end of the line, delete the last key

@@ -619,11 +622,8 @@

}
callbacks = get(new Path(bindingPathParts), internalBindings);
if(!callback){
while(callbacks.length){
callbacks.pop();
}
return;
set(bindingPathParts, [], internalBindings);
}
callbacks = get(bindingPathParts, internalBindings);

@@ -633,9 +633,9 @@ if(!callbacks){

}
fastEach(callbacks, function(handler, index, callbacks){
if(handler === callback){
callbacks.splice(index, 1);
return true;
for (var i = 0; i < callbacks.length; i++) {
if(callbacks[i] === callback){
callbacks.splice(i, 1);
return;
}
});
}
}

@@ -948,7 +948,2 @@

function constructPath(instance, path){
//Passed a Path? pass it back.
if (path instanceof Path) {
return path.slice();
}

@@ -970,4 +965,2 @@ // passed in an Expression or an 'expression formatted' Path (eg: '[bla]')

if(typeof path === 'string'){
//passed a string or array? make a new Path.
var pathParts;

@@ -991,7 +984,5 @@ if(path.indexOf(gediConstructor.pathSeparator) >= 0){

} else if (path instanceof Array) {
var pathParts = path.slice();
while(pathParts.length){
instance.push(pathParts.shift());
} else if (path instanceof Array || path instanceof Path) {
for (var i = 0; i < path.length; i++) {
instance.push(path[i]);
}

@@ -1018,4 +1009,3 @@ }

Path.prototype.toString = function () {
var str = this.join(gediConstructor.pathSeparator);
return rawToPath(str);
return rawToPath(this.join(gediConstructor.pathSeparator));
};

@@ -1025,3 +1015,3 @@ Path.prototype.toRawString = function () {

};
Path.prototype.slice = function () {
Path.prototype.slice = function () {
return new Path(Array.prototype.slice.apply(this, arguments));

@@ -1033,6 +1023,5 @@ };

Path.prototype.append = function () {
var args = Array.prototype.slice.call(arguments),
result = this.slice();
var result = this.slice();
fastEach(args, function(arg){
fastEach(arguments, function(arg){
fastEach(Path.parse(arg), function(argPart){

@@ -1073,21 +1062,21 @@ result.push(argPart);

function Expression(expression) {
var self = this,
function Expression(input) {
var expression = this,
absolute = false;
//Passed an Expression? pass it back.
if (expression instanceof Expression) {
return expression;
if (input instanceof Expression) {
return input;
}
self.original = expression;
expression.original = input;
if (typeof expression === "string") {
if (typeof input === "string") {
//passed a string or array? make a new Expression.
var tokens = gel.tokenise(expression);
var tokens = gel.tokenise(input);
fastEach(tokens, function (key) {
self.push(key);
expression.push(key);
});
}
self.paths = getPathsInExpression(self);
expression.paths = getPathsInExpression(expression);
}

@@ -1101,6 +1090,6 @@ Expression.prototype = inheritFromArray();

};
Expression.parse = function (expression) {
expression instanceof Path && (expression = expression.toString());
Expression.parse = function (input) {
input instanceof Path && (input = input.toString());
return expression instanceof this && expression || new Expression(expression);
return input instanceof Expression && input || new Expression(input);
};

@@ -1107,0 +1096,0 @@

@@ -8,3 +8,3 @@ {

],
"version": "0.2.3",
"version": "0.2.4",
"main": "gedi.js",

@@ -11,0 +11,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc