Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

underscore-99xp

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

underscore-99xp - npm Package Compare versions

Comparing version 1.7.1 to 1.7.2

10

lib/underscore-99xp.esm.js

@@ -92,6 +92,7 @@ import _ from 'underscore';

keys.push(k);
var dv = _.isArray(od2[k]) ? [] : {};
var r = _.defaults2(o2[k] || {}, od2[k]);
var r = _.defaults2(o2[k] || dv, od2[k]);
or2[k] = r;
or2[k] = _.isArray(dv) ? _.toArray(r) : r;
});

@@ -107,6 +108,7 @@ }

keys.push(k);
var dv = _.isArray(o2[k]) ? [] : {};
var r = _.defaults2(o2[k], od2[k] || {});
var r = _.defaults2(o2[k], od2[k] || dv);
or2[k] = r;
or2[k] = _.isArray(dv) ? _.toArray(r) : r;
});

@@ -113,0 +115,0 @@ }

12

lib/underscore-99xp.js

@@ -5,3 +5,3 @@ /**

* ----------------------------------
* v1.7.1
* v1.7.2
*

@@ -112,6 +112,7 @@ * Copyright (c)2020 Bruno Foggia, 99xp.

keys.push(k);
var dv = _.isArray(od2[k]) ? [] : {};
var r = _.defaults2(o2[k] || {}, od2[k]);
var r = _.defaults2(o2[k] || dv, od2[k]);
or2[k] = r;
or2[k] = _.isArray(dv) ? _.toArray(r) : r;
});

@@ -127,6 +128,7 @@ }

keys.push(k);
var dv = _.isArray(o2[k]) ? [] : {};
var r = _.defaults2(o2[k], od2[k] || {});
var r = _.defaults2(o2[k], od2[k] || dv);
or2[k] = r;
or2[k] = _.isArray(dv) ? _.toArray(r) : r;
});

@@ -133,0 +135,0 @@ }

@@ -5,3 +5,3 @@ /**

* ----------------------------------
* v1.7.1
* v1.7.2
*

@@ -13,3 +13,3 @@ * Copyright (c)2020 Bruno Foggia, 99xp.

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("underscore"),require("underscore.string")):"function"==typeof define&&define.amd?define(["exports","underscore","underscore.string"],t):t((e=e||self)._x={},e._,e._s)}(this,function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t=t&&t.hasOwnProperty("default")?t.default:t,r=r&&r.hasOwnProperty("default")?r.default:r,t.templateSettings={interpolate:/\{\{(.+?)\}\}/g,evaluate:/\{\%(.+?)\%\}/g,escape:/\{-([\s\S]+?)-\}/g},t.result2=function(e,r,n,i,u){var a;if(e&&t.isObject(e)&&(i||u)&&"function"==typeof e[r]){var o=e[r];u&&(o=t.bind(o,u)),i&&(o=t.partial(t.partial,o).apply(null,i)),a=o()||n}else a=t.result(e,r,n);return a},t.defaults2=function(e,r){var n=[],i=[],u=[],a=[];t.map(e,function(e,r){return t.isJSON(e)||t.isArray(e)?i.push(r):n.push(r)}),t.map(r,function(e,r){return t.isJSON(e)||t.isArray(e)?a.push(r):u.push(r)});var o=t.partial(t.pick,e).apply(null,n),s=t.partial(t.pick,e).apply(null,i),l=t.partial(t.pick,r).apply(null,u),p=t.partial(t.pick,r).apply(null,a);o=t.defaults(o,l);var f=[],c=t.clone(s);return t.size(p)&&t.map(p,function(e,r){if(-1===t.indexOf(f,r)){f.push(r);var n=t.defaults2(s[r]||{},p[r]);c[r]=n}}),t.size(s)&&t.map(s,function(e,r){if(-1===t.indexOf(f,r)){f.push(r);var n=t.defaults2(s[r],p[r]||{});c[r]=n}}),o=t.extend(o,c)},t.deepValueSearch=function(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i="string"==typeof e&&e?e.split(/\[/):e instanceof Array?e:[];if(!i.length)return r;var u=i.shift();if(/^(\w|\_|\-)+$/.test(u))return this.deepValueSearch(i,r[u],n);if("]"===u){if(!i.length)return r;if(r instanceof Array||t.isJSON(r)){var a=t.isJSON(r)||n?{}:[];for(var o in r)t.isJSON(a)?a[o]=this.deepValueSearch(t.clone(i),t.clone(r[o]),n):a.push(this.deepValueSearch(t.clone(i),t.clone(r[o]),n));return a}}return/(\w|\_|\-)+\]$/.test(u)?(u=u.replace("]",""),i.length?r?this.deepValueSearch(i,r[u],n):r:r?r[u]:void 0):void 0};var i=function e(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r&&"object"===n(r))for(var u in r){var a=t+"["+u+"]";"object"===n(r[u])?e(a,r[u],i):i[a]=r[u]}else i[t]=r;return i};t.jsonToHTMLForm=function(e){if(!t.isJSON(e))return!1;var r={};if(t.size(e))for(var n in e)r=i(n,e[n],r);return r},t.deepKeySearch=function(e,r){var n=t.jsonToHTMLForm(r),i=[];return n&&(i=t.filter(t.keys(n),function(t){return new RegExp("^"+e.replace(/\[\]/,"[\\d+]").replace(/(\[|\])/g,"\\$1"),"g").test(t)})),i},t.isOnlyObject=function(e){return t.isObject(e)&&!t.isArray(e)},t.isJSON=function(e){return t.isOnlyObject(e)&&null===e.__proto__.__proto__},t.matchAll=function(e,t){var r=[];return e.replace(t,function(){var e=[].slice.call(arguments,0),t=e.splice(-2);e.index=t[0],e.input=t[1],r.push(e)}),r.length?r:null},t.regexIndexOf=function(e,t,r){var n=e.substring(r||0).search(t);return n>=0?n+(r||0):n},t.regexLastIndexOf=function(e,t,r){t=t.global?t:new RegExp(t.source,"g"+(t.ignoreCase?"i":"")+(t.multiLine?"m":"")),void 0===r?r=e.length:r<0&&(r=0);for(var n,i=e.substring(0,r+1),u=-1,a=0;null!=(n=t.exec(i));)u=n.index,t.lastIndex=++a;return u},t.toDate=function(e){if(!/^\d{4}\-\d{2}/.test(e))return!1;var r=e.toString().split(t.regexIndexOf(e.toString(),/T/)>0?"T":" "),n=r[0].split("-"),i=r[1]?r[1].split(":"):[0,0,0];return new Date(n[0],parseInt(n[1]||0,10)-1,parseInt(n[2]||1,10),i[0]||0,i[1]||0,i[2]||0)},t.defaultPorts={http:80,https:443,ftp:21},t.parseUrl=function(e){var r=/^((http[s]?|ftp):\/)?\/?([^:\/\s]+)(:([^\/]*))?(((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(\?([^#]*))?(#(.*))?)$/gm.exec(e);if(r)return{schema:r[2],hostname:r[3],port:r[5]||t.defaultPorts[r[2]],path:r[6]||""}},t.mixin(r.exports()),e.default=t,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("underscore"),require("underscore.string")):"function"==typeof define&&define.amd?define(["exports","underscore","underscore.string"],t):t((e=e||self)._x={},e._,e._s)}(this,function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t=t&&t.hasOwnProperty("default")?t.default:t,r=r&&r.hasOwnProperty("default")?r.default:r,t.templateSettings={interpolate:/\{\{(.+?)\}\}/g,evaluate:/\{\%(.+?)\%\}/g,escape:/\{-([\s\S]+?)-\}/g},t.result2=function(e,r,n,i,a){var o;if(e&&t.isObject(e)&&(i||a)&&"function"==typeof e[r]){var u=e[r];a&&(u=t.bind(u,a)),i&&(u=t.partial(t.partial,u).apply(null,i)),o=u()||n}else o=t.result(e,r,n);return o},t.defaults2=function(e,r){var n=[],i=[],a=[],o=[];t.map(e,function(e,r){return t.isJSON(e)||t.isArray(e)?i.push(r):n.push(r)}),t.map(r,function(e,r){return t.isJSON(e)||t.isArray(e)?o.push(r):a.push(r)});var u=t.partial(t.pick,e).apply(null,n),s=t.partial(t.pick,e).apply(null,i),l=t.partial(t.pick,r).apply(null,a),p=t.partial(t.pick,r).apply(null,o);u=t.defaults(u,l);var f=[],c=t.clone(s);return t.size(p)&&t.map(p,function(e,r){if(-1===t.indexOf(f,r)){f.push(r);var n=t.isArray(p[r])?[]:{},i=t.defaults2(s[r]||n,p[r]);c[r]=t.isArray(n)?t.toArray(i):i}}),t.size(s)&&t.map(s,function(e,r){if(-1===t.indexOf(f,r)){f.push(r);var n=t.isArray(s[r])?[]:{},i=t.defaults2(s[r],p[r]||n);c[r]=t.isArray(n)?t.toArray(i):i}}),u=t.extend(u,c)},t.deepValueSearch=function(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i="string"==typeof e&&e?e.split(/\[/):e instanceof Array?e:[];if(!i.length)return r;var a=i.shift();if(/^(\w|\_|\-)+$/.test(a))return this.deepValueSearch(i,r[a],n);if("]"===a){if(!i.length)return r;if(r instanceof Array||t.isJSON(r)){var o=t.isJSON(r)||n?{}:[];for(var u in r)t.isJSON(o)?o[u]=this.deepValueSearch(t.clone(i),t.clone(r[u]),n):o.push(this.deepValueSearch(t.clone(i),t.clone(r[u]),n));return o}}return/(\w|\_|\-)+\]$/.test(a)?(a=a.replace("]",""),i.length?r?this.deepValueSearch(i,r[a],n):r:r?r[a]:void 0):void 0};var i=function e(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r&&"object"===n(r))for(var a in r){var o=t+"["+a+"]";"object"===n(r[a])?e(o,r[a],i):i[o]=r[a]}else i[t]=r;return i};t.jsonToHTMLForm=function(e){if(!t.isJSON(e))return!1;var r={};if(t.size(e))for(var n in e)r=i(n,e[n],r);return r},t.deepKeySearch=function(e,r){var n=t.jsonToHTMLForm(r),i=[];return n&&(i=t.filter(t.keys(n),function(t){return new RegExp("^"+e.replace(/\[\]/,"[\\d+]").replace(/(\[|\])/g,"\\$1"),"g").test(t)})),i},t.isOnlyObject=function(e){return t.isObject(e)&&!t.isArray(e)},t.isJSON=function(e){return t.isOnlyObject(e)&&null===e.__proto__.__proto__},t.matchAll=function(e,t){var r=[];return e.replace(t,function(){var e=[].slice.call(arguments,0),t=e.splice(-2);e.index=t[0],e.input=t[1],r.push(e)}),r.length?r:null},t.regexIndexOf=function(e,t,r){var n=e.substring(r||0).search(t);return n>=0?n+(r||0):n},t.regexLastIndexOf=function(e,t,r){t=t.global?t:new RegExp(t.source,"g"+(t.ignoreCase?"i":"")+(t.multiLine?"m":"")),void 0===r?r=e.length:r<0&&(r=0);for(var n,i=e.substring(0,r+1),a=-1,o=0;null!=(n=t.exec(i));)a=n.index,t.lastIndex=++o;return a},t.toDate=function(e){if(!/^\d{4}\-\d{2}/.test(e))return!1;var r=e.toString().split(t.regexIndexOf(e.toString(),/T/)>0?"T":" "),n=r[0].split("-"),i=r[1]?r[1].split(":"):[0,0,0];return new Date(n[0],parseInt(n[1]||0,10)-1,parseInt(n[2]||1,10),i[0]||0,i[1]||0,i[2]||0)},t.defaultPorts={http:80,https:443,ftp:21},t.parseUrl=function(e){var r=/^((http[s]?|ftp):\/)?\/?([^:\/\s]+)(:([^\/]*))?(((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(\?([^#]*))?(#(.*))?)$/gm.exec(e);if(r)return{schema:r[2],hostname:r[3],port:r[5]||t.defaultPorts[r[2]],path:r[6]||""}},t.mixin(r.exports()),e.default=t,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=underscore-99xp.min.js.map
{
"name": "underscore-99xp",
"version": "1.7.1",
"version": "1.7.2",
"keywords": [

@@ -5,0 +5,0 @@ "util",

@@ -84,5 +84,6 @@ // [Underscore-99xp](https://github.com/brunnofoggia/underscore-99xp) is an

keys.push(k);
var r = _.defaults2(o2[k] || {}, od2[k]);
var dv = _.isArray(od2[k]) ? [] : {};
var r = _.defaults2(o2[k] || dv, od2[k]);
or2[k] = r;
or2[k] = _.isArray(dv) ? _.toArray(r) : r;
});

@@ -96,5 +97,6 @@ }

keys.push(k);
var r = _.defaults2(o2[k], od2[k] || {});
var dv = _.isArray(o2[k]) ? [] : {};
var r = _.defaults2(o2[k], od2[k] || dv);
or2[k] = r;
or2[k] = _.isArray(dv) ? _.toArray(r) : r;
});

@@ -101,0 +103,0 @@ }

import _ from '../lib/underscore-99xp.esm.js';
// template render
test('template rendering with mustaches {{\'99xp\'}}', () => {
var html = _.template("{{'99xp'}}")();
expect(html === '99xp').toBe(true);
});
// results2
test('result2 > sending args and context', () => {
var json = {
name: '99xp',
methods: {
fn: function(attr) { return this[attr]; }
}
};
expect(_.result2(json.methods, 'fn', '', ['name'], json) === '99xp').toBe(true);
});
// defaults2

@@ -37,3 +20,7 @@ test('defaults2 > replacing data on complex objects', () => {

email: 'team@99xp.org',
phone: '11912345678'
phone: '11912345678',
phones: [{
ddd: 11,
number: 33333333
}]
},

@@ -46,3 +33,3 @@ address: {0:{

var r = _.defaults2(o, defaults);
expect(r.name==='99xp' && r.contact.email==='team@99xp.org' && r.contact.phone==='11912345678' && r.contact.skype==='xxxxx' && r.address[0].street==='number 2' && r.address[1].street==='number 1').toBe(true);
expect(r.name==='99xp' && r.contact.email==='team@99xp.org' && r.contact.phone==='11912345678' && r.contact.skype==='xxxxx' && r.address[0].street==='number 2' && r.address[1].street==='number 1' && _.isArray(r.contact.phones)).toBe(true);
});

@@ -49,0 +36,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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