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

deepjs

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deepjs - npm Package Compare versions

Comparing version 0.9.7 to 0.9.8

8

deep-compose.js

@@ -56,3 +56,3 @@ /**

var r = before.apply(this, args);
console.log("chain.first : result == ", r);
//console.log("chain.first : result == ", r);

@@ -405,3 +405,3 @@ if(typeof r === 'undefined' || !r.then)

function Constructor(){
// console.log("Compose Classes constructor : ", this);
//console.log("Compose Classes constructor : ", this);
for(var i = 0; i < args.length; ++i)

@@ -425,6 +425,6 @@ {

if(cl.prototype)
deep.utils.up(cl.prototype, prototype);
prototype = deep.utils.up(cl.prototype, prototype);
}
else
deep.utils.up(cl, prototype);
prototype = deep.utils.up(cl, prototype);
}

@@ -431,0 +431,0 @@ Constructor.prototype = prototype;

@@ -17,3 +17,6 @@ /**

if(this.report)
res += " - report : "+JSON.stringify(this.report);
if(this.report.toString)
this.report.toString();
else
res += " - report : "+JSON.stringify(this.report);
return res;

@@ -32,69 +35,161 @@ }

MethodNotAllowed:function(msg, report, fileName, lineNum){
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "MethodNotAllowed";
return this.Error(405, msg, report, fileName, lineNum);
},
Internal:function(msg, report, fileName, lineNum){
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Internal";
return this.Error(500, msg, report, fileName, lineNum);
},
PreconditionFail:function(msg, report, fileName, lineNum){
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "PreconditionFail";
return this.Error(412, msg, report, fileName, lineNum);
},
NotFound:function(msg, report, fileName, lineNum){
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "NotFound";
return this.Error(404, msg, report, fileName, lineNum);
},
Forbidden:function(msg, report, fileName, lineNum){
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Forbidden";
return this.Error(403, msg, report, fileName, lineNum);
},
Range:function(msg, report, fileName, lineNum){
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Range";
return this.Error(416, msg, report, fileName, lineNum);
},
Conflict:function (msg, report, fileName, lineNum) {
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Conflict";
return this.Error(409, "ConflictError : "+msg, report, fileName, lineNum);
},
Unsupported:function (msg, report, fileName, lineNum) {
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Unsupported";
return this.Error(415, "UnsupportedMediaTypeError : "+msg, report, fileName, lineNum);
},
NotAcceptable:function (msg, report, fileName, lineNum) {
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "NotAcceptable";
return this.Error(406, "NotAcceptableError : "+msg, report, fileName, lineNum);
},
Unauthorized:function (msg, report, fileName, lineNum) {
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Unauthorized";
return this.Error(401, "UnauthorizedError : "+msg, report, fileName, lineNum);
},
Mode:function (msg, report, fileName, lineNum) {
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Mode";
return this.Error(500, "ModeError : "+msg, report, fileName, lineNum);
},
Watch:function (msg, report, fileName, lineNum) {
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Watch";
return this.Error(500, "FileWatchError : "+msg, report, fileName, lineNum);
},
Store:function (msg, report, fileName, lineNum) {
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Store";
return this.Error(400, "StoreError : "+msg, report, fileName, lineNum);
},
Protocole:function (msg, report, fileName, lineNum) {
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Protocole";
return this.Error(400, "ProtocoleError : "+msg, report, fileName, lineNum);
},
OCM:function (msg, report, fileName, lineNum) {
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "OCM";
return this.Error(403, "OCMError : "+msg, report, fileName, lineNum);
},
Post:function (msg, report, fileName, lineNum) {
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Post";
return this.Error(400, "PostError : "+msg, report, fileName, lineNum);
},
Put:function (msg, report, fileName, lineNum) {
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Put";
return this.Error(400, "PutError : "+msg, report, fileName, lineNum);
},
Patch:function (msg, report, fileName, lineNum) {
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Patch";
return this.Error(400, "PatchError : "+msg, report, fileName, lineNum);
},
Delete:function (msg, report, fileName, lineNum) {
return this.Error(400, "DeleteError : "+msg, report, fileName, lineNum);
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Delete";
return this.Error(400, msg, report, fileName, lineNum);
},
RPC:function (msg, report, fileName, lineNum) {
return this.Error(400, "RPCError : "+msg, report, fileName, lineNum);
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "RPC";
return this.Error(400, msg, report, fileName, lineNum);
},
ChainEnded:function (msg, report, fileName, lineNum) {
return this.Error(1001, "ChainEndedError : "+msg, report, fileName, lineNum);
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "ChainEnded";
return this.Error(1001, msg, report, fileName, lineNum);
},
ChainListened:function (msg, report, fileName, lineNum) {
return this.Error(1002, "ChainListenedError : "+msg, report, fileName, lineNum);
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "ChainListened";
return this.Error(1002, msg, report, fileName, lineNum);
},
Login:function (msg, report, fileName, lineNum) {
return this.Error(400, "LoginError : "+msg, report, fileName, lineNum);
if(typeof msg === 'object')
report = msg;
if(!msg)
msg = "Login";
return this.Error(400, msg, report, fileName, lineNum);
}

@@ -101,0 +196,0 @@ };

@@ -156,6 +156,12 @@ /**

deep.Chain.addHandle("modes", function(arg)
deep.Chain.addHandle("modes", function(arg, arg2)
{
// console.log("chain.mode : ", arguments, deep.context);
var self = this;
if(typeof arg === 'string')
{
var obj = {};
obj[arg] = arg2;
arg = obj;
}
var func = function(s,e)

@@ -171,2 +177,3 @@ {

deep.context.modes = arg;
return s;
// console.log("deep.context.mode setted : ",deep.context.mode);

@@ -178,4 +185,10 @@ };

});
deep.setModes = function(arg){
deep.setModes = function(arg, arg2){
// console.log("generalMode : ", arguments)
if(typeof arg === 'string')
{
var obj = {};
obj[arg] = arg2;
arg = obj;
}
deep.context = deep.utils.simpleCopy(deep.context);

@@ -182,0 +195,0 @@ for(var i in deep.context.modes)

@@ -34,3 +34,3 @@ if (typeof define !== 'function') {

deep.protocole.getStoreHandler = function(protocole)
deep.protocole.getStoreHandler = function(protocole, opt)
{

@@ -42,2 +42,3 @@ //console.log("deep.protocole.getStoreHandler : protocol : ", protocole);

};
opt = opt || {};
if(protocole._deep_ocm_)

@@ -59,3 +60,3 @@ protocole = protocole();

}
if(handler.store._deep_ocm_)
if(handler.store._deep_ocm_ && !opt.ignoreOCM)
handler.store = handler.store();

@@ -67,3 +68,3 @@ if(typeof handler.store === 'function')

};
if(handler.store.init)
if(handler.store.init && !opt.ignoreInit)
return deep.when(handler.store.init())

@@ -70,0 +71,0 @@ .done(function(){

@@ -587,3 +587,13 @@ /**

date:Date.now(),
valid:(othis.errors.length == 0)
valid:(othis.errors.length == 0),
toString:function(){
console.log("\n\nValidationReport : \n");
console.log("valid : \n", this.valid);
console.log("schema : \n", JSON.stringify(this.schema));
console.log("value : \n", JSON.stringify(this.value));
console.log("errors : \n");
for(var i in this.errorsMap)
console.log(i, this.errorsMap[i].errors);
}
}

@@ -590,0 +600,0 @@ return report;

@@ -36,5 +36,6 @@ /**

deep.store = function (name) {
// console.log("deep.store(name) : ",name)
return deep(deep.protocole.getStoreHandler(name))
//console.log("deep.store(name) : ",name)
return deep(deep.protocole.getStoreHandler(name))//, { ignoreInit:true, ignoreOCM:true}))
.transform(function(handler){
//console.log("store getted : ", handler.store);
return handler.store;

@@ -41,0 +42,0 @@ })

{
"name" : "deepjs",
"version" : "0.9.7",
"version" : "0.9.8",
"author" : "Gilles Coomans <gilles.coomans@gmail.com>",

@@ -5,0 +5,0 @@ "description" : "Powerful atomic tools for managing objects, functions and promises",

@@ -26,3 +26,3 @@ /**

throw error;
}
};
utils.arrayInsert = function(array, index) {

@@ -40,7 +40,7 @@ array.splice.apply(array, [index, 0].concat(

* @example
* var interpreted = deep.utils.interpret("hello { name }", { name:"john" });
* var interpreted = deep.utils.interpret("hello { name }", { name:"john" });
*
* @example
* // equivalent of first example
* var interpreted = deep("hello { name }").interpret({ name:"john" }).val();
* // equivalent of first example
* var interpreted = deep("hello { name }").interpret({ name:"john" }).val();
*

@@ -90,3 +90,3 @@ * @method interpret

return text;
}
};

@@ -116,18 +116,18 @@ utils.catchParenthesis = function(path)

return { value:res, rest:path.substring(count)};
}
};
function trim_words(theString, numWords, maxChar)
{
expString = theString.split(/\s+/,numWords);
if(expString.length == 1)
{
expString = theString.split(/\s+/,numWords);
if(expString.length == 1)
{
maxChar = maxChar || 10;
if(expString[0].length > maxChar)
return theString.substring(0,maxChar)
return expString[0];
}
theNewString=expString.join(" ");
if(theNewString.length < theString.length && theNewString[theNewString.length-1] != ".")
if(expString[0].length > maxChar)
return theString.substring(0,maxChar);
return expString[0];
}
theNewString=expString.join(" ");
if(theNewString.length < theString.length && theNewString[theNewString.length-1] != ".")
theNewString += "...";
return theNewString;
return theNewString;
}

@@ -138,3 +138,3 @@

return trim_words(string.replace(/<[^>]*>/gi, ""), numWords, maxChar);
}
};

@@ -166,10 +166,10 @@ //_________________________________________________________________ OBJECTS/ARRAY RELATED

//console.log("cloneFunction : fct.decorator = ", fct.decorator)
var clone = function() {
return fct.apply(this, arguments);
};
clone.prototype = fct.prototype;
for (property in fct)
if (fct.hasOwnProperty(property))
clone[property] = utils.copy(fct[property]);
return clone;
var clone = function() {
return fct.apply(this, arguments);
};
clone.prototype = fct.prototype;
for (var property in fct)
if (fct.hasOwnProperty(property))
clone[property] = utils.copy(fct[property]);
return clone;
};

@@ -202,3 +202,3 @@

if(typeof e === 'object')
res.push(copy(e));
res.push(copy(e));
else

@@ -222,3 +222,3 @@ res.push(e);

var v = obj[i];
if(obj.hasOwnProperty(i))
//if(obj.hasOwnProperty(i))
if(typeof v === 'object')

@@ -257,3 +257,3 @@ res[i] = copy(v);

// continue;
if(obj.hasOwnProperty(i))
//if(obj.hasOwnProperty(i))
res[i] = obj[i];

@@ -477,4 +477,4 @@ }

// continue;
if(!b.hasOwnProperty(i))
continue;
//if(!b.hasOwnProperty(i))
// continue;
if(typeof a[i] === 'undefined')

@@ -492,4 +492,4 @@ return false;

// continue;
if(!a.hasOwnProperty(i))
continue;
//if(!a.hasOwnProperty(i))
// continue;
tmpA.push(i);

@@ -816,3 +816,3 @@ }

{
//console.log("utils.bottom : objects ", src, target)
//console.log("utils.bottom : objects ", src.init?true:null, target)
// if(src && src._deep_shared_)

@@ -824,9 +824,14 @@ // console.log("got botom shared");

return target;
var srcType = utils.getJSPrimitiveType(src);
if(typeof target === 'undefined')
{
//console.log("bottom : target undefined : copy src : ",src)
target = utils.copy(src);
if(parent && key)
parent[key] = target;
return target;
// console.log("bottom : target undefined : copy src : ",src)
if(srcType !== 'function')
{
target = utils.copy(src);
if(parent && key)
parent[key] = target;
return target;
}
}

@@ -848,5 +853,12 @@ if(target._deep_upper_ && target.bottom)

}
if(srcType === 'function' && typeof target === 'undefined')
{
//console.log("function as asource and target undefined")
target = src;
if(parent && key)
parent[key] = target;
return target;
}
//console.log("utils.bottom : objects not nulls.")
var result= null;
var srcType = utils.getJSPrimitiveType(src);
var targetType = utils.getJSPrimitiveType(target);

@@ -909,3 +921,3 @@ // console.log("utils.bottom : objects types : ", srcType, targetType);

case 'object' :
// console.log("deep.bottom : apply objects together : src : ", src, " - on : ", target)
//console.log("deep.bottom : apply objects together : src : ", src, " - on : ", target)
/*if(src && src._deep_shared_)

@@ -920,4 +932,6 @@ {

{
if(!src.hasOwnProperty(i))
continue;
//console.log("bomttom object : from src try : : ",i);
//if(!src.hasOwnProperty(i) && typeof src[i] !== 'function')
// continue;
//console.log("bomttom object : from src : do : ",i);
if(src[i] !== null)

@@ -937,20 +951,22 @@ {

//console.log("bottom have copied : ", copied);
for(var i in target)
var i = null;
for(i in target)
{
if(!target.hasOwnProperty(i))
continue;
//if(!target.hasOwnProperty(i) && typeof target[i] !== 'function')
// continue;
delete target[i];
}
for(var i in src)
for(i in src)
{
if(!src.hasOwnProperty(i))
continue;
//if(!src.hasOwnProperty(i) && typeof src[i] !== 'function')
// continue;
target[i] = copied[i];
delete copied[i];
}
for(var i in copied)
for(i in copied)
{
if(!copied.hasOwnProperty(i))
continue;
//if(!copied.hasOwnProperty(i) && typeof copied[i] !== 'function')
// continue;
target[i] = copied[i];

@@ -1344,8 +1360,6 @@ }

var report = {};
for(var i in sheet)
{
var toApply = sheet[i];
Object.keys(sheet).forEach(function(i){
var d = deep.get(i, options)
.done(function(handler){
return handler(toApply, options);
return handler(sheet[i], options);
})

@@ -1356,3 +1370,3 @@ .done(function(s){

res.push(d);
}
});
return deep.all(res)

@@ -1510,11 +1524,11 @@ .done(function(success){

}
r = deep.query(obj, what, {
resultType: "full"
});
r = deep.query(obj, what, { resultType: "full" });
if (!r)
return r;
if (r._isDQ_NODE_)
{
finalise(r);
else
r.forEach(finalise);
return removed.shift();
}
r.forEach(finalise);
return removed;

@@ -1542,4 +1556,160 @@ };

};
utils.flatten = function utilsFlatten(node) {
var self = node;
var flattenChilds = function () {
var r = utils.extendsChilds(node);
return deep.when(r);
};
if (!node.value || typeof node.value !== 'object')
return node;
var d = deep.when(1), r = null;
if (node.value.backgrounds)
d.done(function(){
return utils.extendsBackgrounds(node);
});
if (node.value.foregrounds)
d.done(function(){
return utils.extendsForegrounds(node);
});
return d.done(flattenChilds);
};
/**
* will perform the backgrounds application on any backgrounds properties at any level
*
* not intend to be call directly by programmer. use at your own risk : Use deep.Chain.flatten() instead.
*
* @method extendsChilds
* @private
* @param {DeepEntry} entry from where seeking after backgrounds properties
* @return {deep.Promise} a promise
*/
utils.extendsChilds = function(entry) {
if (!entry._isDQ_NODE_)
entry = deep.Querier.createRootNode(entry, {});
var toExtends = deep.Querier.firstObjectWithProperty(entry, "backgrounds");
if (!toExtends)
return entry;
// console.log("extends Childs : first child with backgournds : ", toExtends, " - entry.root ? : ", entry.root, " - toextends.root : ", toExtends.root);
function finalise() {
if (toExtends.ancestor)
toExtends.ancestor[toExtends.key] = toExtends.value;
return entry;
}
function recurse2(toExt) {
if (toExtends.ancestor)
delete toExtends.ancestor[toExtends.key];
var r = utils.extendsChilds(entry);
return deep.when(r)
.done(finalise);
}
function recurse(toExt) {
var r = utils.extendsChilds(toExtends);
return deep.when(r)
.done(recurse2);
}
var r = utils.extendsBackgrounds(toExtends);
return deep.when(r)
.done(recurse);
}
/**
* will perform the backgrounds application FIRSTLY and FULLY (full recursive) on current entries before appying extendsChild.
*
* not intend to be call directly by programmer. use at your own risk : Use deep.Chain.flatten() instead.
*
* @method extendsBackgrounds
* @private
* @param {DeepEntry} entry from where seeking after backgrounds properties
* @return {deep.Promise} a promise
*/
utils.extendsBackgrounds = function(entry) {
//console.log("extends backgrounds of : ", entry, " - root ? : ", entry.root)
if (!entry._isDQ_NODE_)
entry = deep.Querier.createRootNode(entry, {});
var self = this;
var value = entry.value;
if (value.backgrounds) {
var getBackgrounds = function (backgrounds) {
//console.log("try retrieve backgrounds : ", backgrounds);
var all = [];
var needLoad = false;
backgrounds.forEach(function (b) {
if (typeof b === 'string') {
var rget = deep.get(b, {
entry: entry
});
//console.log("background : "+b+" : get result : ",rget._success);
all.push(rget);
needLoad = true;
} else
all.push(b);
});
function extendedsLoaded(extendeds) {
var stack = [];
var needRecursion = false;
extendeds.forEach(function (s) {
if (s && s.backgrounds) {
stack.push(getBackgrounds(s.backgrounds));
needRecursion = true;
}
});
if (!needRecursion)
return extendeds;
return deep.all(stack)
.done(function (stack) {
var finalStack = [];
extendeds.forEach(function (s) {
if (s && s.backgrounds) {
finalStack = finalStack.concat(stack.shift());
}
finalStack.push(s);
});
//console.log("will have getted backgrounds : ", finalStack);
return finalStack;
});
}
if (!needLoad)
return extendedsLoaded(all);
//console.log("will retrieve backgrounds : ", all);
return deep.all(all)
.done(extendedsLoaded);
};
var backgrounds = value.backgrounds;
delete value.backgrounds;
var r = getBackgrounds(backgrounds);
if (r && r.then)
return deep.when(r)
.done(function extendedsLoaded(extendeds) {
//console.log("final backgrounds stack : ", extendeds, " on : ",entry.value);
extendeds.reverse();
extendeds.forEach(function (s) {
utils.bottom(s, entry.value);
delete entry.value.backgrounds;
});
return entry;
});
//console.log("final backgrounds stack : ", r);
r.forEach(function (s) {
utils.bottom(s, entry.value);
});
return entry;
}
return entry;
}
return utils;
};
});

Sorry, the diff of this file is too big to display

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