Comparing version 1.0.1 to 1.1.0
@@ -30,8 +30,17 @@ /** | ||
function Hookney(json) | ||
function Hookney() | ||
{ | ||
'use strict'; | ||
json = _.cloneDeep(json || {}); | ||
const | ||
l = arguments.length, | ||
json = {}; | ||
var i; | ||
for (i = 0; i < l; i++) | ||
{ | ||
_.merge(json, arguments[i]) | ||
} | ||
this.json = function() | ||
@@ -191,5 +200,16 @@ { | ||
Hookney.from = function(json) | ||
Hookney.from = function() | ||
{ | ||
return new Hookney(json || {}); | ||
const | ||
l = arguments.length, | ||
json = {}; | ||
var i; | ||
for (i = 0; i < l; i++) | ||
{ | ||
_.merge(json, arguments[i]) | ||
} | ||
return new Hookney(json); | ||
}; | ||
@@ -196,0 +216,0 @@ |
@@ -1,2 +0,2 @@ | ||
/*! hookney V1.0.0, Copyright (c) 2016-present, Belexos GmbH. MIT licensed. */ | ||
!function(a){function b(a){"use strict";function b(a){var g,h,i,k;if(d(a))for(g in a)a.hasOwnProperty(g)&&(h=a[g],d(h)?b(h):e(h)?b(h):f(h)&&(a[g]=c(j,h)));else if(e(a))for(k=a.length,i=0;i<k;i++)h=a[i],d(h)?b(h):e(h)?b(h):f(h)&&(a[i]=c(j,h))}function c(d,e){const g=new RegExp(d,"gm").exec(e);var h;return g&&(h=i.get(a,g[1]),e=e===g[0]?h:e.replace(g[0],f(h)?h:JSON.stringify(h)),f(e)?e=c(d,e):"object"==typeof e&&b(e)),e}a=i.cloneDeep(a||{}),this.json=function(){return a},this.stringify=function(b,c){return JSON.stringify(a,b,c)},this.resolveReferences=function(){return b(a),this},g&&(this.writeFile=function(a,b,c){const d=this;c||(c=b,b={}),b=b||{},b.encoding||(b.encoding="utf8"),h.writeFile(a,this.stringify(b.replacer,b.space),b,function(a){a?c(a,null):c(null,d)})},this.writeFileSync=function(a,b){return b=b||{},b.encoding||(b.encoding="utf8"),h.writeFileSync(a,this.stringify(b.replacer,b.space),b),this})}function c(a){var b,c,d,e,f=/"|(\/\*)|(\*\/)|(\/\/)|\n|\r/g,g=!1,h=!1,i=!1,j=[],k=0,l=0;for(f.lastIndex=0;b=f.exec(a);)d=RegExp.leftContext,e=RegExp.rightContext,h||i||(c=d.substring(l),g||(c=c.replace(/(\n|\r|\s)*/g,"")),j[k++]=c),l=f.lastIndex,'"'!==b[0]||h||i?"/*"!==b[0]||g||h||i?"*/"!==b[0]||g||!h||i?"//"!==b[0]||g||h||i?"\n"!==b[0]&&"\r"!==b[0]||g||h||!i?h||i||/\n|\r|\s/.test(b[0])||(j[k++]=b[0]):i=!1:i=!0:h=!1:h=!0:(c=d.match(/(\\)*$/),g&&c&&c[0].length%2!=0||(g=!g),l--,e=a.substring(l));return j[k++]=e,j.join("")}function d(a){return"object"==typeof a&&!Array.isArray(a)}function e(a){return Array.isArray(a)}function f(a){return"string"==typeof a}const g="object"==typeof module&&module&&"object"==typeof module.exports,h=g?require("fs"):null,i=g?require("lodash"):a._,j="\\$\\{self\\:(.*?)\\}";g?module.exports=b:a.Hookney=b,b.from=function(a){return new b(a||{})},b.fromString=function(a,d){var e={};return a&&f(a)&&a.length&&(a=c(a),e=JSON.parse(a,d)),new b(e)},g&&(b.fromFile=function(a,d,e){e||(e=d,d={}),d=d||{},d.encoding||(d.encoding="utf8"),h.readFile(a,d,function(f,g){if(f)return void e(f,null);g=c(g);try{e(null,b.fromString(g,d.reviver))}catch(f){f.message=a+": "+f.message,e(f,null)}})},b.fromFileSync=function(a,d){var e;d=d||{},d.encoding||(d.encoding="utf8"),e=h.readFileSync(a,d),e=c(e);try{return b.fromString(e,d.reviver)}catch(b){throw b.message=a+": "+b.message,b}})}(this); | ||
/*! hookney V1.0.1, Copyright (c) 2016-present, Belexos GmbH. MIT licensed. */ | ||
!function(a){function b(){"use strict";function a(c){var g,h,i,k;if(d(c))for(g in c)c.hasOwnProperty(g)&&(h=c[g],d(h)?a(h):e(h)?a(h):f(h)&&(c[g]=b(j,h)));else if(e(c))for(k=c.length,i=0;i<k;i++)h=c[i],d(h)?a(h):e(h)?a(h):f(h)&&(c[i]=b(j,h))}function b(c,d){const e=new RegExp(c,"gm").exec(d);var g;return e&&(g=i.get(k,e[1]),d=d===e[0]?g:d.replace(e[0],f(g)?g:JSON.stringify(g)),f(d)?d=b(c,d):"object"==typeof d&&a(d)),d}const c=arguments.length,k={};var l;for(l=0;l<c;l++)i.merge(k,arguments[l]);this.json=function(){return k},this.stringify=function(a,b){return JSON.stringify(k,a,b)},this.resolveReferences=function(){return a(k),this},g&&(this.writeFile=function(a,b,c){const d=this;c||(c=b,b={}),b=b||{},b.encoding||(b.encoding="utf8"),h.writeFile(a,this.stringify(b.replacer,b.space),b,function(a){a?c(a,null):c(null,d)})},this.writeFileSync=function(a,b){return b=b||{},b.encoding||(b.encoding="utf8"),h.writeFileSync(a,this.stringify(b.replacer,b.space),b),this})}function c(a){var b,c,d,e,f=/"|(\/\*)|(\*\/)|(\/\/)|\n|\r/g,g=!1,h=!1,i=!1,j=[],k=0,l=0;for(f.lastIndex=0;b=f.exec(a);)d=RegExp.leftContext,e=RegExp.rightContext,h||i||(c=d.substring(l),g||(c=c.replace(/(\n|\r|\s)*/g,"")),j[k++]=c),l=f.lastIndex,'"'!==b[0]||h||i?"/*"!==b[0]||g||h||i?"*/"!==b[0]||g||!h||i?"//"!==b[0]||g||h||i?"\n"!==b[0]&&"\r"!==b[0]||g||h||!i?h||i||/\n|\r|\s/.test(b[0])||(j[k++]=b[0]):i=!1:i=!0:h=!1:h=!0:(c=d.match(/(\\)*$/),g&&c&&c[0].length%2!=0||(g=!g),l--,e=a.substring(l));return j[k++]=e,j.join("")}function d(a){return"object"==typeof a&&!Array.isArray(a)}function e(a){return Array.isArray(a)}function f(a){return"string"==typeof a}const g="object"==typeof module&&module&&"object"==typeof module.exports,h=g?require("fs"):null,i=g?require("lodash"):a._,j="\\$\\{self\\:(.*?)\\}";g?module.exports=b:a.Hookney=b,b.from=function(){const a=arguments.length,c={};var d;for(d=0;d<a;d++)i.merge(c,arguments[d]);return new b(c)},b.fromString=function(a,d){var e={};return a&&f(a)&&a.length&&(a=c(a),e=JSON.parse(a,d)),new b(e)},g&&(b.fromFile=function(a,d,e){e||(e=d,d={}),d=d||{},d.encoding||(d.encoding="utf8"),h.readFile(a,d,function(f,g){if(f)return void e(f,null);g=c(g);try{e(null,b.fromString(g,d.reviver))}catch(f){f.message=a+": "+f.message,e(f,null)}})},b.fromFileSync=function(a,d){var e;d=d||{},d.encoding||(d.encoding="utf8"),e=h.readFileSync(a,d),e=c(e);try{return b.fromString(e,d.reviver)}catch(b){throw b.message=a+": "+b.message,b}})}(this); |
{ | ||
"name": "hookney", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Hookney is a helper around self referencing JSON objects for Node.js and the Browser.", | ||
@@ -5,0 +5,0 @@ "main": "hookney.js", |
@@ -303,2 +303,5 @@ Hookney | ||
--------- | ||
v1.1.0 | ||
* Support multiple arguments on instantiation. | ||
v1.0.1 | ||
@@ -305,0 +308,0 @@ * Fix .npmignore |
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
18962
319
316