diff options
Diffstat (limited to 'node_modules/locutus/php/array')
146 files changed, 4091 insertions, 0 deletions
diff --git a/node_modules/locutus/php/array/array_change_key_case.js b/node_modules/locutus/php/array/array_change_key_case.js new file mode 100644 index 0000000..6dac772 --- /dev/null +++ b/node_modules/locutus/php/array/array_change_key_case.js @@ -0,0 +1,42 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +module.exports = function array_change_key_case(array, cs) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_change_key_case/ + // original by: Ates Goral (http://magnetiq.com) + // improved by: marrtins + // improved by: Brett Zamir (http://brett-zamir.me) + // example 1: array_change_key_case(42) + // returns 1: false + // example 2: array_change_key_case([ 3, 5 ]) + // returns 2: [3, 5] + // example 3: array_change_key_case({ FuBaR: 42 }) + // returns 3: {"fubar": 42} + // example 4: array_change_key_case({ FuBaR: 42 }, 'CASE_LOWER') + // returns 4: {"fubar": 42} + // example 5: array_change_key_case({ FuBaR: 42 }, 'CASE_UPPER') + // returns 5: {"FUBAR": 42} + // example 6: array_change_key_case({ FuBaR: 42 }, 2) + // returns 6: {"FUBAR": 42} + + var caseFnc; + var key; + var tmpArr = {}; + + if (Object.prototype.toString.call(array) === '[object Array]') { + return array; + } + + if (array && (typeof array === 'undefined' ? 'undefined' : _typeof(array)) === 'object') { + caseFnc = !cs || cs === 'CASE_LOWER' ? 'toLowerCase' : 'toUpperCase'; + for (key in array) { + tmpArr[key[caseFnc]()] = array[key]; + } + return tmpArr; + } + + return false; +}; +//# sourceMappingURL=array_change_key_case.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_change_key_case.js.map b/node_modules/locutus/php/array/array_change_key_case.js.map new file mode 100644 index 0000000..2bc1a3a --- /dev/null +++ b/node_modules/locutus/php/array/array_change_key_case.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_change_key_case.js"],"names":["module","exports","array_change_key_case","array","cs","caseFnc","key","tmpArr","Object","prototype","toString","call"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,qBAAT,CAAgCC,KAAhC,EAAuCC,EAAvC,EAA2C;AAAE;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,OAAJ;AACA,MAAIC,GAAJ;AACA,MAAIC,SAAS,EAAb;;AAEA,MAAIC,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BR,KAA/B,MAA0C,gBAA9C,EAAgE;AAC9D,WAAOA,KAAP;AACD;;AAED,MAAIA,SAAS,QAAOA,KAAP,yCAAOA,KAAP,OAAiB,QAA9B,EAAwC;AACtCE,cAAW,CAACD,EAAD,IAAOA,OAAO,YAAf,GAA+B,aAA/B,GAA+C,aAAzD;AACA,SAAKE,GAAL,IAAYH,KAAZ,EAAmB;AACjBI,aAAOD,IAAID,OAAJ,GAAP,IAAyBF,MAAMG,GAAN,CAAzB;AACD;AACD,WAAOC,MAAP;AACD;;AAED,SAAO,KAAP;AACD,CAnCD","file":"array_change_key_case.js","sourcesContent":["module.exports = function array_change_key_case (array, cs) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_change_key_case/\n // original by: Ates Goral (http://magnetiq.com)\n // improved by: marrtins\n // improved by: Brett Zamir (http://brett-zamir.me)\n // example 1: array_change_key_case(42)\n // returns 1: false\n // example 2: array_change_key_case([ 3, 5 ])\n // returns 2: [3, 5]\n // example 3: array_change_key_case({ FuBaR: 42 })\n // returns 3: {\"fubar\": 42}\n // example 4: array_change_key_case({ FuBaR: 42 }, 'CASE_LOWER')\n // returns 4: {\"fubar\": 42}\n // example 5: array_change_key_case({ FuBaR: 42 }, 'CASE_UPPER')\n // returns 5: {\"FUBAR\": 42}\n // example 6: array_change_key_case({ FuBaR: 42 }, 2)\n // returns 6: {\"FUBAR\": 42}\n\n var caseFnc\n var key\n var tmpArr = {}\n\n if (Object.prototype.toString.call(array) === '[object Array]') {\n return array\n }\n\n if (array && typeof array === 'object') {\n caseFnc = (!cs || cs === 'CASE_LOWER') ? 'toLowerCase' : 'toUpperCase'\n for (key in array) {\n tmpArr[key[caseFnc]()] = array[key]\n }\n return tmpArr\n }\n\n return false\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_chunk.js b/node_modules/locutus/php/array/array_chunk.js new file mode 100644 index 0000000..953d0e2 --- /dev/null +++ b/node_modules/locutus/php/array/array_chunk.js @@ -0,0 +1,62 @@ +'use strict'; + +module.exports = function array_chunk(input, size, preserveKeys) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_chunk/ + // original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com) + // improved by: Brett Zamir (http://brett-zamir.me) + // note 1: Important note: Per the ECMAScript specification, + // note 1: objects may not always iterate in a predictable order + // example 1: array_chunk(['Kevin', 'van', 'Zonneveld'], 2) + // returns 1: [['Kevin', 'van'], ['Zonneveld']] + // example 2: array_chunk(['Kevin', 'van', 'Zonneveld'], 2, true) + // returns 2: [{0:'Kevin', 1:'van'}, {2: 'Zonneveld'}] + // example 3: array_chunk({1:'Kevin', 2:'van', 3:'Zonneveld'}, 2) + // returns 3: [['Kevin', 'van'], ['Zonneveld']] + // example 4: array_chunk({1:'Kevin', 2:'van', 3:'Zonneveld'}, 2, true) + // returns 4: [{1: 'Kevin', 2: 'van'}, {3: 'Zonneveld'}] + + var x; + var p = ''; + var i = 0; + var c = -1; + var l = input.length || 0; + var n = []; + + if (size < 1) { + return null; + } + + if (Object.prototype.toString.call(input) === '[object Array]') { + if (preserveKeys) { + while (i < l) { + (x = i % size) ? n[c][i] = input[i] : n[++c] = {};n[c][i] = input[i]; + i++; + } + } else { + while (i < l) { + (x = i % size) ? n[c][x] = input[i] : n[++c] = [input[i]]; + i++; + } + } + } else { + if (preserveKeys) { + for (p in input) { + if (input.hasOwnProperty(p)) { + (x = i % size) ? n[c][p] = input[p] : n[++c] = {};n[c][p] = input[p]; + i++; + } + } + } else { + for (p in input) { + if (input.hasOwnProperty(p)) { + (x = i % size) ? n[c][x] = input[p] : n[++c] = [input[p]]; + i++; + } + } + } + } + + return n; +}; +//# sourceMappingURL=array_chunk.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_chunk.js.map b/node_modules/locutus/php/array/array_chunk.js.map new file mode 100644 index 0000000..a46a624 --- /dev/null +++ b/node_modules/locutus/php/array/array_chunk.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_chunk.js"],"names":["module","exports","array_chunk","input","size","preserveKeys","x","p","i","c","l","length","n","Object","prototype","toString","call","hasOwnProperty"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,WAAT,CAAsBC,KAAtB,EAA6BC,IAA7B,EAAmCC,YAAnC,EAAiD;AAAE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,CAAJ;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,CAAC,CAAT;AACA,MAAIC,IAAIP,MAAMQ,MAAN,IAAgB,CAAxB;AACA,MAAIC,IAAI,EAAR;;AAEA,MAAIR,OAAO,CAAX,EAAc;AACZ,WAAO,IAAP;AACD;;AAED,MAAIS,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+Bb,KAA/B,MAA0C,gBAA9C,EAAgE;AAC9D,QAAIE,YAAJ,EAAkB;AAChB,aAAOG,IAAIE,CAAX,EAAc;AACZ,SAACJ,IAAIE,IAAIJ,IAAT,IACIQ,EAAEH,CAAF,EAAKD,CAAL,IAAUL,MAAMK,CAAN,CADd,GAEII,EAAE,EAAEH,CAAJ,IAAS,EAFb,CAEiBG,EAAEH,CAAF,EAAKD,CAAL,IAAUL,MAAMK,CAAN,CAAV;AACjBA;AACD;AACF,KAPD,MAOO;AACL,aAAOA,IAAIE,CAAX,EAAc;AACZ,SAACJ,IAAIE,IAAIJ,IAAT,IACIQ,EAAEH,CAAF,EAAKH,CAAL,IAAUH,MAAMK,CAAN,CADd,GAEII,EAAE,EAAEH,CAAJ,IAAS,CAACN,MAAMK,CAAN,CAAD,CAFb;AAGAA;AACD;AACF;AACF,GAhBD,MAgBO;AACL,QAAIH,YAAJ,EAAkB;AAChB,WAAKE,CAAL,IAAUJ,KAAV,EAAiB;AACf,YAAIA,MAAMc,cAAN,CAAqBV,CAArB,CAAJ,EAA6B;AAC3B,WAACD,IAAIE,IAAIJ,IAAT,IACIQ,EAAEH,CAAF,EAAKF,CAAL,IAAUJ,MAAMI,CAAN,CADd,GAEIK,EAAE,EAAEH,CAAJ,IAAS,EAFb,CAEiBG,EAAEH,CAAF,EAAKF,CAAL,IAAUJ,MAAMI,CAAN,CAAV;AACjBC;AACD;AACF;AACF,KATD,MASO;AACL,WAAKD,CAAL,IAAUJ,KAAV,EAAiB;AACf,YAAIA,MAAMc,cAAN,CAAqBV,CAArB,CAAJ,EAA6B;AAC3B,WAACD,IAAIE,IAAIJ,IAAT,IACIQ,EAAEH,CAAF,EAAKH,CAAL,IAAUH,MAAMI,CAAN,CADd,GAEIK,EAAE,EAAEH,CAAJ,IAAS,CAACN,MAAMI,CAAN,CAAD,CAFb;AAGAC;AACD;AACF;AACF;AACF;;AAED,SAAOI,CAAP;AACD,CAjED","file":"array_chunk.js","sourcesContent":["module.exports = function array_chunk (input, size, preserveKeys) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_chunk/\n // original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // note 1: Important note: Per the ECMAScript specification,\n // note 1: objects may not always iterate in a predictable order\n // example 1: array_chunk(['Kevin', 'van', 'Zonneveld'], 2)\n // returns 1: [['Kevin', 'van'], ['Zonneveld']]\n // example 2: array_chunk(['Kevin', 'van', 'Zonneveld'], 2, true)\n // returns 2: [{0:'Kevin', 1:'van'}, {2: 'Zonneveld'}]\n // example 3: array_chunk({1:'Kevin', 2:'van', 3:'Zonneveld'}, 2)\n // returns 3: [['Kevin', 'van'], ['Zonneveld']]\n // example 4: array_chunk({1:'Kevin', 2:'van', 3:'Zonneveld'}, 2, true)\n // returns 4: [{1: 'Kevin', 2: 'van'}, {3: 'Zonneveld'}]\n\n var x\n var p = ''\n var i = 0\n var c = -1\n var l = input.length || 0\n var n = []\n\n if (size < 1) {\n return null\n }\n\n if (Object.prototype.toString.call(input) === '[object Array]') {\n if (preserveKeys) {\n while (i < l) {\n (x = i % size)\n ? n[c][i] = input[i]\n : n[++c] = {}; n[c][i] = input[i]\n i++\n }\n } else {\n while (i < l) {\n (x = i % size)\n ? n[c][x] = input[i]\n : n[++c] = [input[i]]\n i++\n }\n }\n } else {\n if (preserveKeys) {\n for (p in input) {\n if (input.hasOwnProperty(p)) {\n (x = i % size)\n ? n[c][p] = input[p]\n : n[++c] = {}; n[c][p] = input[p]\n i++\n }\n }\n } else {\n for (p in input) {\n if (input.hasOwnProperty(p)) {\n (x = i % size)\n ? n[c][x] = input[p]\n : n[++c] = [input[p]]\n i++\n }\n }\n }\n }\n\n return n\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_combine.js b/node_modules/locutus/php/array/array_combine.js new file mode 100644 index 0000000..124f5fa --- /dev/null +++ b/node_modules/locutus/php/array/array_combine.js @@ -0,0 +1,46 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +module.exports = function array_combine(keys, values) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_combine/ + // original by: Kevin van Zonneveld (http://kvz.io) + // improved by: Brett Zamir (http://brett-zamir.me) + // example 1: array_combine([0,1,2], ['kevin','van','zonneveld']) + // returns 1: {0: 'kevin', 1: 'van', 2: 'zonneveld'} + + var newArray = {}; + var i = 0; + + // input sanitation + // Only accept arrays or array-like objects + // Require arrays to have a count + if ((typeof keys === 'undefined' ? 'undefined' : _typeof(keys)) !== 'object') { + return false; + } + if ((typeof values === 'undefined' ? 'undefined' : _typeof(values)) !== 'object') { + return false; + } + if (typeof keys.length !== 'number') { + return false; + } + if (typeof values.length !== 'number') { + return false; + } + if (!keys.length) { + return false; + } + + // number of elements does not match + if (keys.length !== values.length) { + return false; + } + + for (i = 0; i < keys.length; i++) { + newArray[keys[i]] = values[i]; + } + + return newArray; +}; +//# sourceMappingURL=array_combine.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_combine.js.map b/node_modules/locutus/php/array/array_combine.js.map new file mode 100644 index 0000000..32506e6 --- /dev/null +++ b/node_modules/locutus/php/array/array_combine.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_combine.js"],"names":["module","exports","array_combine","keys","values","newArray","i","length"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,aAAT,CAAwBC,IAAxB,EAA8BC,MAA9B,EAAsC;AAAE;AACvD;AACA;AACA;AACA;AACA;;AAEA,MAAIC,WAAW,EAAf;AACA,MAAIC,IAAI,CAAR;;AAEA;AACA;AACA;AACA,MAAI,QAAOH,IAAP,yCAAOA,IAAP,OAAgB,QAApB,EAA8B;AAC5B,WAAO,KAAP;AACD;AACD,MAAI,QAAOC,MAAP,yCAAOA,MAAP,OAAkB,QAAtB,EAAgC;AAC9B,WAAO,KAAP;AACD;AACD,MAAI,OAAOD,KAAKI,MAAZ,KAAuB,QAA3B,EAAqC;AACnC,WAAO,KAAP;AACD;AACD,MAAI,OAAOH,OAAOG,MAAd,KAAyB,QAA7B,EAAuC;AACrC,WAAO,KAAP;AACD;AACD,MAAI,CAACJ,KAAKI,MAAV,EAAkB;AAChB,WAAO,KAAP;AACD;;AAED;AACA,MAAIJ,KAAKI,MAAL,KAAgBH,OAAOG,MAA3B,EAAmC;AACjC,WAAO,KAAP;AACD;;AAED,OAAKD,IAAI,CAAT,EAAYA,IAAIH,KAAKI,MAArB,EAA6BD,GAA7B,EAAkC;AAChCD,aAASF,KAAKG,CAAL,CAAT,IAAoBF,OAAOE,CAAP,CAApB;AACD;;AAED,SAAOD,QAAP;AACD,CAvCD","file":"array_combine.js","sourcesContent":["module.exports = function array_combine (keys, values) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_combine/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // example 1: array_combine([0,1,2], ['kevin','van','zonneveld'])\n // returns 1: {0: 'kevin', 1: 'van', 2: 'zonneveld'}\n\n var newArray = {}\n var i = 0\n\n // input sanitation\n // Only accept arrays or array-like objects\n // Require arrays to have a count\n if (typeof keys !== 'object') {\n return false\n }\n if (typeof values !== 'object') {\n return false\n }\n if (typeof keys.length !== 'number') {\n return false\n }\n if (typeof values.length !== 'number') {\n return false\n }\n if (!keys.length) {\n return false\n }\n\n // number of elements does not match\n if (keys.length !== values.length) {\n return false\n }\n\n for (i = 0; i < keys.length; i++) {\n newArray[keys[i]] = values[i]\n }\n\n return newArray\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_count_values.js b/node_modules/locutus/php/array/array_count_values.js new file mode 100644 index 0000000..58a9fba --- /dev/null +++ b/node_modules/locutus/php/array/array_count_values.js @@ -0,0 +1,62 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +module.exports = function array_count_values(array) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_count_values/ + // original by: Ates Goral (http://magnetiq.com) + // improved by: Michael White (http://getsprink.com) + // improved by: Kevin van Zonneveld (http://kvz.io) + // input by: sankai + // input by: Shingo + // bugfixed by: Brett Zamir (http://brett-zamir.me) + // example 1: array_count_values([ 3, 5, 3, "foo", "bar", "foo" ]) + // returns 1: {3:2, 5:1, "foo":2, "bar":1} + // example 2: array_count_values({ p1: 3, p2: 5, p3: 3, p4: "foo", p5: "bar", p6: "foo" }) + // returns 2: {3:2, 5:1, "foo":2, "bar":1} + // example 3: array_count_values([ true, 4.2, 42, "fubar" ]) + // returns 3: {42:1, "fubar":1} + + var tmpArr = {}; + var key = ''; + var t = ''; + + var _getType = function _getType(obj) { + // Objects are php associative arrays. + var t = typeof obj === 'undefined' ? 'undefined' : _typeof(obj); + t = t.toLowerCase(); + if (t === 'object') { + t = 'array'; + } + return t; + }; + + var _countValue = function _countValue(tmpArr, value) { + if (typeof value === 'number') { + if (Math.floor(value) !== value) { + return; + } + } else if (typeof value !== 'string') { + return; + } + + if (value in tmpArr && tmpArr.hasOwnProperty(value)) { + ++tmpArr[value]; + } else { + tmpArr[value] = 1; + } + }; + + t = _getType(array); + if (t === 'array') { + for (key in array) { + if (array.hasOwnProperty(key)) { + _countValue.call(this, tmpArr, array[key]); + } + } + } + + return tmpArr; +}; +//# sourceMappingURL=array_count_values.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_count_values.js.map b/node_modules/locutus/php/array/array_count_values.js.map new file mode 100644 index 0000000..02af331 --- /dev/null +++ b/node_modules/locutus/php/array/array_count_values.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_count_values.js"],"names":["module","exports","array_count_values","array","tmpArr","key","t","_getType","obj","toLowerCase","_countValue","value","Math","floor","hasOwnProperty","call"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,kBAAT,CAA6BC,KAA7B,EAAoC;AAAE;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,MAAM,EAAV;AACA,MAAIC,IAAI,EAAR;;AAEA,MAAIC,WAAW,SAAXA,QAAW,CAAUC,GAAV,EAAe;AAC5B;AACA,QAAIF,WAAWE,GAAX,yCAAWA,GAAX,CAAJ;AACAF,QAAIA,EAAEG,WAAF,EAAJ;AACA,QAAIH,MAAM,QAAV,EAAoB;AAClBA,UAAI,OAAJ;AACD;AACD,WAAOA,CAAP;AACD,GARD;;AAUA,MAAII,cAAc,SAAdA,WAAc,CAAUN,MAAV,EAAkBO,KAAlB,EAAyB;AACzC,QAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC7B,UAAIC,KAAKC,KAAL,CAAWF,KAAX,MAAsBA,KAA1B,EAAiC;AAC/B;AACD;AACF,KAJD,MAIO,IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AACpC;AACD;;AAED,QAAIA,SAASP,MAAT,IAAmBA,OAAOU,cAAP,CAAsBH,KAAtB,CAAvB,EAAqD;AACnD,QAAEP,OAAOO,KAAP,CAAF;AACD,KAFD,MAEO;AACLP,aAAOO,KAAP,IAAgB,CAAhB;AACD;AACF,GAdD;;AAgBAL,MAAIC,SAASJ,KAAT,CAAJ;AACA,MAAIG,MAAM,OAAV,EAAmB;AACjB,SAAKD,GAAL,IAAYF,KAAZ,EAAmB;AACjB,UAAIA,MAAMW,cAAN,CAAqBT,GAArB,CAAJ,EAA+B;AAC7BK,oBAAYK,IAAZ,CAAiB,IAAjB,EAAuBX,MAAvB,EAA+BD,MAAME,GAAN,CAA/B;AACD;AACF;AACF;;AAED,SAAOD,MAAP;AACD,CAvDD","file":"array_count_values.js","sourcesContent":["module.exports = function array_count_values (array) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_count_values/\n // original by: Ates Goral (http://magnetiq.com)\n // improved by: Michael White (http://getsprink.com)\n // improved by: Kevin van Zonneveld (http://kvz.io)\n // input by: sankai\n // input by: Shingo\n // bugfixed by: Brett Zamir (http://brett-zamir.me)\n // example 1: array_count_values([ 3, 5, 3, \"foo\", \"bar\", \"foo\" ])\n // returns 1: {3:2, 5:1, \"foo\":2, \"bar\":1}\n // example 2: array_count_values({ p1: 3, p2: 5, p3: 3, p4: \"foo\", p5: \"bar\", p6: \"foo\" })\n // returns 2: {3:2, 5:1, \"foo\":2, \"bar\":1}\n // example 3: array_count_values([ true, 4.2, 42, \"fubar\" ])\n // returns 3: {42:1, \"fubar\":1}\n\n var tmpArr = {}\n var key = ''\n var t = ''\n\n var _getType = function (obj) {\n // Objects are php associative arrays.\n var t = typeof obj\n t = t.toLowerCase()\n if (t === 'object') {\n t = 'array'\n }\n return t\n }\n\n var _countValue = function (tmpArr, value) {\n if (typeof value === 'number') {\n if (Math.floor(value) !== value) {\n return\n }\n } else if (typeof value !== 'string') {\n return\n }\n\n if (value in tmpArr && tmpArr.hasOwnProperty(value)) {\n ++tmpArr[value]\n } else {\n tmpArr[value] = 1\n }\n }\n\n t = _getType(array)\n if (t === 'array') {\n for (key in array) {\n if (array.hasOwnProperty(key)) {\n _countValue.call(this, tmpArr, array[key])\n }\n }\n }\n\n return tmpArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_diff.js b/node_modules/locutus/php/array/array_diff.js new file mode 100644 index 0000000..5c437f0 --- /dev/null +++ b/node_modules/locutus/php/array/array_diff.js @@ -0,0 +1,35 @@ +'use strict'; + +module.exports = function array_diff(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_diff/ + // original by: Kevin van Zonneveld (http://kvz.io) + // improved by: Sanjoy Roy + // revised by: Brett Zamir (http://brett-zamir.me) + // example 1: array_diff(['Kevin', 'van', 'Zonneveld'], ['van', 'Zonneveld']) + // returns 1: {0:'Kevin'} + + var retArr = {}; + var argl = arguments.length; + var k1 = ''; + var i = 1; + var k = ''; + var arr = {}; + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + for (i = 1; i < argl; i++) { + arr = arguments[i]; + for (k in arr) { + if (arr[k] === arr1[k1]) { + // If it reaches here, it was found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + retArr[k1] = arr1[k1]; + } + } + + return retArr; +}; +//# sourceMappingURL=array_diff.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_diff.js.map b/node_modules/locutus/php/array/array_diff.js.map new file mode 100644 index 0000000..dd7a498 --- /dev/null +++ b/node_modules/locutus/php/array/array_diff.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_diff.js"],"names":["module","exports","array_diff","arr1","retArr","argl","arguments","length","k1","i","k","arr","arr1keys"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,UAAT,CAAqBC,IAArB,EAA2B;AAAE;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,OAAOC,UAAUC,MAArB;AACA,MAAIC,KAAK,EAAT;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,MAAM,EAAV;;AAEAC,YAAU,KAAKJ,EAAL,IAAWL,IAAX,EAAiB;AAAE;AAC3B,SAAKM,IAAI,CAAT,EAAYA,IAAIJ,IAAhB,EAAsBI,GAAtB,EAA2B;AACzBE,YAAML,UAAUG,CAAV,CAAN;AACA,WAAKC,CAAL,IAAUC,GAAV,EAAe;AACb,YAAIA,IAAID,CAAJ,MAAWP,KAAKK,EAAL,CAAf,EAAyB;AACvB;AACA,mBAASI,QAAT,CAFuB,CAEL;AACnB;AACF;AACDR,aAAOI,EAAP,IAAaL,KAAKK,EAAL,CAAb;AACD;AACF;;AAED,SAAOJ,MAAP;AACD,CA7BD","file":"array_diff.js","sourcesContent":["module.exports = function array_diff (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_diff/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Sanjoy Roy\n // revised by: Brett Zamir (http://brett-zamir.me)\n // example 1: array_diff(['Kevin', 'van', 'Zonneveld'], ['van', 'Zonneveld'])\n // returns 1: {0:'Kevin'}\n\n var retArr = {}\n var argl = arguments.length\n var k1 = ''\n var i = 1\n var k = ''\n var arr = {}\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n for (i = 1; i < argl; i++) {\n arr = arguments[i]\n for (k in arr) {\n if (arr[k] === arr1[k1]) {\n // If it reaches here, it was found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n retArr[k1] = arr1[k1]\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_diff_assoc.js b/node_modules/locutus/php/array/array_diff_assoc.js new file mode 100644 index 0000000..8422e73 --- /dev/null +++ b/node_modules/locutus/php/array/array_diff_assoc.js @@ -0,0 +1,35 @@ +'use strict'; + +module.exports = function array_diff_assoc(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_diff_assoc/ + // original by: Kevin van Zonneveld (http://kvz.io) + // bugfixed by: 0m3r + // revised by: Brett Zamir (http://brett-zamir.me) + // example 1: array_diff_assoc({0: 'Kevin', 1: 'van', 2: 'Zonneveld'}, {0: 'Kevin', 4: 'van', 5: 'Zonneveld'}) + // returns 1: {1: 'van', 2: 'Zonneveld'} + + var retArr = {}; + var argl = arguments.length; + var k1 = ''; + var i = 1; + var k = ''; + var arr = {}; + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + for (i = 1; i < argl; i++) { + arr = arguments[i]; + for (k in arr) { + if (arr[k] === arr1[k1] && k === k1) { + // If it reaches here, it was found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + retArr[k1] = arr1[k1]; + } + } + + return retArr; +}; +//# sourceMappingURL=array_diff_assoc.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_diff_assoc.js.map b/node_modules/locutus/php/array/array_diff_assoc.js.map new file mode 100644 index 0000000..1fcd5cd --- /dev/null +++ b/node_modules/locutus/php/array/array_diff_assoc.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_diff_assoc.js"],"names":["module","exports","array_diff_assoc","arr1","retArr","argl","arguments","length","k1","i","k","arr","arr1keys"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,gBAAT,CAA2BC,IAA3B,EAAiC;AAAE;AAClD;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,OAAOC,UAAUC,MAArB;AACA,MAAIC,KAAK,EAAT;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,MAAM,EAAV;;AAEAC,YAAU,KAAKJ,EAAL,IAAWL,IAAX,EAAiB;AAAE;AAC3B,SAAKM,IAAI,CAAT,EAAYA,IAAIJ,IAAhB,EAAsBI,GAAtB,EAA2B;AACzBE,YAAML,UAAUG,CAAV,CAAN;AACA,WAAKC,CAAL,IAAUC,GAAV,EAAe;AACb,YAAIA,IAAID,CAAJ,MAAWP,KAAKK,EAAL,CAAX,IAAuBE,MAAMF,EAAjC,EAAqC;AACnC;AACA,mBAASI,QAAT,CAFmC,CAEjB;AACnB;AACF;AACDR,aAAOI,EAAP,IAAaL,KAAKK,EAAL,CAAb;AACD;AACF;;AAED,SAAOJ,MAAP;AACD,CA7BD","file":"array_diff_assoc.js","sourcesContent":["module.exports = function array_diff_assoc (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_diff_assoc/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // bugfixed by: 0m3r\n // revised by: Brett Zamir (http://brett-zamir.me)\n // example 1: array_diff_assoc({0: 'Kevin', 1: 'van', 2: 'Zonneveld'}, {0: 'Kevin', 4: 'van', 5: 'Zonneveld'})\n // returns 1: {1: 'van', 2: 'Zonneveld'}\n\n var retArr = {}\n var argl = arguments.length\n var k1 = ''\n var i = 1\n var k = ''\n var arr = {}\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n for (i = 1; i < argl; i++) {\n arr = arguments[i]\n for (k in arr) {\n if (arr[k] === arr1[k1] && k === k1) {\n // If it reaches here, it was found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n retArr[k1] = arr1[k1]\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_diff_key.js b/node_modules/locutus/php/array/array_diff_key.js new file mode 100644 index 0000000..3fd0f6d --- /dev/null +++ b/node_modules/locutus/php/array/array_diff_key.js @@ -0,0 +1,37 @@ +'use strict'; + +module.exports = function array_diff_key(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_diff_key/ + // original by: Ates Goral (http://magnetiq.com) + // revised by: Brett Zamir (http://brett-zamir.me) + // input by: Everlasto + // example 1: array_diff_key({red: 1, green: 2, blue: 3, white: 4}, {red: 5}) + // returns 1: {"green":2, "blue":3, "white":4} + // example 2: array_diff_key({red: 1, green: 2, blue: 3, white: 4}, {red: 5}, {red: 5}) + // returns 2: {"green":2, "blue":3, "white":4} + + var argl = arguments.length; + var retArr = {}; + var k1 = ''; + var i = 1; + var k = ''; + var arr = {}; + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + for (i = 1; i < argl; i++) { + arr = arguments[i]; + for (k in arr) { + if (k === k1) { + // If it reaches here, it was found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + retArr[k1] = arr1[k1]; + } + } + + return retArr; +}; +//# sourceMappingURL=array_diff_key.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_diff_key.js.map b/node_modules/locutus/php/array/array_diff_key.js.map new file mode 100644 index 0000000..f220c9c --- /dev/null +++ b/node_modules/locutus/php/array/array_diff_key.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_diff_key.js"],"names":["module","exports","array_diff_key","arr1","argl","arguments","length","retArr","k1","i","k","arr","arr1keys"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,cAAT,CAAyBC,IAAzB,EAA+B;AAAE;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,OAAOC,UAAUC,MAArB;AACA,MAAIC,SAAS,EAAb;AACA,MAAIC,KAAK,EAAT;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,MAAM,EAAV;;AAEAC,YAAU,KAAKJ,EAAL,IAAWL,IAAX,EAAiB;AAAE;AAC3B,SAAKM,IAAI,CAAT,EAAYA,IAAIL,IAAhB,EAAsBK,GAAtB,EAA2B;AACzBE,YAAMN,UAAUI,CAAV,CAAN;AACA,WAAKC,CAAL,IAAUC,GAAV,EAAe;AACb,YAAID,MAAMF,EAAV,EAAc;AACZ;AACA,mBAASI,QAAT,CAFY,CAEM;AACnB;AACF;AACDL,aAAOC,EAAP,IAAaL,KAAKK,EAAL,CAAb;AACD;AACF;;AAED,SAAOD,MAAP;AACD,CA/BD","file":"array_diff_key.js","sourcesContent":["module.exports = function array_diff_key (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_diff_key/\n // original by: Ates Goral (http://magnetiq.com)\n // revised by: Brett Zamir (http://brett-zamir.me)\n // input by: Everlasto\n // example 1: array_diff_key({red: 1, green: 2, blue: 3, white: 4}, {red: 5})\n // returns 1: {\"green\":2, \"blue\":3, \"white\":4}\n // example 2: array_diff_key({red: 1, green: 2, blue: 3, white: 4}, {red: 5}, {red: 5})\n // returns 2: {\"green\":2, \"blue\":3, \"white\":4}\n\n var argl = arguments.length\n var retArr = {}\n var k1 = ''\n var i = 1\n var k = ''\n var arr = {}\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n for (i = 1; i < argl; i++) {\n arr = arguments[i]\n for (k in arr) {\n if (k === k1) {\n // If it reaches here, it was found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n retArr[k1] = arr1[k1]\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_diff_uassoc.js b/node_modules/locutus/php/array/array_diff_uassoc.js new file mode 100644 index 0000000..35cbb4b --- /dev/null +++ b/node_modules/locutus/php/array/array_diff_uassoc.js @@ -0,0 +1,41 @@ +'use strict'; + +module.exports = function array_diff_uassoc(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_diff_uassoc/ + // original by: Brett Zamir (http://brett-zamir.me) + // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'} + // example 1: var $array2 = {a: 'GREEN', B: 'brown', 0: 'yellow', 1: 'red'} + // example 1: array_diff_uassoc($array1, $array2, function (key1, key2) { return (key1 === key2 ? 0 : (key1 > key2 ? 1 : -1)) }) + // returns 1: {b: 'brown', c: 'blue', 0: 'red'} + // test: skip-1 + + var retArr = {}; + var arglm1 = arguments.length - 1; + var cb = arguments[arglm1]; + var arr = {}; + var i = 1; + var k1 = ''; + var k = ''; + + var $global = typeof window !== 'undefined' ? window : global; + + cb = typeof cb === 'string' ? $global[cb] : Object.prototype.toString.call(cb) === '[object Array]' ? $global[cb[0]][cb[1]] : cb; + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + for (i = 1; i < arglm1; i++) { + arr = arguments[i]; + for (k in arr) { + if (arr[k] === arr1[k1] && cb(k, k1) === 0) { + // If it reaches here, it was found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + retArr[k1] = arr1[k1]; + } + } + + return retArr; +}; +//# sourceMappingURL=array_diff_uassoc.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_diff_uassoc.js.map b/node_modules/locutus/php/array/array_diff_uassoc.js.map new file mode 100644 index 0000000..f92fe89 --- /dev/null +++ b/node_modules/locutus/php/array/array_diff_uassoc.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_diff_uassoc.js"],"names":["module","exports","array_diff_uassoc","arr1","retArr","arglm1","arguments","length","cb","arr","i","k1","k","$global","window","global","Object","prototype","toString","call","arr1keys"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,iBAAT,CAA4BC,IAA5B,EAAkC;AAAE;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,SAASC,UAAUC,MAAV,GAAmB,CAAhC;AACA,MAAIC,KAAKF,UAAUD,MAAV,CAAT;AACA,MAAII,MAAM,EAAV;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,KAAK,EAAT;AACA,MAAIC,IAAI,EAAR;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;;AAEAP,OAAM,OAAOA,EAAP,KAAc,QAAf,GACDK,QAAQL,EAAR,CADC,GAEAQ,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BX,EAA/B,MAAuC,gBAAxC,GACEK,QAAQL,GAAG,CAAH,CAAR,EAAeA,GAAG,CAAH,CAAf,CADF,GAEEA,EAJN;;AAMAY,YAAU,KAAKT,EAAL,IAAWR,IAAX,EAAiB;AAAE;AAC3B,SAAKO,IAAI,CAAT,EAAYA,IAAIL,MAAhB,EAAwBK,GAAxB,EAA6B;AAC3BD,YAAMH,UAAUI,CAAV,CAAN;AACA,WAAKE,CAAL,IAAUH,GAAV,EAAe;AACb,YAAIA,IAAIG,CAAJ,MAAWT,KAAKQ,EAAL,CAAX,IAAuBH,GAAGI,CAAH,EAAMD,EAAN,MAAc,CAAzC,EAA4C;AAC1C;AACA,mBAASS,QAAT,CAF0C,CAExB;AACnB;AACF;AACDhB,aAAOO,EAAP,IAAaR,KAAKQ,EAAL,CAAb;AACD;AACF;;AAED,SAAOP,MAAP;AACD,CAvCD","file":"array_diff_uassoc.js","sourcesContent":["module.exports = function array_diff_uassoc (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_diff_uassoc/\n // original by: Brett Zamir (http://brett-zamir.me)\n // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'}\n // example 1: var $array2 = {a: 'GREEN', B: 'brown', 0: 'yellow', 1: 'red'}\n // example 1: array_diff_uassoc($array1, $array2, function (key1, key2) { return (key1 === key2 ? 0 : (key1 > key2 ? 1 : -1)) })\n // returns 1: {b: 'brown', c: 'blue', 0: 'red'}\n // test: skip-1\n\n var retArr = {}\n var arglm1 = arguments.length - 1\n var cb = arguments[arglm1]\n var arr = {}\n var i = 1\n var k1 = ''\n var k = ''\n\n var $global = (typeof window !== 'undefined' ? window : global)\n\n cb = (typeof cb === 'string')\n ? $global[cb]\n : (Object.prototype.toString.call(cb) === '[object Array]')\n ? $global[cb[0]][cb[1]]\n : cb\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n for (i = 1; i < arglm1; i++) {\n arr = arguments[i]\n for (k in arr) {\n if (arr[k] === arr1[k1] && cb(k, k1) === 0) {\n // If it reaches here, it was found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n retArr[k1] = arr1[k1]\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_diff_ukey.js b/node_modules/locutus/php/array/array_diff_ukey.js new file mode 100644 index 0000000..15c287d --- /dev/null +++ b/node_modules/locutus/php/array/array_diff_ukey.js @@ -0,0 +1,41 @@ +'use strict'; + +module.exports = function array_diff_ukey(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_diff_ukey/ + // original by: Brett Zamir (http://brett-zamir.me) + // example 1: var $array1 = {blue: 1, red: 2, green: 3, purple: 4} + // example 1: var $array2 = {green: 5, blue: 6, yellow: 7, cyan: 8} + // example 1: array_diff_ukey($array1, $array2, function (key1, key2){ return (key1 === key2 ? 0 : (key1 > key2 ? 1 : -1)); }) + // returns 1: {red: 2, purple: 4} + + var retArr = {}; + var arglm1 = arguments.length - 1; + // var arglm2 = arglm1 - 1 + var cb = arguments[arglm1]; + var k1 = ''; + var i = 1; + var arr = {}; + var k = ''; + + var $global = typeof window !== 'undefined' ? window : global; + + cb = typeof cb === 'string' ? $global[cb] : Object.prototype.toString.call(cb) === '[object Array]' ? $global[cb[0]][cb[1]] : cb; + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + for (i = 1; i < arglm1; i++) { + arr = arguments[i]; + for (k in arr) { + if (cb(k, k1) === 0) { + // If it reaches here, it was found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + retArr[k1] = arr1[k1]; + } + } + + return retArr; +}; +//# sourceMappingURL=array_diff_ukey.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_diff_ukey.js.map b/node_modules/locutus/php/array/array_diff_ukey.js.map new file mode 100644 index 0000000..143d9c8 --- /dev/null +++ b/node_modules/locutus/php/array/array_diff_ukey.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_diff_ukey.js"],"names":["module","exports","array_diff_ukey","arr1","retArr","arglm1","arguments","length","cb","k1","i","arr","k","$global","window","global","Object","prototype","toString","call","arr1keys"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,eAAT,CAA0BC,IAA1B,EAAgC;AAAE;AACjD;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,SAASC,UAAUC,MAAV,GAAmB,CAAhC;AACA;AACA,MAAIC,KAAKF,UAAUD,MAAV,CAAT;AACA,MAAII,KAAK,EAAT;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,MAAM,EAAV;AACA,MAAIC,IAAI,EAAR;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;;AAEAP,OAAM,OAAOA,EAAP,KAAc,QAAf,GACDK,QAAQL,EAAR,CADC,GAEAQ,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BX,EAA/B,MAAuC,gBAAxC,GACEK,QAAQL,GAAG,CAAH,CAAR,EAAeA,GAAG,CAAH,CAAf,CADF,GAEEA,EAJN;;AAMAY,YAAU,KAAKX,EAAL,IAAWN,IAAX,EAAiB;AAAE;AAC3B,SAAKO,IAAI,CAAT,EAAYA,IAAIL,MAAhB,EAAwBK,GAAxB,EAA6B;AAC3BC,YAAML,UAAUI,CAAV,CAAN;AACA,WAAKE,CAAL,IAAUD,GAAV,EAAe;AACb,YAAIH,GAAGI,CAAH,EAAMH,EAAN,MAAc,CAAlB,EAAqB;AACnB;AACA,mBAASW,QAAT,CAFmB,CAED;AACnB;AACF;AACDhB,aAAOK,EAAP,IAAaN,KAAKM,EAAL,CAAb;AACD;AACF;;AAED,SAAOL,MAAP;AACD,CAvCD","file":"array_diff_ukey.js","sourcesContent":["module.exports = function array_diff_ukey (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_diff_ukey/\n // original by: Brett Zamir (http://brett-zamir.me)\n // example 1: var $array1 = {blue: 1, red: 2, green: 3, purple: 4}\n // example 1: var $array2 = {green: 5, blue: 6, yellow: 7, cyan: 8}\n // example 1: array_diff_ukey($array1, $array2, function (key1, key2){ return (key1 === key2 ? 0 : (key1 > key2 ? 1 : -1)); })\n // returns 1: {red: 2, purple: 4}\n\n var retArr = {}\n var arglm1 = arguments.length - 1\n // var arglm2 = arglm1 - 1\n var cb = arguments[arglm1]\n var k1 = ''\n var i = 1\n var arr = {}\n var k = ''\n\n var $global = (typeof window !== 'undefined' ? window : global)\n\n cb = (typeof cb === 'string')\n ? $global[cb]\n : (Object.prototype.toString.call(cb) === '[object Array]')\n ? $global[cb[0]][cb[1]]\n : cb\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n for (i = 1; i < arglm1; i++) {\n arr = arguments[i]\n for (k in arr) {\n if (cb(k, k1) === 0) {\n // If it reaches here, it was found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n retArr[k1] = arr1[k1]\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_fill.js b/node_modules/locutus/php/array/array_fill.js new file mode 100644 index 0000000..372c35c --- /dev/null +++ b/node_modules/locutus/php/array/array_fill.js @@ -0,0 +1,22 @@ +"use strict"; + +module.exports = function array_fill(startIndex, num, mixedVal) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_fill/ + // original by: Kevin van Zonneveld (http://kvz.io) + // improved by: Waldo Malqui Silva (http://waldo.malqui.info) + // example 1: array_fill(5, 6, 'banana') + // returns 1: { 5: 'banana', 6: 'banana', 7: 'banana', 8: 'banana', 9: 'banana', 10: 'banana' } + + var key; + var tmpArr = {}; + + if (!isNaN(startIndex) && !isNaN(num)) { + for (key = 0; key < num; key++) { + tmpArr[key + startIndex] = mixedVal; + } + } + + return tmpArr; +}; +//# sourceMappingURL=array_fill.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_fill.js.map b/node_modules/locutus/php/array/array_fill.js.map new file mode 100644 index 0000000..5b2f10e --- /dev/null +++ b/node_modules/locutus/php/array/array_fill.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_fill.js"],"names":["module","exports","array_fill","startIndex","num","mixedVal","key","tmpArr","isNaN"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,UAAT,CAAqBC,UAArB,EAAiCC,GAAjC,EAAsCC,QAAtC,EAAgD;AAAE;AACjE;AACA;AACA;AACA;AACA;;AAEA,MAAIC,GAAJ;AACA,MAAIC,SAAS,EAAb;;AAEA,MAAI,CAACC,MAAML,UAAN,CAAD,IAAsB,CAACK,MAAMJ,GAAN,CAA3B,EAAuC;AACrC,SAAKE,MAAM,CAAX,EAAcA,MAAMF,GAApB,EAAyBE,KAAzB,EAAgC;AAC9BC,aAAQD,MAAMH,UAAd,IAA6BE,QAA7B;AACD;AACF;;AAED,SAAOE,MAAP;AACD,CAjBD","file":"array_fill.js","sourcesContent":["module.exports = function array_fill (startIndex, num, mixedVal) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_fill/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Waldo Malqui Silva (http://waldo.malqui.info)\n // example 1: array_fill(5, 6, 'banana')\n // returns 1: { 5: 'banana', 6: 'banana', 7: 'banana', 8: 'banana', 9: 'banana', 10: 'banana' }\n\n var key\n var tmpArr = {}\n\n if (!isNaN(startIndex) && !isNaN(num)) {\n for (key = 0; key < num; key++) {\n tmpArr[(key + startIndex)] = mixedVal\n }\n }\n\n return tmpArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_fill_keys.js b/node_modules/locutus/php/array/array_fill_keys.js new file mode 100644 index 0000000..a98a1cc --- /dev/null +++ b/node_modules/locutus/php/array/array_fill_keys.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = function array_fill_keys(keys, value) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_fill_keys/ + // original by: Brett Zamir (http://brett-zamir.me) + // bugfixed by: Brett Zamir (http://brett-zamir.me) + // example 1: var $keys = {'a': 'foo', 2: 5, 3: 10, 4: 'bar'} + // example 1: array_fill_keys($keys, 'banana') + // returns 1: {"foo": "banana", 5: "banana", 10: "banana", "bar": "banana"} + + var retObj = {}; + var key = ''; + + for (key in keys) { + retObj[keys[key]] = value; + } + + return retObj; +}; +//# sourceMappingURL=array_fill_keys.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_fill_keys.js.map b/node_modules/locutus/php/array/array_fill_keys.js.map new file mode 100644 index 0000000..c480878 --- /dev/null +++ b/node_modules/locutus/php/array/array_fill_keys.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_fill_keys.js"],"names":["module","exports","array_fill_keys","keys","value","retObj","key"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,eAAT,CAA0BC,IAA1B,EAAgCC,KAAhC,EAAuC;AAAE;AACxD;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,MAAM,EAAV;;AAEA,OAAKA,GAAL,IAAYH,IAAZ,EAAkB;AAChBE,WAAOF,KAAKG,GAAL,CAAP,IAAoBF,KAApB;AACD;;AAED,SAAOC,MAAP;AACD,CAhBD","file":"array_fill_keys.js","sourcesContent":["module.exports = function array_fill_keys (keys, value) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_fill_keys/\n // original by: Brett Zamir (http://brett-zamir.me)\n // bugfixed by: Brett Zamir (http://brett-zamir.me)\n // example 1: var $keys = {'a': 'foo', 2: 5, 3: 10, 4: 'bar'}\n // example 1: array_fill_keys($keys, 'banana')\n // returns 1: {\"foo\": \"banana\", 5: \"banana\", 10: \"banana\", \"bar\": \"banana\"}\n\n var retObj = {}\n var key = ''\n\n for (key in keys) {\n retObj[keys[key]] = value\n }\n\n return retObj\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_filter.js b/node_modules/locutus/php/array/array_filter.js new file mode 100644 index 0000000..cbdaa57 --- /dev/null +++ b/node_modules/locutus/php/array/array_filter.js @@ -0,0 +1,39 @@ +'use strict'; + +module.exports = function array_filter(arr, func) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_filter/ + // original by: Brett Zamir (http://brett-zamir.me) + // input by: max4ever + // improved by: Brett Zamir (http://brett-zamir.me) + // note 1: Takes a function as an argument, not a function's name + // example 1: var odd = function (num) {return (num & 1);} + // example 1: array_filter({"a": 1, "b": 2, "c": 3, "d": 4, "e": 5}, odd) + // returns 1: {"a": 1, "c": 3, "e": 5} + // example 2: var even = function (num) {return (!(num & 1));} + // example 2: array_filter([6, 7, 8, 9, 10, 11, 12], even) + // returns 2: [ 6, , 8, , 10, , 12 ] + // example 3: array_filter({"a": 1, "b": false, "c": -1, "d": 0, "e": null, "f":'', "g":undefined}) + // returns 3: {"a":1, "c":-1} + + var retObj = {}; + var k; + + func = func || function (v) { + return v; + }; + + // @todo: Issue #73 + if (Object.prototype.toString.call(arr) === '[object Array]') { + retObj = []; + } + + for (k in arr) { + if (func(arr[k])) { + retObj[k] = arr[k]; + } + } + + return retObj; +}; +//# sourceMappingURL=array_filter.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_filter.js.map b/node_modules/locutus/php/array/array_filter.js.map new file mode 100644 index 0000000..fa3f6a4 --- /dev/null +++ b/node_modules/locutus/php/array/array_filter.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_filter.js"],"names":["module","exports","array_filter","arr","func","retObj","k","v","Object","prototype","toString","call"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,YAAT,CAAuBC,GAAvB,EAA4BC,IAA5B,EAAkC;AAAE;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,CAAJ;;AAEAF,SAAOA,QAAQ,UAAUG,CAAV,EAAa;AAC1B,WAAOA,CAAP;AACD,GAFD;;AAIA;AACA,MAAIC,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BR,GAA/B,MAAwC,gBAA5C,EAA8D;AAC5DE,aAAS,EAAT;AACD;;AAED,OAAKC,CAAL,IAAUH,GAAV,EAAe;AACb,QAAIC,KAAKD,IAAIG,CAAJ,CAAL,CAAJ,EAAkB;AAChBD,aAAOC,CAAP,IAAYH,IAAIG,CAAJ,CAAZ;AACD;AACF;;AAED,SAAOD,MAAP;AACD,CAlCD","file":"array_filter.js","sourcesContent":["module.exports = function array_filter (arr, func) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_filter/\n // original by: Brett Zamir (http://brett-zamir.me)\n // input by: max4ever\n // improved by: Brett Zamir (http://brett-zamir.me)\n // note 1: Takes a function as an argument, not a function's name\n // example 1: var odd = function (num) {return (num & 1);}\n // example 1: array_filter({\"a\": 1, \"b\": 2, \"c\": 3, \"d\": 4, \"e\": 5}, odd)\n // returns 1: {\"a\": 1, \"c\": 3, \"e\": 5}\n // example 2: var even = function (num) {return (!(num & 1));}\n // example 2: array_filter([6, 7, 8, 9, 10, 11, 12], even)\n // returns 2: [ 6, , 8, , 10, , 12 ]\n // example 3: array_filter({\"a\": 1, \"b\": false, \"c\": -1, \"d\": 0, \"e\": null, \"f\":'', \"g\":undefined})\n // returns 3: {\"a\":1, \"c\":-1}\n\n var retObj = {}\n var k\n\n func = func || function (v) {\n return v\n }\n\n // @todo: Issue #73\n if (Object.prototype.toString.call(arr) === '[object Array]') {\n retObj = []\n }\n\n for (k in arr) {\n if (func(arr[k])) {\n retObj[k] = arr[k]\n }\n }\n\n return retObj\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_flip.js b/node_modules/locutus/php/array/array_flip.js new file mode 100644 index 0000000..64af345 --- /dev/null +++ b/node_modules/locutus/php/array/array_flip.js @@ -0,0 +1,24 @@ +"use strict"; + +module.exports = function array_flip(trans) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_flip/ + // original by: Kevin van Zonneveld (http://kvz.io) + // improved by: Pier Paolo Ramon (http://www.mastersoup.com/) + // improved by: Brett Zamir (http://brett-zamir.me) + // example 1: array_flip( {a: 1, b: 1, c: 2} ) + // returns 1: {1: 'b', 2: 'c'} + + var key; + var tmpArr = {}; + + for (key in trans) { + if (!trans.hasOwnProperty(key)) { + continue; + } + tmpArr[trans[key]] = key; + } + + return tmpArr; +}; +//# sourceMappingURL=array_flip.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_flip.js.map b/node_modules/locutus/php/array/array_flip.js.map new file mode 100644 index 0000000..0fd52ad --- /dev/null +++ b/node_modules/locutus/php/array/array_flip.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_flip.js"],"names":["module","exports","array_flip","trans","key","tmpArr","hasOwnProperty"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,UAAT,CAAqBC,KAArB,EAA4B;AAAE;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,GAAJ;AACA,MAAIC,SAAS,EAAb;;AAEA,OAAKD,GAAL,IAAYD,KAAZ,EAAmB;AACjB,QAAI,CAACA,MAAMG,cAAN,CAAqBF,GAArB,CAAL,EAAgC;AAC9B;AACD;AACDC,WAAOF,MAAMC,GAAN,CAAP,IAAqBA,GAArB;AACD;;AAED,SAAOC,MAAP;AACD,CAnBD","file":"array_flip.js","sourcesContent":["module.exports = function array_flip (trans) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_flip/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Pier Paolo Ramon (http://www.mastersoup.com/)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // example 1: array_flip( {a: 1, b: 1, c: 2} )\n // returns 1: {1: 'b', 2: 'c'}\n\n var key\n var tmpArr = {}\n\n for (key in trans) {\n if (!trans.hasOwnProperty(key)) {\n continue\n }\n tmpArr[trans[key]] = key\n }\n\n return tmpArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_intersect.js b/node_modules/locutus/php/array/array_intersect.js new file mode 100644 index 0000000..4e0b5c0 --- /dev/null +++ b/node_modules/locutus/php/array/array_intersect.js @@ -0,0 +1,45 @@ +'use strict'; + +module.exports = function array_intersect(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_intersect/ + // original by: Brett Zamir (http://brett-zamir.me) + // note 1: These only output associative arrays (would need to be + // note 1: all numeric and counting from zero to be numeric) + // example 1: var $array1 = {'a' : 'green', 0:'red', 1: 'blue'} + // example 1: var $array2 = {'b' : 'green', 0:'yellow', 1:'red'} + // example 1: var $array3 = ['green', 'red'] + // example 1: var $result = array_intersect($array1, $array2, $array3) + // returns 1: {0: 'red', a: 'green'} + + var retArr = {}; + var argl = arguments.length; + var arglm1 = argl - 1; + var k1 = ''; + var arr = {}; + var i = 0; + var k = ''; + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + arrs: for (i = 1; i < argl; i++) { + // eslint-disable-line no-labels + arr = arguments[i]; + for (k in arr) { + if (arr[k] === arr1[k1]) { + if (i === arglm1) { + retArr[k1] = arr1[k1]; + } + // If the innermost loop always leads at least once to an equal value, + // continue the loop until done + continue arrs; // eslint-disable-line no-labels + } + } + // If it reaches here, it wasn't found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + + return retArr; +}; +//# sourceMappingURL=array_intersect.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_intersect.js.map b/node_modules/locutus/php/array/array_intersect.js.map new file mode 100644 index 0000000..b65ecc1 --- /dev/null +++ b/node_modules/locutus/php/array/array_intersect.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_intersect.js"],"names":["module","exports","array_intersect","arr1","retArr","argl","arguments","length","arglm1","k1","arr","i","k","arr1keys","arrs"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,eAAT,CAA0BC,IAA1B,EAAgC;AAAE;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,OAAOC,UAAUC,MAArB;AACA,MAAIC,SAASH,OAAO,CAApB;AACA,MAAII,KAAK,EAAT;AACA,MAAIC,MAAM,EAAV;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,EAAR;;AAEAC,YAAU,KAAKJ,EAAL,IAAWN,IAAX,EAAiB;AAAE;AAC3BW,UAAM,KAAKH,IAAI,CAAT,EAAYA,IAAIN,IAAhB,EAAsBM,GAAtB,EAA2B;AAAE;AACjCD,YAAMJ,UAAUK,CAAV,CAAN;AACA,WAAKC,CAAL,IAAUF,GAAV,EAAe;AACb,YAAIA,IAAIE,CAAJ,MAAWT,KAAKM,EAAL,CAAf,EAAyB;AACvB,cAAIE,MAAMH,MAAV,EAAkB;AAChBJ,mBAAOK,EAAP,IAAaN,KAAKM,EAAL,CAAb;AACD;AACD;AACA;AACA,mBAASK,IAAT,CANuB,CAMV;AACd;AACF;AACD;AACA,eAASD,QAAT,CAb+B,CAad;AAClB;AACF;;AAED,SAAOT,MAAP;AACD,CAtCD","file":"array_intersect.js","sourcesContent":["module.exports = function array_intersect (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_intersect/\n // original by: Brett Zamir (http://brett-zamir.me)\n // note 1: These only output associative arrays (would need to be\n // note 1: all numeric and counting from zero to be numeric)\n // example 1: var $array1 = {'a' : 'green', 0:'red', 1: 'blue'}\n // example 1: var $array2 = {'b' : 'green', 0:'yellow', 1:'red'}\n // example 1: var $array3 = ['green', 'red']\n // example 1: var $result = array_intersect($array1, $array2, $array3)\n // returns 1: {0: 'red', a: 'green'}\n\n var retArr = {}\n var argl = arguments.length\n var arglm1 = argl - 1\n var k1 = ''\n var arr = {}\n var i = 0\n var k = ''\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n arrs: for (i = 1; i < argl; i++) { // eslint-disable-line no-labels\n arr = arguments[i]\n for (k in arr) {\n if (arr[k] === arr1[k1]) {\n if (i === arglm1) {\n retArr[k1] = arr1[k1]\n }\n // If the innermost loop always leads at least once to an equal value,\n // continue the loop until done\n continue arrs// eslint-disable-line no-labels\n }\n }\n // If it reaches here, it wasn't found in at least one array, so try next value\n continue arr1keys// eslint-disable-line no-labels\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_intersect_assoc.js b/node_modules/locutus/php/array/array_intersect_assoc.js new file mode 100644 index 0000000..fa5e051 --- /dev/null +++ b/node_modules/locutus/php/array/array_intersect_assoc.js @@ -0,0 +1,44 @@ +'use strict'; + +module.exports = function array_intersect_assoc(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_intersect_assoc/ + // original by: Brett Zamir (http://brett-zamir.me) + // note 1: These only output associative arrays (would need to be + // note 1: all numeric and counting from zero to be numeric) + // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'} + // example 1: var $array2 = {a: 'green', 0: 'yellow', 1: 'red'} + // example 1: array_intersect_assoc($array1, $array2) + // returns 1: {a: 'green'} + + var retArr = {}; + var argl = arguments.length; + var arglm1 = argl - 1; + var k1 = ''; + var arr = {}; + var i = 0; + var k = ''; + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + arrs: for (i = 1; i < argl; i++) { + // eslint-disable-line no-labels + arr = arguments[i]; + for (k in arr) { + if (arr[k] === arr1[k1] && k === k1) { + if (i === arglm1) { + retArr[k1] = arr1[k1]; + } + // If the innermost loop always leads at least once to an equal value, + // continue the loop until done + continue arrs; // eslint-disable-line no-labels + } + } + // If it reaches here, it wasn't found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + + return retArr; +}; +//# sourceMappingURL=array_intersect_assoc.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_intersect_assoc.js.map b/node_modules/locutus/php/array/array_intersect_assoc.js.map new file mode 100644 index 0000000..ecb6426 --- /dev/null +++ b/node_modules/locutus/php/array/array_intersect_assoc.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_intersect_assoc.js"],"names":["module","exports","array_intersect_assoc","arr1","retArr","argl","arguments","length","arglm1","k1","arr","i","k","arr1keys","arrs"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,qBAAT,CAAgCC,IAAhC,EAAsC;AAAE;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,OAAOC,UAAUC,MAArB;AACA,MAAIC,SAASH,OAAO,CAApB;AACA,MAAII,KAAK,EAAT;AACA,MAAIC,MAAM,EAAV;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,EAAR;;AAEAC,YAAU,KAAKJ,EAAL,IAAWN,IAAX,EAAiB;AAAE;AAC3BW,UAAM,KAAKH,IAAI,CAAT,EAAYA,IAAIN,IAAhB,EAAsBM,GAAtB,EAA2B;AAAE;AACjCD,YAAMJ,UAAUK,CAAV,CAAN;AACA,WAAKC,CAAL,IAAUF,GAAV,EAAe;AACb,YAAIA,IAAIE,CAAJ,MAAWT,KAAKM,EAAL,CAAX,IAAuBG,MAAMH,EAAjC,EAAqC;AACnC,cAAIE,MAAMH,MAAV,EAAkB;AAChBJ,mBAAOK,EAAP,IAAaN,KAAKM,EAAL,CAAb;AACD;AACD;AACA;AACA,mBAASK,IAAT,CANmC,CAMrB;AACf;AACF;AACD;AACA,eAASD,QAAT,CAb+B,CAab;AACnB;AACF;;AAED,SAAOT,MAAP;AACD,CArCD","file":"array_intersect_assoc.js","sourcesContent":["module.exports = function array_intersect_assoc (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_intersect_assoc/\n // original by: Brett Zamir (http://brett-zamir.me)\n // note 1: These only output associative arrays (would need to be\n // note 1: all numeric and counting from zero to be numeric)\n // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'}\n // example 1: var $array2 = {a: 'green', 0: 'yellow', 1: 'red'}\n // example 1: array_intersect_assoc($array1, $array2)\n // returns 1: {a: 'green'}\n\n var retArr = {}\n var argl = arguments.length\n var arglm1 = argl - 1\n var k1 = ''\n var arr = {}\n var i = 0\n var k = ''\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n arrs: for (i = 1; i < argl; i++) { // eslint-disable-line no-labels\n arr = arguments[i]\n for (k in arr) {\n if (arr[k] === arr1[k1] && k === k1) {\n if (i === arglm1) {\n retArr[k1] = arr1[k1]\n }\n // If the innermost loop always leads at least once to an equal value,\n // continue the loop until done\n continue arrs // eslint-disable-line no-labels\n }\n }\n // If it reaches here, it wasn't found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_intersect_key.js b/node_modules/locutus/php/array/array_intersect_key.js new file mode 100644 index 0000000..4fec133 --- /dev/null +++ b/node_modules/locutus/php/array/array_intersect_key.js @@ -0,0 +1,50 @@ +'use strict'; + +module.exports = function array_intersect_key(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_intersect_key/ + // original by: Brett Zamir (http://brett-zamir.me) + // note 1: These only output associative arrays (would need to be + // note 1: all numeric and counting from zero to be numeric) + // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'} + // example 1: var $array2 = {a: 'green', 0: 'yellow', 1: 'red'} + // example 1: array_intersect_key($array1, $array2) + // returns 1: {0: 'red', a: 'green'} + + var retArr = {}; + var argl = arguments.length; + var arglm1 = argl - 1; + var k1 = ''; + var arr = {}; + var i = 0; + var k = ''; + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + if (!arr1.hasOwnProperty(k1)) { + continue; + } + arrs: for (i = 1; i < argl; i++) { + // eslint-disable-line no-labels + arr = arguments[i]; + for (k in arr) { + if (!arr.hasOwnProperty(k)) { + continue; + } + if (k === k1) { + if (i === arglm1) { + retArr[k1] = arr1[k1]; + } + // If the innermost loop always leads at least once to an equal value, + // continue the loop until done + continue arrs; // eslint-disable-line no-labels + } + } + // If it reaches here, it wasn't found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + + return retArr; +}; +//# sourceMappingURL=array_intersect_key.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_intersect_key.js.map b/node_modules/locutus/php/array/array_intersect_key.js.map new file mode 100644 index 0000000..3645254 --- /dev/null +++ b/node_modules/locutus/php/array/array_intersect_key.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_intersect_key.js"],"names":["module","exports","array_intersect_key","arr1","retArr","argl","arguments","length","arglm1","k1","arr","i","k","arr1keys","hasOwnProperty","arrs"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,mBAAT,CAA8BC,IAA9B,EAAoC;AAAE;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,OAAOC,UAAUC,MAArB;AACA,MAAIC,SAASH,OAAO,CAApB;AACA,MAAII,KAAK,EAAT;AACA,MAAIC,MAAM,EAAV;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,EAAR;;AAEAC,YAAU,KAAKJ,EAAL,IAAWN,IAAX,EAAiB;AAAE;AAC3B,QAAI,CAACA,KAAKW,cAAL,CAAoBL,EAApB,CAAL,EAA8B;AAC5B;AACD;AACDM,UAAM,KAAKJ,IAAI,CAAT,EAAYA,IAAIN,IAAhB,EAAsBM,GAAtB,EAA2B;AAAE;AACjCD,YAAMJ,UAAUK,CAAV,CAAN;AACA,WAAKC,CAAL,IAAUF,GAAV,EAAe;AACb,YAAI,CAACA,IAAII,cAAJ,CAAmBF,CAAnB,CAAL,EAA4B;AAC1B;AACD;AACD,YAAIA,MAAMH,EAAV,EAAc;AACZ,cAAIE,MAAMH,MAAV,EAAkB;AAChBJ,mBAAOK,EAAP,IAAaN,KAAKM,EAAL,CAAb;AACD;AACD;AACA;AACA,mBAASM,IAAT,CANY,CAME;AACf;AACF;AACD;AACA,eAASF,QAAT,CAhB+B,CAgBb;AACnB;AACF;;AAED,SAAOT,MAAP;AACD,CA3CD","file":"array_intersect_key.js","sourcesContent":["module.exports = function array_intersect_key (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_intersect_key/\n // original by: Brett Zamir (http://brett-zamir.me)\n // note 1: These only output associative arrays (would need to be\n // note 1: all numeric and counting from zero to be numeric)\n // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'}\n // example 1: var $array2 = {a: 'green', 0: 'yellow', 1: 'red'}\n // example 1: array_intersect_key($array1, $array2)\n // returns 1: {0: 'red', a: 'green'}\n\n var retArr = {}\n var argl = arguments.length\n var arglm1 = argl - 1\n var k1 = ''\n var arr = {}\n var i = 0\n var k = ''\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n if (!arr1.hasOwnProperty(k1)) {\n continue\n }\n arrs: for (i = 1; i < argl; i++) { // eslint-disable-line no-labels\n arr = arguments[i]\n for (k in arr) {\n if (!arr.hasOwnProperty(k)) {\n continue\n }\n if (k === k1) {\n if (i === arglm1) {\n retArr[k1] = arr1[k1]\n }\n // If the innermost loop always leads at least once to an equal value,\n // continue the loop until done\n continue arrs // eslint-disable-line no-labels\n }\n }\n // If it reaches here, it wasn't found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_intersect_uassoc.js b/node_modules/locutus/php/array/array_intersect_uassoc.js new file mode 100644 index 0000000..8511640 --- /dev/null +++ b/node_modules/locutus/php/array/array_intersect_uassoc.js @@ -0,0 +1,54 @@ +'use strict'; + +module.exports = function array_intersect_uassoc(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_intersect_uassoc/ + // original by: Brett Zamir (http://brett-zamir.me) + // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'} + // example 1: var $array2 = {a: 'GREEN', B: 'brown', 0: 'yellow', 1: 'red'} + // example 1: array_intersect_uassoc($array1, $array2, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;}) + // returns 1: {b: 'brown'} + + var retArr = {}; + var arglm1 = arguments.length - 1; + var arglm2 = arglm1 - 1; + var cb = arguments[arglm1]; + // var cb0 = arguments[arglm2] + var k1 = ''; + var i = 1; + var k = ''; + var arr = {}; + + var $global = typeof window !== 'undefined' ? window : global; + + cb = typeof cb === 'string' ? $global[cb] : Object.prototype.toString.call(cb) === '[object Array]' ? $global[cb[0]][cb[1]] : cb; + + // cb0 = (typeof cb0 === 'string') + // ? $global[cb0] + // : (Object.prototype.toString.call(cb0) === '[object Array]') + // ? $global[cb0[0]][cb0[1]] + // : cb0 + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + arrs: for (i = 1; i < arglm1; i++) { + // eslint-disable-line no-labels + arr = arguments[i]; + for (k in arr) { + if (arr[k] === arr1[k1] && cb(k, k1) === 0) { + if (i === arglm2) { + retArr[k1] = arr1[k1]; + } + // If the innermost loop always leads at least once to an equal value, + // continue the loop until done + continue arrs; // eslint-disable-line no-labels + } + } + // If it reaches here, it wasn't found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + + return retArr; +}; +//# sourceMappingURL=array_intersect_uassoc.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_intersect_uassoc.js.map b/node_modules/locutus/php/array/array_intersect_uassoc.js.map new file mode 100644 index 0000000..d35964c --- /dev/null +++ b/node_modules/locutus/php/array/array_intersect_uassoc.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_intersect_uassoc.js"],"names":["module","exports","array_intersect_uassoc","arr1","retArr","arglm1","arguments","length","arglm2","cb","k1","i","k","arr","$global","window","global","Object","prototype","toString","call","arr1keys","arrs"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,sBAAT,CAAiCC,IAAjC,EAAuC;AAAE;AACxD;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,SAASC,UAAUC,MAAV,GAAmB,CAAhC;AACA,MAAIC,SAASH,SAAS,CAAtB;AACA,MAAII,KAAKH,UAAUD,MAAV,CAAT;AACA;AACA,MAAIK,KAAK,EAAT;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,MAAM,EAAV;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;;AAEAP,OAAM,OAAOA,EAAP,KAAc,QAAf,GACDK,QAAQL,EAAR,CADC,GAEAQ,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BX,EAA/B,MAAuC,gBAAxC,GACEK,QAAQL,GAAG,CAAH,CAAR,EAAeA,GAAG,CAAH,CAAf,CADF,GAEEA,EAJN;;AAMA;AACA;AACA;AACA;AACA;;AAEAY,YAAU,KAAKX,EAAL,IAAWP,IAAX,EAAiB;AAAE;AAC3BmB,UAAM,KAAKX,IAAI,CAAT,EAAYA,IAAIN,MAAhB,EAAwBM,GAAxB,EAA6B;AAAE;AACnCE,YAAMP,UAAUK,CAAV,CAAN;AACA,WAAKC,CAAL,IAAUC,GAAV,EAAe;AACb,YAAIA,IAAID,CAAJ,MAAWT,KAAKO,EAAL,CAAX,IAAuBD,GAAGG,CAAH,EAAMF,EAAN,MAAc,CAAzC,EAA4C;AAC1C,cAAIC,MAAMH,MAAV,EAAkB;AAChBJ,mBAAOM,EAAP,IAAaP,KAAKO,EAAL,CAAb;AACD;AACD;AACA;AACA,mBAASY,IAAT,CAN0C,CAM5B;AACf;AACF;AACD;AACA,eAASD,QAAT,CAbiC,CAaf;AACnB;AACF;;AAED,SAAOjB,MAAP;AACD,CAnDD","file":"array_intersect_uassoc.js","sourcesContent":["module.exports = function array_intersect_uassoc (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_intersect_uassoc/\n // original by: Brett Zamir (http://brett-zamir.me)\n // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'}\n // example 1: var $array2 = {a: 'GREEN', B: 'brown', 0: 'yellow', 1: 'red'}\n // example 1: array_intersect_uassoc($array1, $array2, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;})\n // returns 1: {b: 'brown'}\n\n var retArr = {}\n var arglm1 = arguments.length - 1\n var arglm2 = arglm1 - 1\n var cb = arguments[arglm1]\n // var cb0 = arguments[arglm2]\n var k1 = ''\n var i = 1\n var k = ''\n var arr = {}\n\n var $global = (typeof window !== 'undefined' ? window : global)\n\n cb = (typeof cb === 'string')\n ? $global[cb]\n : (Object.prototype.toString.call(cb) === '[object Array]')\n ? $global[cb[0]][cb[1]]\n : cb\n\n // cb0 = (typeof cb0 === 'string')\n // ? $global[cb0]\n // : (Object.prototype.toString.call(cb0) === '[object Array]')\n // ? $global[cb0[0]][cb0[1]]\n // : cb0\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n arrs: for (i = 1; i < arglm1; i++) { // eslint-disable-line no-labels\n arr = arguments[i]\n for (k in arr) {\n if (arr[k] === arr1[k1] && cb(k, k1) === 0) {\n if (i === arglm2) {\n retArr[k1] = arr1[k1]\n }\n // If the innermost loop always leads at least once to an equal value,\n // continue the loop until done\n continue arrs // eslint-disable-line no-labels\n }\n }\n // If it reaches here, it wasn't found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_intersect_ukey.js b/node_modules/locutus/php/array/array_intersect_ukey.js new file mode 100644 index 0000000..0ebcc77 --- /dev/null +++ b/node_modules/locutus/php/array/array_intersect_ukey.js @@ -0,0 +1,54 @@ +'use strict'; + +module.exports = function array_intersect_ukey(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_intersect_ukey/ + // original by: Brett Zamir (http://brett-zamir.me) + // example 1: var $array1 = {blue: 1, red: 2, green: 3, purple: 4} + // example 1: var $array2 = {green: 5, blue: 6, yellow: 7, cyan: 8} + // example 1: array_intersect_ukey ($array1, $array2, function (key1, key2){ return (key1 === key2 ? 0 : (key1 > key2 ? 1 : -1)); }) + // returns 1: {blue: 1, green: 3} + + var retArr = {}; + var arglm1 = arguments.length - 1; + var arglm2 = arglm1 - 1; + var cb = arguments[arglm1]; + // var cb0 = arguments[arglm2] + var k1 = ''; + var i = 1; + var k = ''; + var arr = {}; + + var $global = typeof window !== 'undefined' ? window : global; + + cb = typeof cb === 'string' ? $global[cb] : Object.prototype.toString.call(cb) === '[object Array]' ? $global[cb[0]][cb[1]] : cb; + + // cb0 = (typeof cb0 === 'string') + // ? $global[cb0] + // : (Object.prototype.toString.call(cb0) === '[object Array]') + // ? $global[cb0[0]][cb0[1]] + // : cb0 + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + arrs: for (i = 1; i < arglm1; i++) { + // eslint-disable-line no-labels + arr = arguments[i]; + for (k in arr) { + if (cb(k, k1) === 0) { + if (i === arglm2) { + retArr[k1] = arr1[k1]; + } + // If the innermost loop always leads at least once to an equal value, + // continue the loop until done + continue arrs; // eslint-disable-line no-labels + } + } + // If it reaches here, it wasn't found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + + return retArr; +}; +//# sourceMappingURL=array_intersect_ukey.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_intersect_ukey.js.map b/node_modules/locutus/php/array/array_intersect_ukey.js.map new file mode 100644 index 0000000..d87e254 --- /dev/null +++ b/node_modules/locutus/php/array/array_intersect_ukey.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_intersect_ukey.js"],"names":["module","exports","array_intersect_ukey","arr1","retArr","arglm1","arguments","length","arglm2","cb","k1","i","k","arr","$global","window","global","Object","prototype","toString","call","arr1keys","arrs"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,oBAAT,CAA+BC,IAA/B,EAAqC;AAAE;AACtD;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,SAASC,UAAUC,MAAV,GAAmB,CAAhC;AACA,MAAIC,SAASH,SAAS,CAAtB;AACA,MAAII,KAAKH,UAAUD,MAAV,CAAT;AACA;AACA,MAAIK,KAAK,EAAT;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,MAAM,EAAV;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;;AAEAP,OAAM,OAAOA,EAAP,KAAc,QAAf,GACDK,QAAQL,EAAR,CADC,GAEAQ,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BX,EAA/B,MAAuC,gBAAxC,GACEK,QAAQL,GAAG,CAAH,CAAR,EAAeA,GAAG,CAAH,CAAf,CADF,GAEEA,EAJN;;AAMA;AACA;AACA;AACA;AACA;;AAEAY,YAAU,KAAKX,EAAL,IAAWP,IAAX,EAAiB;AAAE;AAC3BmB,UAAM,KAAKX,IAAI,CAAT,EAAYA,IAAIN,MAAhB,EAAwBM,GAAxB,EAA6B;AAAE;AACnCE,YAAMP,UAAUK,CAAV,CAAN;AACA,WAAKC,CAAL,IAAUC,GAAV,EAAe;AACb,YAAIJ,GAAGG,CAAH,EAAMF,EAAN,MAAc,CAAlB,EAAqB;AACnB,cAAIC,MAAMH,MAAV,EAAkB;AAChBJ,mBAAOM,EAAP,IAAaP,KAAKO,EAAL,CAAb;AACD;AACD;AACA;AACA,mBAASY,IAAT,CANmB,CAML;AACf;AACF;AACD;AACA,eAASD,QAAT,CAbiC,CAaf;AACnB;AACF;;AAED,SAAOjB,MAAP;AACD,CAnDD","file":"array_intersect_ukey.js","sourcesContent":["module.exports = function array_intersect_ukey (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_intersect_ukey/\n // original by: Brett Zamir (http://brett-zamir.me)\n // example 1: var $array1 = {blue: 1, red: 2, green: 3, purple: 4}\n // example 1: var $array2 = {green: 5, blue: 6, yellow: 7, cyan: 8}\n // example 1: array_intersect_ukey ($array1, $array2, function (key1, key2){ return (key1 === key2 ? 0 : (key1 > key2 ? 1 : -1)); })\n // returns 1: {blue: 1, green: 3}\n\n var retArr = {}\n var arglm1 = arguments.length - 1\n var arglm2 = arglm1 - 1\n var cb = arguments[arglm1]\n // var cb0 = arguments[arglm2]\n var k1 = ''\n var i = 1\n var k = ''\n var arr = {}\n\n var $global = (typeof window !== 'undefined' ? window : global)\n\n cb = (typeof cb === 'string')\n ? $global[cb]\n : (Object.prototype.toString.call(cb) === '[object Array]')\n ? $global[cb[0]][cb[1]]\n : cb\n\n // cb0 = (typeof cb0 === 'string')\n // ? $global[cb0]\n // : (Object.prototype.toString.call(cb0) === '[object Array]')\n // ? $global[cb0[0]][cb0[1]]\n // : cb0\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n arrs: for (i = 1; i < arglm1; i++) { // eslint-disable-line no-labels\n arr = arguments[i]\n for (k in arr) {\n if (cb(k, k1) === 0) {\n if (i === arglm2) {\n retArr[k1] = arr1[k1]\n }\n // If the innermost loop always leads at least once to an equal value,\n // continue the loop until done\n continue arrs // eslint-disable-line no-labels\n }\n }\n // If it reaches here, it wasn't found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_key_exists.js b/node_modules/locutus/php/array/array_key_exists.js new file mode 100644 index 0000000..6c9efdf --- /dev/null +++ b/node_modules/locutus/php/array/array_key_exists.js @@ -0,0 +1,17 @@ +"use strict"; + +module.exports = function array_key_exists(key, search) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_key_exists/ + // original by: Kevin van Zonneveld (http://kvz.io) + // improved by: Felix Geisendoerfer (http://www.debuggable.com/felix) + // example 1: array_key_exists('kevin', {'kevin': 'van Zonneveld'}) + // returns 1: true + + if (!search || search.constructor !== Array && search.constructor !== Object) { + return false; + } + + return key in search; +}; +//# sourceMappingURL=array_key_exists.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_key_exists.js.map b/node_modules/locutus/php/array/array_key_exists.js.map new file mode 100644 index 0000000..db4dbba --- /dev/null +++ b/node_modules/locutus/php/array/array_key_exists.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_key_exists.js"],"names":["module","exports","array_key_exists","key","search","constructor","Array","Object"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,gBAAT,CAA2BC,GAA3B,EAAgCC,MAAhC,EAAwC;AAAE;AACzD;AACA;AACA;AACA;AACA;;AAEA,MAAI,CAACA,MAAD,IAAYA,OAAOC,WAAP,KAAuBC,KAAvB,IAAgCF,OAAOC,WAAP,KAAuBE,MAAvE,EAAgF;AAC9E,WAAO,KAAP;AACD;;AAED,SAAOJ,OAAOC,MAAd;AACD,CAZD","file":"array_key_exists.js","sourcesContent":["module.exports = function array_key_exists (key, search) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_key_exists/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Felix Geisendoerfer (http://www.debuggable.com/felix)\n // example 1: array_key_exists('kevin', {'kevin': 'van Zonneveld'})\n // returns 1: true\n\n if (!search || (search.constructor !== Array && search.constructor !== Object)) {\n return false\n }\n\n return key in search\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_keys.js b/node_modules/locutus/php/array/array_keys.js new file mode 100644 index 0000000..46b2830 --- /dev/null +++ b/node_modules/locutus/php/array/array_keys.js @@ -0,0 +1,41 @@ +'use strict'; + +module.exports = function array_keys(input, searchValue, argStrict) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_keys/ + // original by: Kevin van Zonneveld (http://kvz.io) + // input by: Brett Zamir (http://brett-zamir.me) + // input by: P + // bugfixed by: Kevin van Zonneveld (http://kvz.io) + // bugfixed by: Brett Zamir (http://brett-zamir.me) + // improved by: jd + // improved by: Brett Zamir (http://brett-zamir.me) + // example 1: array_keys( {firstname: 'Kevin', surname: 'van Zonneveld'} ) + // returns 1: [ 'firstname', 'surname' ] + + var search = typeof searchValue !== 'undefined'; + var tmpArr = []; + var strict = !!argStrict; + var include = true; + var key = ''; + + for (key in input) { + if (input.hasOwnProperty(key)) { + include = true; + if (search) { + if (strict && input[key] !== searchValue) { + include = false; + } else if (input[key] !== searchValue) { + include = false; + } + } + + if (include) { + tmpArr[tmpArr.length] = key; + } + } + } + + return tmpArr; +}; +//# sourceMappingURL=array_keys.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_keys.js.map b/node_modules/locutus/php/array/array_keys.js.map new file mode 100644 index 0000000..82f86ab --- /dev/null +++ b/node_modules/locutus/php/array/array_keys.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_keys.js"],"names":["module","exports","array_keys","input","searchValue","argStrict","search","tmpArr","strict","include","key","hasOwnProperty","length"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,UAAT,CAAqBC,KAArB,EAA4BC,WAA5B,EAAyCC,SAAzC,EAAoD;AAAE;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,OAAOF,WAAP,KAAuB,WAApC;AACA,MAAIG,SAAS,EAAb;AACA,MAAIC,SAAS,CAAC,CAACH,SAAf;AACA,MAAII,UAAU,IAAd;AACA,MAAIC,MAAM,EAAV;;AAEA,OAAKA,GAAL,IAAYP,KAAZ,EAAmB;AACjB,QAAIA,MAAMQ,cAAN,CAAqBD,GAArB,CAAJ,EAA+B;AAC7BD,gBAAU,IAAV;AACA,UAAIH,MAAJ,EAAY;AACV,YAAIE,UAAUL,MAAMO,GAAN,MAAeN,WAA7B,EAA0C;AACxCK,oBAAU,KAAV;AACD,SAFD,MAEO,IAAIN,MAAMO,GAAN,MAAeN,WAAnB,EAAgC;AACrCK,oBAAU,KAAV;AACD;AACF;;AAED,UAAIA,OAAJ,EAAa;AACXF,eAAOA,OAAOK,MAAd,IAAwBF,GAAxB;AACD;AACF;AACF;;AAED,SAAOH,MAAP;AACD,CApCD","file":"array_keys.js","sourcesContent":["module.exports = function array_keys (input, searchValue, argStrict) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_keys/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // input by: Brett Zamir (http://brett-zamir.me)\n // input by: P\n // bugfixed by: Kevin van Zonneveld (http://kvz.io)\n // bugfixed by: Brett Zamir (http://brett-zamir.me)\n // improved by: jd\n // improved by: Brett Zamir (http://brett-zamir.me)\n // example 1: array_keys( {firstname: 'Kevin', surname: 'van Zonneveld'} )\n // returns 1: [ 'firstname', 'surname' ]\n\n var search = typeof searchValue !== 'undefined'\n var tmpArr = []\n var strict = !!argStrict\n var include = true\n var key = ''\n\n for (key in input) {\n if (input.hasOwnProperty(key)) {\n include = true\n if (search) {\n if (strict && input[key] !== searchValue) {\n include = false\n } else if (input[key] !== searchValue) {\n include = false\n }\n }\n\n if (include) {\n tmpArr[tmpArr.length] = key\n }\n }\n }\n\n return tmpArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_map.js b/node_modules/locutus/php/array/array_map.js new file mode 100644 index 0000000..6e5d7c3 --- /dev/null +++ b/node_modules/locutus/php/array/array_map.js @@ -0,0 +1,58 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +module.exports = function array_map(callback) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_map/ + // original by: Andrea Giammarchi (http://webreflection.blogspot.com) + // improved by: Kevin van Zonneveld (http://kvz.io) + // improved by: Brett Zamir (http://brett-zamir.me) + // input by: thekid + // note 1: If the callback is a string (or object, if an array is supplied), + // note 1: it can only work if the function name is in the global context + // example 1: array_map( function (a){return (a * a * a)}, [1, 2, 3, 4, 5] ) + // returns 1: [ 1, 8, 27, 64, 125 ] + + var argc = arguments.length; + var argv = arguments; + var obj = null; + var cb = callback; + var j = argv[1].length; + var i = 0; + var k = 1; + var m = 0; + var tmp = []; + var tmpArr = []; + + var $global = typeof window !== 'undefined' ? window : global; + + while (i < j) { + while (k < argc) { + tmp[m++] = argv[k++][i]; + } + + m = 0; + k = 1; + + if (callback) { + if (typeof callback === 'string') { + cb = $global[callback]; + } else if ((typeof callback === 'undefined' ? 'undefined' : _typeof(callback)) === 'object' && callback.length) { + obj = typeof callback[0] === 'string' ? $global[callback[0]] : callback[0]; + if (typeof obj === 'undefined') { + throw new Error('Object not found: ' + callback[0]); + } + cb = typeof callback[1] === 'string' ? obj[callback[1]] : callback[1]; + } + tmpArr[i++] = cb.apply(obj, tmp); + } else { + tmpArr[i++] = tmp; + } + + tmp = []; + } + + return tmpArr; +}; +//# sourceMappingURL=array_map.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_map.js.map b/node_modules/locutus/php/array/array_map.js.map new file mode 100644 index 0000000..df02f02 --- /dev/null +++ b/node_modules/locutus/php/array/array_map.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_map.js"],"names":["module","exports","array_map","callback","argc","arguments","length","argv","obj","cb","j","i","k","m","tmp","tmpArr","$global","window","global","Error","apply"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,SAAT,CAAoBC,QAApB,EAA8B;AAAE;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,OAAOC,UAAUC,MAArB;AACA,MAAIC,OAAOF,SAAX;AACA,MAAIG,MAAM,IAAV;AACA,MAAIC,KAAKN,QAAT;AACA,MAAIO,IAAIH,KAAK,CAAL,EAAQD,MAAhB;AACA,MAAIK,IAAI,CAAR;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,MAAM,EAAV;AACA,MAAIC,SAAS,EAAb;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;;AAEA,SAAOP,IAAID,CAAX,EAAc;AACZ,WAAOE,IAAIR,IAAX,EAAiB;AACfU,UAAID,GAAJ,IAAWN,KAAKK,GAAL,EAAUD,CAAV,CAAX;AACD;;AAEDE,QAAI,CAAJ;AACAD,QAAI,CAAJ;;AAEA,QAAIT,QAAJ,EAAc;AACZ,UAAI,OAAOA,QAAP,KAAoB,QAAxB,EAAkC;AAChCM,aAAKO,QAAQb,QAAR,CAAL;AACD,OAFD,MAEO,IAAI,QAAOA,QAAP,yCAAOA,QAAP,OAAoB,QAApB,IAAgCA,SAASG,MAA7C,EAAqD;AAC1DE,cAAM,OAAOL,SAAS,CAAT,CAAP,KAAuB,QAAvB,GAAkCa,QAAQb,SAAS,CAAT,CAAR,CAAlC,GAAyDA,SAAS,CAAT,CAA/D;AACA,YAAI,OAAOK,GAAP,KAAe,WAAnB,EAAgC;AAC9B,gBAAM,IAAIW,KAAJ,CAAU,uBAAuBhB,SAAS,CAAT,CAAjC,CAAN;AACD;AACDM,aAAK,OAAON,SAAS,CAAT,CAAP,KAAuB,QAAvB,GAAkCK,IAAIL,SAAS,CAAT,CAAJ,CAAlC,GAAqDA,SAAS,CAAT,CAA1D;AACD;AACDY,aAAOJ,GAAP,IAAcF,GAAGW,KAAH,CAASZ,GAAT,EAAcM,GAAd,CAAd;AACD,KAXD,MAWO;AACLC,aAAOJ,GAAP,IAAcG,GAAd;AACD;;AAEDA,UAAM,EAAN;AACD;;AAED,SAAOC,MAAP;AACD,CAnDD","file":"array_map.js","sourcesContent":["module.exports = function array_map (callback) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_map/\n // original by: Andrea Giammarchi (http://webreflection.blogspot.com)\n // improved by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // input by: thekid\n // note 1: If the callback is a string (or object, if an array is supplied),\n // note 1: it can only work if the function name is in the global context\n // example 1: array_map( function (a){return (a * a * a)}, [1, 2, 3, 4, 5] )\n // returns 1: [ 1, 8, 27, 64, 125 ]\n\n var argc = arguments.length\n var argv = arguments\n var obj = null\n var cb = callback\n var j = argv[1].length\n var i = 0\n var k = 1\n var m = 0\n var tmp = []\n var tmpArr = []\n\n var $global = (typeof window !== 'undefined' ? window : global)\n\n while (i < j) {\n while (k < argc) {\n tmp[m++] = argv[k++][i]\n }\n\n m = 0\n k = 1\n\n if (callback) {\n if (typeof callback === 'string') {\n cb = $global[callback]\n } else if (typeof callback === 'object' && callback.length) {\n obj = typeof callback[0] === 'string' ? $global[callback[0]] : callback[0]\n if (typeof obj === 'undefined') {\n throw new Error('Object not found: ' + callback[0])\n }\n cb = typeof callback[1] === 'string' ? obj[callback[1]] : callback[1]\n }\n tmpArr[i++] = cb.apply(obj, tmp)\n } else {\n tmpArr[i++] = tmp\n }\n\n tmp = []\n }\n\n return tmpArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_merge.js b/node_modules/locutus/php/array/array_merge.js new file mode 100644 index 0000000..564d536 --- /dev/null +++ b/node_modules/locutus/php/array/array_merge.js @@ -0,0 +1,67 @@ +'use strict'; + +module.exports = function array_merge() { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_merge/ + // original by: Brett Zamir (http://brett-zamir.me) + // bugfixed by: Nate + // bugfixed by: Brett Zamir (http://brett-zamir.me) + // input by: josh + // example 1: var $arr1 = {"color": "red", 0: 2, 1: 4} + // example 1: var $arr2 = {0: "a", 1: "b", "color": "green", "shape": "trapezoid", 2: 4} + // example 1: array_merge($arr1, $arr2) + // returns 1: {"color": "green", 0: 2, 1: 4, 2: "a", 3: "b", "shape": "trapezoid", 4: 4} + // example 2: var $arr1 = [] + // example 2: var $arr2 = {1: "data"} + // example 2: array_merge($arr1, $arr2) + // returns 2: {0: "data"} + + var args = Array.prototype.slice.call(arguments); + var argl = args.length; + var arg; + var retObj = {}; + var k = ''; + var argil = 0; + var j = 0; + var i = 0; + var ct = 0; + var toStr = Object.prototype.toString; + var retArr = true; + + for (i = 0; i < argl; i++) { + if (toStr.call(args[i]) !== '[object Array]') { + retArr = false; + break; + } + } + + if (retArr) { + retArr = []; + for (i = 0; i < argl; i++) { + retArr = retArr.concat(args[i]); + } + return retArr; + } + + for (i = 0, ct = 0; i < argl; i++) { + arg = args[i]; + if (toStr.call(arg) === '[object Array]') { + for (j = 0, argil = arg.length; j < argil; j++) { + retObj[ct++] = arg[j]; + } + } else { + for (k in arg) { + if (arg.hasOwnProperty(k)) { + if (parseInt(k, 10) + '' === k) { + retObj[ct++] = arg[k]; + } else { + retObj[k] = arg[k]; + } + } + } + } + } + + return retObj; +}; +//# sourceMappingURL=array_merge.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_merge.js.map b/node_modules/locutus/php/array/array_merge.js.map new file mode 100644 index 0000000..2bac08e --- /dev/null +++ b/node_modules/locutus/php/array/array_merge.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_merge.js"],"names":["module","exports","array_merge","args","Array","prototype","slice","call","arguments","argl","length","arg","retObj","k","argil","j","i","ct","toStr","Object","toString","retArr","concat","hasOwnProperty","parseInt"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,WAAT,GAAwB;AAAE;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,OAAOC,MAAMC,SAAN,CAAgBC,KAAhB,CAAsBC,IAAtB,CAA2BC,SAA3B,CAAX;AACA,MAAIC,OAAON,KAAKO,MAAhB;AACA,MAAIC,GAAJ;AACA,MAAIC,SAAS,EAAb;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,QAAQ,CAAZ;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,KAAK,CAAT;AACA,MAAIC,QAAQC,OAAOd,SAAP,CAAiBe,QAA7B;AACA,MAAIC,SAAS,IAAb;;AAEA,OAAKL,IAAI,CAAT,EAAYA,IAAIP,IAAhB,EAAsBO,GAAtB,EAA2B;AACzB,QAAIE,MAAMX,IAAN,CAAWJ,KAAKa,CAAL,CAAX,MAAwB,gBAA5B,EAA8C;AAC5CK,eAAS,KAAT;AACA;AACD;AACF;;AAED,MAAIA,MAAJ,EAAY;AACVA,aAAS,EAAT;AACA,SAAKL,IAAI,CAAT,EAAYA,IAAIP,IAAhB,EAAsBO,GAAtB,EAA2B;AACzBK,eAASA,OAAOC,MAAP,CAAcnB,KAAKa,CAAL,CAAd,CAAT;AACD;AACD,WAAOK,MAAP;AACD;;AAED,OAAKL,IAAI,CAAJ,EAAOC,KAAK,CAAjB,EAAoBD,IAAIP,IAAxB,EAA8BO,GAA9B,EAAmC;AACjCL,UAAMR,KAAKa,CAAL,CAAN;AACA,QAAIE,MAAMX,IAAN,CAAWI,GAAX,MAAoB,gBAAxB,EAA0C;AACxC,WAAKI,IAAI,CAAJ,EAAOD,QAAQH,IAAID,MAAxB,EAAgCK,IAAID,KAApC,EAA2CC,GAA3C,EAAgD;AAC9CH,eAAOK,IAAP,IAAeN,IAAII,CAAJ,CAAf;AACD;AACF,KAJD,MAIO;AACL,WAAKF,CAAL,IAAUF,GAAV,EAAe;AACb,YAAIA,IAAIY,cAAJ,CAAmBV,CAAnB,CAAJ,EAA2B;AACzB,cAAIW,SAASX,CAAT,EAAY,EAAZ,IAAkB,EAAlB,KAAyBA,CAA7B,EAAgC;AAC9BD,mBAAOK,IAAP,IAAeN,IAAIE,CAAJ,CAAf;AACD,WAFD,MAEO;AACLD,mBAAOC,CAAP,IAAYF,IAAIE,CAAJ,CAAZ;AACD;AACF;AACF;AACF;AACF;;AAED,SAAOD,MAAP;AACD,CA9DD","file":"array_merge.js","sourcesContent":["module.exports = function array_merge () { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_merge/\n // original by: Brett Zamir (http://brett-zamir.me)\n // bugfixed by: Nate\n // bugfixed by: Brett Zamir (http://brett-zamir.me)\n // input by: josh\n // example 1: var $arr1 = {\"color\": \"red\", 0: 2, 1: 4}\n // example 1: var $arr2 = {0: \"a\", 1: \"b\", \"color\": \"green\", \"shape\": \"trapezoid\", 2: 4}\n // example 1: array_merge($arr1, $arr2)\n // returns 1: {\"color\": \"green\", 0: 2, 1: 4, 2: \"a\", 3: \"b\", \"shape\": \"trapezoid\", 4: 4}\n // example 2: var $arr1 = []\n // example 2: var $arr2 = {1: \"data\"}\n // example 2: array_merge($arr1, $arr2)\n // returns 2: {0: \"data\"}\n\n var args = Array.prototype.slice.call(arguments)\n var argl = args.length\n var arg\n var retObj = {}\n var k = ''\n var argil = 0\n var j = 0\n var i = 0\n var ct = 0\n var toStr = Object.prototype.toString\n var retArr = true\n\n for (i = 0; i < argl; i++) {\n if (toStr.call(args[i]) !== '[object Array]') {\n retArr = false\n break\n }\n }\n\n if (retArr) {\n retArr = []\n for (i = 0; i < argl; i++) {\n retArr = retArr.concat(args[i])\n }\n return retArr\n }\n\n for (i = 0, ct = 0; i < argl; i++) {\n arg = args[i]\n if (toStr.call(arg) === '[object Array]') {\n for (j = 0, argil = arg.length; j < argil; j++) {\n retObj[ct++] = arg[j]\n }\n } else {\n for (k in arg) {\n if (arg.hasOwnProperty(k)) {\n if (parseInt(k, 10) + '' === k) {\n retObj[ct++] = arg[k]\n } else {\n retObj[k] = arg[k]\n }\n }\n }\n }\n }\n\n return retObj\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_merge_recursive.js b/node_modules/locutus/php/array/array_merge_recursive.js new file mode 100644 index 0000000..eba8906 --- /dev/null +++ b/node_modules/locutus/php/array/array_merge_recursive.js @@ -0,0 +1,40 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +module.exports = function array_merge_recursive(arr1, arr2) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_merge_recursive/ + // original by: Subhasis Deb + // input by: Brett Zamir (http://brett-zamir.me) + // bugfixed by: Kevin van Zonneveld (http://kvz.io) + // example 1: var $arr1 = {'color': {'favorite': 'red'}, 0: 5} + // example 1: var $arr2 = {0: 10, 'color': {'favorite': 'green', 0: 'blue'}} + // example 1: array_merge_recursive($arr1, $arr2) + // returns 1: {'color': {'favorite': {0: 'red', 1: 'green'}, 0: 'blue'}, 1: 5, 1: 10} + // test: skip-1 + + var arrayMerge = require('../array/array_merge'); + var idx = ''; + + if (arr1 && Object.prototype.toString.call(arr1) === '[object Array]' && arr2 && Object.prototype.toString.call(arr2) === '[object Array]') { + for (idx in arr2) { + arr1.push(arr2[idx]); + } + } else if (arr1 && arr1 instanceof Object && arr2 && arr2 instanceof Object) { + for (idx in arr2) { + if (idx in arr1) { + if (_typeof(arr1[idx]) === 'object' && (typeof arr2 === 'undefined' ? 'undefined' : _typeof(arr2)) === 'object') { + arr1[idx] = arrayMerge(arr1[idx], arr2[idx]); + } else { + arr1[idx] = arr2[idx]; + } + } else { + arr1[idx] = arr2[idx]; + } + } + } + + return arr1; +}; +//# sourceMappingURL=array_merge_recursive.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_merge_recursive.js.map b/node_modules/locutus/php/array/array_merge_recursive.js.map new file mode 100644 index 0000000..e647b8d --- /dev/null +++ b/node_modules/locutus/php/array/array_merge_recursive.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_merge_recursive.js"],"names":["module","exports","array_merge_recursive","arr1","arr2","arrayMerge","require","idx","Object","prototype","toString","call","push"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,qBAAT,CAAgCC,IAAhC,EAAsCC,IAAtC,EAA4C;AAAE;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,aAAaC,QAAQ,sBAAR,CAAjB;AACA,MAAIC,MAAM,EAAV;;AAEA,MAAIJ,QAAQK,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BR,IAA/B,MAAyC,gBAAjD,IACFC,IADE,IACMI,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BP,IAA/B,MAAyC,gBADnD,EACqE;AACnE,SAAKG,GAAL,IAAYH,IAAZ,EAAkB;AAChBD,WAAKS,IAAL,CAAUR,KAAKG,GAAL,CAAV;AACD;AACF,GALD,MAKO,IAAKJ,QAASA,gBAAgBK,MAA1B,IAAuCJ,QAASA,gBAAgBI,MAApE,EAA8E;AACnF,SAAKD,GAAL,IAAYH,IAAZ,EAAkB;AAChB,UAAIG,OAAOJ,IAAX,EAAiB;AACf,YAAI,QAAOA,KAAKI,GAAL,CAAP,MAAqB,QAArB,IAAiC,QAAOH,IAAP,yCAAOA,IAAP,OAAgB,QAArD,EAA+D;AAC7DD,eAAKI,GAAL,IAAYF,WAAWF,KAAKI,GAAL,CAAX,EAAsBH,KAAKG,GAAL,CAAtB,CAAZ;AACD,SAFD,MAEO;AACLJ,eAAKI,GAAL,IAAYH,KAAKG,GAAL,CAAZ;AACD;AACF,OAND,MAMO;AACLJ,aAAKI,GAAL,IAAYH,KAAKG,GAAL,CAAZ;AACD;AACF;AACF;;AAED,SAAOJ,IAAP;AACD,CAlCD","file":"array_merge_recursive.js","sourcesContent":["module.exports = function array_merge_recursive (arr1, arr2) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_merge_recursive/\n // original by: Subhasis Deb\n // input by: Brett Zamir (http://brett-zamir.me)\n // bugfixed by: Kevin van Zonneveld (http://kvz.io)\n // example 1: var $arr1 = {'color': {'favorite': 'red'}, 0: 5}\n // example 1: var $arr2 = {0: 10, 'color': {'favorite': 'green', 0: 'blue'}}\n // example 1: array_merge_recursive($arr1, $arr2)\n // returns 1: {'color': {'favorite': {0: 'red', 1: 'green'}, 0: 'blue'}, 1: 5, 1: 10}\n // test: skip-1\n\n var arrayMerge = require('../array/array_merge')\n var idx = ''\n\n if (arr1 && Object.prototype.toString.call(arr1) === '[object Array]' &&\n arr2 && Object.prototype.toString.call(arr2) === '[object Array]') {\n for (idx in arr2) {\n arr1.push(arr2[idx])\n }\n } else if ((arr1 && (arr1 instanceof Object)) && (arr2 && (arr2 instanceof Object))) {\n for (idx in arr2) {\n if (idx in arr1) {\n if (typeof arr1[idx] === 'object' && typeof arr2 === 'object') {\n arr1[idx] = arrayMerge(arr1[idx], arr2[idx])\n } else {\n arr1[idx] = arr2[idx]\n }\n } else {\n arr1[idx] = arr2[idx]\n }\n }\n }\n\n return arr1\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_multisort.js b/node_modules/locutus/php/array/array_multisort.js new file mode 100644 index 0000000..903afd3 --- /dev/null +++ b/node_modules/locutus/php/array/array_multisort.js @@ -0,0 +1,288 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +module.exports = function array_multisort(arr) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_multisort/ + // original by: Theriault (https://github.com/Theriault) + // improved by: Oleg Andreyev (https://github.com/oleg-andreyev) + // example 1: array_multisort([1, 2, 1, 2, 1, 2], [1, 2, 3, 4, 5, 6]) + // returns 1: true + // example 2: var $characters = {A: 'Edward', B: 'Locke', C: 'Sabin', D: 'Terra', E: 'Edward'} + // example 2: var $jobs = {A: 'Warrior', B: 'Thief', C: 'Monk', D: 'Mage', E: 'Knight'} + // example 2: array_multisort($characters, 'SORT_DESC', 'SORT_STRING', $jobs, 'SORT_ASC', 'SORT_STRING') + // returns 2: true + // example 3: var $lastnames = [ 'Carter','Adams','Monroe','Tyler','Madison','Kennedy','Adams'] + // example 3: var $firstnames = ['James', 'John' ,'James', 'John', 'James', 'John', 'John'] + // example 3: var $president = [ 39, 6, 5, 10, 4, 35, 2 ] + // example 3: array_multisort($firstnames, 'SORT_DESC', 'SORT_STRING', $lastnames, 'SORT_ASC', 'SORT_STRING', $president, 'SORT_NUMERIC') + // returns 3: true + // note 1: flags: Translation table for sort arguments. + // note 1: Each argument turns on certain bits in the flag byte through addition. + // note 1: bits: HGFE DCBA + // note 1: args: Holds pointer to arguments for reassignment + + var g; + var i; + var j; + var k; + var l; + var sal; + var vkey; + var elIndex; + var lastSorts; + var tmpArray; + var zlast; + + var sortFlag = [0]; + var thingsToSort = []; + var nLastSort = []; + var lastSort = []; + // possibly redundant + var args = arguments; + + var flags = { + 'SORT_REGULAR': 16, + 'SORT_NUMERIC': 17, + 'SORT_STRING': 18, + 'SORT_ASC': 32, + 'SORT_DESC': 40 + }; + + var sortDuplicator = function sortDuplicator(a, b) { + return nLastSort.shift(); + }; + + var sortFunctions = [[function (a, b) { + lastSort.push(a > b ? 1 : a < b ? -1 : 0); + return a > b ? 1 : a < b ? -1 : 0; + }, function (a, b) { + lastSort.push(b > a ? 1 : b < a ? -1 : 0); + return b > a ? 1 : b < a ? -1 : 0; + }], [function (a, b) { + lastSort.push(a - b); + return a - b; + }, function (a, b) { + lastSort.push(b - a); + return b - a; + }], [function (a, b) { + lastSort.push(a + '' > b + '' ? 1 : a + '' < b + '' ? -1 : 0); + return a + '' > b + '' ? 1 : a + '' < b + '' ? -1 : 0; + }, function (a, b) { + lastSort.push(b + '' > a + '' ? 1 : b + '' < a + '' ? -1 : 0); + return b + '' > a + '' ? 1 : b + '' < a + '' ? -1 : 0; + }]]; + + var sortArrs = [[]]; + + var sortKeys = [[]]; + + // Store first argument into sortArrs and sortKeys if an Object. + // First Argument should be either a Javascript Array or an Object, + // otherwise function would return FALSE like in PHP + if (Object.prototype.toString.call(arr) === '[object Array]') { + sortArrs[0] = arr; + } else if (arr && (typeof arr === 'undefined' ? 'undefined' : _typeof(arr)) === 'object') { + for (i in arr) { + if (arr.hasOwnProperty(i)) { + sortKeys[0].push(i); + sortArrs[0].push(arr[i]); + } + } + } else { + return false; + } + + // arrMainLength: Holds the length of the first array. + // All other arrays must be of equal length, otherwise function would return FALSE like in PHP + // sortComponents: Holds 2 indexes per every section of the array + // that can be sorted. As this is the start, the whole array can be sorted. + var arrMainLength = sortArrs[0].length; + var sortComponents = [0, arrMainLength]; + + // Loop through all other arguments, checking lengths and sort flags + // of arrays and adding them to the above variables. + var argl = arguments.length; + for (j = 1; j < argl; j++) { + if (Object.prototype.toString.call(arguments[j]) === '[object Array]') { + sortArrs[j] = arguments[j]; + sortFlag[j] = 0; + if (arguments[j].length !== arrMainLength) { + return false; + } + } else if (arguments[j] && _typeof(arguments[j]) === 'object') { + sortKeys[j] = []; + sortArrs[j] = []; + sortFlag[j] = 0; + for (i in arguments[j]) { + if (arguments[j].hasOwnProperty(i)) { + sortKeys[j].push(i); + sortArrs[j].push(arguments[j][i]); + } + } + if (sortArrs[j].length !== arrMainLength) { + return false; + } + } else if (typeof arguments[j] === 'string') { + var lFlag = sortFlag.pop(); + // Keep extra parentheses around latter flags check + // to avoid minimization leading to CDATA closer + if (typeof flags[arguments[j]] === 'undefined' || (flags[arguments[j]] >>> 4 & lFlag >>> 4) > 0) { + return false; + } + sortFlag.push(lFlag + flags[arguments[j]]); + } else { + return false; + } + } + + for (i = 0; i !== arrMainLength; i++) { + thingsToSort.push(true); + } + + // Sort all the arrays.... + for (i in sortArrs) { + if (sortArrs.hasOwnProperty(i)) { + lastSorts = []; + tmpArray = []; + elIndex = 0; + nLastSort = []; + lastSort = []; + + // If there are no sortComponents, then no more sorting is neeeded. + // Copy the array back to the argument. + if (sortComponents.length === 0) { + if (Object.prototype.toString.call(arguments[i]) === '[object Array]') { + args[i] = sortArrs[i]; + } else { + for (k in arguments[i]) { + if (arguments[i].hasOwnProperty(k)) { + delete arguments[i][k]; + } + } + sal = sortArrs[i].length; + for (j = 0, vkey = 0; j < sal; j++) { + vkey = sortKeys[i][j]; + args[i][vkey] = sortArrs[i][j]; + } + } + sortArrs.splice(i, 1); + sortKeys.splice(i, 1); + continue; + } + + // Sort function for sorting. Either sorts asc or desc, regular/string or numeric. + var sFunction = sortFunctions[sortFlag[i] & 3][(sortFlag[i] & 8) > 0 ? 1 : 0]; + + // Sort current array. + for (l = 0; l !== sortComponents.length; l += 2) { + tmpArray = sortArrs[i].slice(sortComponents[l], sortComponents[l + 1] + 1); + tmpArray.sort(sFunction); + // Is there a better way to copy an array in Javascript? + lastSorts[l] = [].concat(lastSort); + elIndex = sortComponents[l]; + for (g in tmpArray) { + if (tmpArray.hasOwnProperty(g)) { + sortArrs[i][elIndex] = tmpArray[g]; + elIndex++; + } + } + } + + // Duplicate the sorting of the current array on future arrays. + sFunction = sortDuplicator; + for (j in sortArrs) { + if (sortArrs.hasOwnProperty(j)) { + if (sortArrs[j] === sortArrs[i]) { + continue; + } + for (l = 0; l !== sortComponents.length; l += 2) { + tmpArray = sortArrs[j].slice(sortComponents[l], sortComponents[l + 1] + 1); + // alert(l + ':' + nLastSort); + nLastSort = [].concat(lastSorts[l]); + tmpArray.sort(sFunction); + elIndex = sortComponents[l]; + for (g in tmpArray) { + if (tmpArray.hasOwnProperty(g)) { + sortArrs[j][elIndex] = tmpArray[g]; + elIndex++; + } + } + } + } + } + + // Duplicate the sorting of the current array on array keys + for (j in sortKeys) { + if (sortKeys.hasOwnProperty(j)) { + for (l = 0; l !== sortComponents.length; l += 2) { + tmpArray = sortKeys[j].slice(sortComponents[l], sortComponents[l + 1] + 1); + nLastSort = [].concat(lastSorts[l]); + tmpArray.sort(sFunction); + elIndex = sortComponents[l]; + for (g in tmpArray) { + if (tmpArray.hasOwnProperty(g)) { + sortKeys[j][elIndex] = tmpArray[g]; + elIndex++; + } + } + } + } + } + + // Generate the next sortComponents + zlast = null; + sortComponents = []; + for (j in sortArrs[i]) { + if (sortArrs[i].hasOwnProperty(j)) { + if (!thingsToSort[j]) { + if (sortComponents.length & 1) { + sortComponents.push(j - 1); + } + zlast = null; + continue; + } + if (!(sortComponents.length & 1)) { + if (zlast !== null) { + if (sortArrs[i][j] === zlast) { + sortComponents.push(j - 1); + } else { + thingsToSort[j] = false; + } + } + zlast = sortArrs[i][j]; + } else { + if (sortArrs[i][j] !== zlast) { + sortComponents.push(j - 1); + zlast = sortArrs[i][j]; + } + } + } + } + + if (sortComponents.length & 1) { + sortComponents.push(j); + } + if (Object.prototype.toString.call(arguments[i]) === '[object Array]') { + args[i] = sortArrs[i]; + } else { + for (j in arguments[i]) { + if (arguments[i].hasOwnProperty(j)) { + delete arguments[i][j]; + } + } + + sal = sortArrs[i].length; + for (j = 0, vkey = 0; j < sal; j++) { + vkey = sortKeys[i][j]; + args[i][vkey] = sortArrs[i][j]; + } + } + sortArrs.splice(i, 1); + sortKeys.splice(i, 1); + } + } + return true; +}; +//# sourceMappingURL=array_multisort.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_multisort.js.map b/node_modules/locutus/php/array/array_multisort.js.map new file mode 100644 index 0000000..b6f72b2 --- /dev/null +++ b/node_modules/locutus/php/array/array_multisort.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_multisort.js"],"names":["module","exports","array_multisort","arr","g","i","j","k","l","sal","vkey","elIndex","lastSorts","tmpArray","zlast","sortFlag","thingsToSort","nLastSort","lastSort","args","arguments","flags","sortDuplicator","a","b","shift","sortFunctions","push","sortArrs","sortKeys","Object","prototype","toString","call","hasOwnProperty","arrMainLength","length","sortComponents","argl","lFlag","pop","splice","sFunction","slice","sort","concat"],"mappings":"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","file":"array_multisort.js","sourcesContent":["module.exports = function array_multisort (arr) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_multisort/\n // original by: Theriault (https://github.com/Theriault)\n // improved by: Oleg Andreyev (https://github.com/oleg-andreyev)\n // example 1: array_multisort([1, 2, 1, 2, 1, 2], [1, 2, 3, 4, 5, 6])\n // returns 1: true\n // example 2: var $characters = {A: 'Edward', B: 'Locke', C: 'Sabin', D: 'Terra', E: 'Edward'}\n // example 2: var $jobs = {A: 'Warrior', B: 'Thief', C: 'Monk', D: 'Mage', E: 'Knight'}\n // example 2: array_multisort($characters, 'SORT_DESC', 'SORT_STRING', $jobs, 'SORT_ASC', 'SORT_STRING')\n // returns 2: true\n // example 3: var $lastnames = [ 'Carter','Adams','Monroe','Tyler','Madison','Kennedy','Adams']\n // example 3: var $firstnames = ['James', 'John' ,'James', 'John', 'James', 'John', 'John']\n // example 3: var $president = [ 39, 6, 5, 10, 4, 35, 2 ]\n // example 3: array_multisort($firstnames, 'SORT_DESC', 'SORT_STRING', $lastnames, 'SORT_ASC', 'SORT_STRING', $president, 'SORT_NUMERIC')\n // returns 3: true\n // note 1: flags: Translation table for sort arguments.\n // note 1: Each argument turns on certain bits in the flag byte through addition.\n // note 1: bits: HGFE DCBA\n // note 1: args: Holds pointer to arguments for reassignment\n\n var g\n var i\n var j\n var k\n var l\n var sal\n var vkey\n var elIndex\n var lastSorts\n var tmpArray\n var zlast\n\n var sortFlag = [0]\n var thingsToSort = []\n var nLastSort = []\n var lastSort = []\n // possibly redundant\n var args = arguments\n\n var flags = {\n 'SORT_REGULAR': 16,\n 'SORT_NUMERIC': 17,\n 'SORT_STRING': 18,\n 'SORT_ASC': 32,\n 'SORT_DESC': 40\n }\n\n var sortDuplicator = function (a, b) {\n return nLastSort.shift()\n }\n\n var sortFunctions = [\n [\n\n function (a, b) {\n lastSort.push(a > b ? 1 : (a < b ? -1 : 0))\n return a > b ? 1 : (a < b ? -1 : 0)\n },\n function (a, b) {\n lastSort.push(b > a ? 1 : (b < a ? -1 : 0))\n return b > a ? 1 : (b < a ? -1 : 0)\n }\n ],\n [\n\n function (a, b) {\n lastSort.push(a - b)\n return a - b\n },\n function (a, b) {\n lastSort.push(b - a)\n return b - a\n }\n ],\n [\n\n function (a, b) {\n lastSort.push((a + '') > (b + '') ? 1 : ((a + '') < (b + '') ? -1 : 0))\n return (a + '') > (b + '') ? 1 : ((a + '') < (b + '') ? -1 : 0)\n },\n function (a, b) {\n lastSort.push((b + '') > (a + '') ? 1 : ((b + '') < (a + '') ? -1 : 0))\n return (b + '') > (a + '') ? 1 : ((b + '') < (a + '') ? -1 : 0)\n }\n ]\n ]\n\n var sortArrs = [\n []\n ]\n\n var sortKeys = [\n []\n ]\n\n // Store first argument into sortArrs and sortKeys if an Object.\n // First Argument should be either a Javascript Array or an Object,\n // otherwise function would return FALSE like in PHP\n if (Object.prototype.toString.call(arr) === '[object Array]') {\n sortArrs[0] = arr\n } else if (arr && typeof arr === 'object') {\n for (i in arr) {\n if (arr.hasOwnProperty(i)) {\n sortKeys[0].push(i)\n sortArrs[0].push(arr[i])\n }\n }\n } else {\n return false\n }\n\n // arrMainLength: Holds the length of the first array.\n // All other arrays must be of equal length, otherwise function would return FALSE like in PHP\n // sortComponents: Holds 2 indexes per every section of the array\n // that can be sorted. As this is the start, the whole array can be sorted.\n var arrMainLength = sortArrs[0].length\n var sortComponents = [0, arrMainLength]\n\n // Loop through all other arguments, checking lengths and sort flags\n // of arrays and adding them to the above variables.\n var argl = arguments.length\n for (j = 1; j < argl; j++) {\n if (Object.prototype.toString.call(arguments[j]) === '[object Array]') {\n sortArrs[j] = arguments[j]\n sortFlag[j] = 0\n if (arguments[j].length !== arrMainLength) {\n return false\n }\n } else if (arguments[j] && typeof arguments[j] === 'object') {\n sortKeys[j] = []\n sortArrs[j] = []\n sortFlag[j] = 0\n for (i in arguments[j]) {\n if (arguments[j].hasOwnProperty(i)) {\n sortKeys[j].push(i)\n sortArrs[j].push(arguments[j][i])\n }\n }\n if (sortArrs[j].length !== arrMainLength) {\n return false\n }\n } else if (typeof arguments[j] === 'string') {\n var lFlag = sortFlag.pop()\n // Keep extra parentheses around latter flags check\n // to avoid minimization leading to CDATA closer\n if (typeof flags[arguments[j]] === 'undefined' ||\n ((((flags[arguments[j]]) >>> 4) & (lFlag >>> 4)) > 0)) {\n return false\n }\n sortFlag.push(lFlag + flags[arguments[j]])\n } else {\n return false\n }\n }\n\n for (i = 0; i !== arrMainLength; i++) {\n thingsToSort.push(true)\n }\n\n // Sort all the arrays....\n for (i in sortArrs) {\n if (sortArrs.hasOwnProperty(i)) {\n lastSorts = []\n tmpArray = []\n elIndex = 0\n nLastSort = []\n lastSort = []\n\n // If there are no sortComponents, then no more sorting is neeeded.\n // Copy the array back to the argument.\n if (sortComponents.length === 0) {\n if (Object.prototype.toString.call(arguments[i]) === '[object Array]') {\n args[i] = sortArrs[i]\n } else {\n for (k in arguments[i]) {\n if (arguments[i].hasOwnProperty(k)) {\n delete arguments[i][k]\n }\n }\n sal = sortArrs[i].length\n for (j = 0, vkey = 0; j < sal; j++) {\n vkey = sortKeys[i][j]\n args[i][vkey] = sortArrs[i][j]\n }\n }\n sortArrs.splice(i, 1)\n sortKeys.splice(i, 1)\n continue\n }\n\n // Sort function for sorting. Either sorts asc or desc, regular/string or numeric.\n var sFunction = sortFunctions[(sortFlag[i] & 3)][((sortFlag[i] & 8) > 0) ? 1 : 0]\n\n // Sort current array.\n for (l = 0; l !== sortComponents.length; l += 2) {\n tmpArray = sortArrs[i].slice(sortComponents[l], sortComponents[l + 1] + 1)\n tmpArray.sort(sFunction)\n // Is there a better way to copy an array in Javascript?\n lastSorts[l] = [].concat(lastSort)\n elIndex = sortComponents[l]\n for (g in tmpArray) {\n if (tmpArray.hasOwnProperty(g)) {\n sortArrs[i][elIndex] = tmpArray[g]\n elIndex++\n }\n }\n }\n\n // Duplicate the sorting of the current array on future arrays.\n sFunction = sortDuplicator\n for (j in sortArrs) {\n if (sortArrs.hasOwnProperty(j)) {\n if (sortArrs[j] === sortArrs[i]) {\n continue\n }\n for (l = 0; l !== sortComponents.length; l += 2) {\n tmpArray = sortArrs[j].slice(sortComponents[l], sortComponents[l + 1] + 1)\n // alert(l + ':' + nLastSort);\n nLastSort = [].concat(lastSorts[l])\n tmpArray.sort(sFunction)\n elIndex = sortComponents[l]\n for (g in tmpArray) {\n if (tmpArray.hasOwnProperty(g)) {\n sortArrs[j][elIndex] = tmpArray[g]\n elIndex++\n }\n }\n }\n }\n }\n\n // Duplicate the sorting of the current array on array keys\n for (j in sortKeys) {\n if (sortKeys.hasOwnProperty(j)) {\n for (l = 0; l !== sortComponents.length; l += 2) {\n tmpArray = sortKeys[j].slice(sortComponents[l], sortComponents[l + 1] + 1)\n nLastSort = [].concat(lastSorts[l])\n tmpArray.sort(sFunction)\n elIndex = sortComponents[l]\n for (g in tmpArray) {\n if (tmpArray.hasOwnProperty(g)) {\n sortKeys[j][elIndex] = tmpArray[g]\n elIndex++\n }\n }\n }\n }\n }\n\n // Generate the next sortComponents\n zlast = null\n sortComponents = []\n for (j in sortArrs[i]) {\n if (sortArrs[i].hasOwnProperty(j)) {\n if (!thingsToSort[j]) {\n if ((sortComponents.length & 1)) {\n sortComponents.push(j - 1)\n }\n zlast = null\n continue\n }\n if (!(sortComponents.length & 1)) {\n if (zlast !== null) {\n if (sortArrs[i][j] === zlast) {\n sortComponents.push(j - 1)\n } else {\n thingsToSort[j] = false\n }\n }\n zlast = sortArrs[i][j]\n } else {\n if (sortArrs[i][j] !== zlast) {\n sortComponents.push(j - 1)\n zlast = sortArrs[i][j]\n }\n }\n }\n }\n\n if (sortComponents.length & 1) {\n sortComponents.push(j)\n }\n if (Object.prototype.toString.call(arguments[i]) === '[object Array]') {\n args[i] = sortArrs[i]\n } else {\n for (j in arguments[i]) {\n if (arguments[i].hasOwnProperty(j)) {\n delete arguments[i][j]\n }\n }\n\n sal = sortArrs[i].length\n for (j = 0, vkey = 0; j < sal; j++) {\n vkey = sortKeys[i][j]\n args[i][vkey] = sortArrs[i][j]\n }\n }\n sortArrs.splice(i, 1)\n sortKeys.splice(i, 1)\n }\n }\n return true\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_pad.js b/node_modules/locutus/php/array/array_pad.js new file mode 100644 index 0000000..3d3452e --- /dev/null +++ b/node_modules/locutus/php/array/array_pad.js @@ -0,0 +1,38 @@ +'use strict'; + +module.exports = function array_pad(input, padSize, padValue) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_pad/ + // original by: Waldo Malqui Silva (http://waldo.malqui.info) + // example 1: array_pad([ 7, 8, 9 ], 2, 'a') + // returns 1: [ 7, 8, 9] + // example 2: array_pad([ 7, 8, 9 ], 5, 'a') + // returns 2: [ 7, 8, 9, 'a', 'a'] + // example 3: array_pad([ 7, 8, 9 ], 5, 2) + // returns 3: [ 7, 8, 9, 2, 2] + // example 4: array_pad([ 7, 8, 9 ], -5, 'a') + // returns 4: [ 'a', 'a', 7, 8, 9 ] + + var pad = []; + var newArray = []; + var newLength; + var diff = 0; + var i = 0; + + if (Object.prototype.toString.call(input) === '[object Array]' && !isNaN(padSize)) { + newLength = padSize < 0 ? padSize * -1 : padSize; + diff = newLength - input.length; + + if (diff > 0) { + for (i = 0; i < diff; i++) { + newArray[i] = padValue; + } + pad = padSize < 0 ? newArray.concat(input) : input.concat(newArray); + } else { + pad = input; + } + } + + return pad; +}; +//# sourceMappingURL=array_pad.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_pad.js.map b/node_modules/locutus/php/array/array_pad.js.map new file mode 100644 index 0000000..25894c2 --- /dev/null +++ b/node_modules/locutus/php/array/array_pad.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_pad.js"],"names":["module","exports","array_pad","input","padSize","padValue","pad","newArray","newLength","diff","i","Object","prototype","toString","call","isNaN","length","concat"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,SAAT,CAAoBC,KAApB,EAA2BC,OAA3B,EAAoCC,QAApC,EAA8C;AAAE;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,MAAM,EAAV;AACA,MAAIC,WAAW,EAAf;AACA,MAAIC,SAAJ;AACA,MAAIC,OAAO,CAAX;AACA,MAAIC,IAAI,CAAR;;AAEA,MAAIC,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BX,KAA/B,MAA0C,gBAA1C,IAA8D,CAACY,MAAMX,OAAN,CAAnE,EAAmF;AACjFI,gBAAcJ,UAAU,CAAX,GAAiBA,UAAU,CAAC,CAA5B,GAAiCA,OAA9C;AACAK,WAAOD,YAAYL,MAAMa,MAAzB;;AAEA,QAAIP,OAAO,CAAX,EAAc;AACZ,WAAKC,IAAI,CAAT,EAAYA,IAAID,IAAhB,EAAsBC,GAAtB,EAA2B;AACzBH,iBAASG,CAAT,IAAcL,QAAd;AACD;AACDC,YAAQF,UAAU,CAAX,GAAgBG,SAASU,MAAT,CAAgBd,KAAhB,CAAhB,GAAyCA,MAAMc,MAAN,CAAaV,QAAb,CAAhD;AACD,KALD,MAKO;AACLD,YAAMH,KAAN;AACD;AACF;;AAED,SAAOG,GAAP;AACD,CAjCD","file":"array_pad.js","sourcesContent":["module.exports = function array_pad (input, padSize, padValue) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_pad/\n // original by: Waldo Malqui Silva (http://waldo.malqui.info)\n // example 1: array_pad([ 7, 8, 9 ], 2, 'a')\n // returns 1: [ 7, 8, 9]\n // example 2: array_pad([ 7, 8, 9 ], 5, 'a')\n // returns 2: [ 7, 8, 9, 'a', 'a']\n // example 3: array_pad([ 7, 8, 9 ], 5, 2)\n // returns 3: [ 7, 8, 9, 2, 2]\n // example 4: array_pad([ 7, 8, 9 ], -5, 'a')\n // returns 4: [ 'a', 'a', 7, 8, 9 ]\n\n var pad = []\n var newArray = []\n var newLength\n var diff = 0\n var i = 0\n\n if (Object.prototype.toString.call(input) === '[object Array]' && !isNaN(padSize)) {\n newLength = ((padSize < 0) ? (padSize * -1) : padSize)\n diff = newLength - input.length\n\n if (diff > 0) {\n for (i = 0; i < diff; i++) {\n newArray[i] = padValue\n }\n pad = ((padSize < 0) ? newArray.concat(input) : input.concat(newArray))\n } else {\n pad = input\n }\n }\n\n return pad\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_pop.js b/node_modules/locutus/php/array/array_pop.js new file mode 100644 index 0000000..08e857c --- /dev/null +++ b/node_modules/locutus/php/array/array_pop.js @@ -0,0 +1,51 @@ +'use strict'; + +module.exports = function array_pop(inputArr) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_pop/ + // original by: Kevin van Zonneveld (http://kvz.io) + // improved by: Kevin van Zonneveld (http://kvz.io) + // input by: Brett Zamir (http://brett-zamir.me) + // input by: Theriault (https://github.com/Theriault) + // bugfixed by: Kevin van Zonneveld (http://kvz.io) + // bugfixed by: Brett Zamir (http://brett-zamir.me) + // note 1: While IE (and other browsers) support iterating an object's + // note 1: own properties in order, if one attempts to add back properties + // note 1: in IE, they may end up in their former position due to their position + // note 1: being retained. So use of this function with "associative arrays" + // note 1: (objects) may lead to unexpected behavior in an IE environment if + // note 1: you add back properties with the same keys that you removed + // example 1: array_pop([0,1,2]) + // returns 1: 2 + // example 2: var $data = {firstName: 'Kevin', surName: 'van Zonneveld'} + // example 2: var $lastElem = array_pop($data) + // example 2: var $result = $data + // returns 2: {firstName: 'Kevin'} + + var key = ''; + var lastKey = ''; + + if (inputArr.hasOwnProperty('length')) { + // Indexed + if (!inputArr.length) { + // Done popping, are we? + return null; + } + return inputArr.pop(); + } else { + // Associative + for (key in inputArr) { + if (inputArr.hasOwnProperty(key)) { + lastKey = key; + } + } + if (lastKey) { + var tmp = inputArr[lastKey]; + delete inputArr[lastKey]; + return tmp; + } else { + return null; + } + } +}; +//# sourceMappingURL=array_pop.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_pop.js.map b/node_modules/locutus/php/array/array_pop.js.map new file mode 100644 index 0000000..81bb95a --- /dev/null +++ b/node_modules/locutus/php/array/array_pop.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_pop.js"],"names":["module","exports","array_pop","inputArr","key","lastKey","hasOwnProperty","length","pop","tmp"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,SAAT,CAAoBC,QAApB,EAA8B;AAAE;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,MAAM,EAAV;AACA,MAAIC,UAAU,EAAd;;AAEA,MAAIF,SAASG,cAAT,CAAwB,QAAxB,CAAJ,EAAuC;AACrC;AACA,QAAI,CAACH,SAASI,MAAd,EAAsB;AACpB;AACA,aAAO,IAAP;AACD;AACD,WAAOJ,SAASK,GAAT,EAAP;AACD,GAPD,MAOO;AACL;AACA,SAAKJ,GAAL,IAAYD,QAAZ,EAAsB;AACpB,UAAIA,SAASG,cAAT,CAAwBF,GAAxB,CAAJ,EAAkC;AAChCC,kBAAUD,GAAV;AACD;AACF;AACD,QAAIC,OAAJ,EAAa;AACX,UAAII,MAAMN,SAASE,OAAT,CAAV;AACA,aAAQF,SAASE,OAAT,CAAR;AACA,aAAOI,GAAP;AACD,KAJD,MAIO;AACL,aAAO,IAAP;AACD;AACF;AACF,CA9CD","file":"array_pop.js","sourcesContent":["module.exports = function array_pop (inputArr) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_pop/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Kevin van Zonneveld (http://kvz.io)\n // input by: Brett Zamir (http://brett-zamir.me)\n // input by: Theriault (https://github.com/Theriault)\n // bugfixed by: Kevin van Zonneveld (http://kvz.io)\n // bugfixed by: Brett Zamir (http://brett-zamir.me)\n // note 1: While IE (and other browsers) support iterating an object's\n // note 1: own properties in order, if one attempts to add back properties\n // note 1: in IE, they may end up in their former position due to their position\n // note 1: being retained. So use of this function with \"associative arrays\"\n // note 1: (objects) may lead to unexpected behavior in an IE environment if\n // note 1: you add back properties with the same keys that you removed\n // example 1: array_pop([0,1,2])\n // returns 1: 2\n // example 2: var $data = {firstName: 'Kevin', surName: 'van Zonneveld'}\n // example 2: var $lastElem = array_pop($data)\n // example 2: var $result = $data\n // returns 2: {firstName: 'Kevin'}\n\n var key = ''\n var lastKey = ''\n\n if (inputArr.hasOwnProperty('length')) {\n // Indexed\n if (!inputArr.length) {\n // Done popping, are we?\n return null\n }\n return inputArr.pop()\n } else {\n // Associative\n for (key in inputArr) {\n if (inputArr.hasOwnProperty(key)) {\n lastKey = key\n }\n }\n if (lastKey) {\n var tmp = inputArr[lastKey]\n delete (inputArr[lastKey])\n return tmp\n } else {\n return null\n }\n }\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_product.js b/node_modules/locutus/php/array/array_product.js new file mode 100644 index 0000000..27021ce --- /dev/null +++ b/node_modules/locutus/php/array/array_product.js @@ -0,0 +1,26 @@ +'use strict'; + +module.exports = function array_product(input) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_product/ + // original by: Waldo Malqui Silva (http://waldo.malqui.info) + // example 1: array_product([ 2, 4, 6, 8 ]) + // returns 1: 384 + + var idx = 0; + var product = 1; + var il = 0; + + if (Object.prototype.toString.call(input) !== '[object Array]') { + return null; + } + + il = input.length; + while (idx < il) { + product *= !isNaN(input[idx]) ? input[idx] : 0; + idx++; + } + + return product; +}; +//# sourceMappingURL=array_product.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_product.js.map b/node_modules/locutus/php/array/array_product.js.map new file mode 100644 index 0000000..7543cfe --- /dev/null +++ b/node_modules/locutus/php/array/array_product.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_product.js"],"names":["module","exports","array_product","input","idx","product","il","Object","prototype","toString","call","length","isNaN"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,aAAT,CAAwBC,KAAxB,EAA+B;AAAE;AAChD;AACA;AACA;AACA;;AAEA,MAAIC,MAAM,CAAV;AACA,MAAIC,UAAU,CAAd;AACA,MAAIC,KAAK,CAAT;;AAEA,MAAIC,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BP,KAA/B,MAA0C,gBAA9C,EAAgE;AAC9D,WAAO,IAAP;AACD;;AAEDG,OAAKH,MAAMQ,MAAX;AACA,SAAOP,MAAME,EAAb,EAAiB;AACfD,eAAY,CAACO,MAAMT,MAAMC,GAAN,CAAN,CAAD,GAAqBD,MAAMC,GAAN,CAArB,GAAkC,CAA9C;AACAA;AACD;;AAED,SAAOC,OAAP;AACD,CArBD","file":"array_product.js","sourcesContent":["module.exports = function array_product (input) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_product/\n // original by: Waldo Malqui Silva (http://waldo.malqui.info)\n // example 1: array_product([ 2, 4, 6, 8 ])\n // returns 1: 384\n\n var idx = 0\n var product = 1\n var il = 0\n\n if (Object.prototype.toString.call(input) !== '[object Array]') {\n return null\n }\n\n il = input.length\n while (idx < il) {\n product *= (!isNaN(input[idx]) ? input[idx] : 0)\n idx++\n }\n\n return product\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_push.js b/node_modules/locutus/php/array/array_push.js new file mode 100644 index 0000000..cf2f0ba --- /dev/null +++ b/node_modules/locutus/php/array/array_push.js @@ -0,0 +1,48 @@ +'use strict'; + +module.exports = function array_push(inputArr) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_push/ + // original by: Kevin van Zonneveld (http://kvz.io) + // improved by: Brett Zamir (http://brett-zamir.me) + // note 1: Note also that IE retains information about property position even + // note 1: after being supposedly deleted, so if you delete properties and then + // note 1: add back properties with the same keys (including numeric) that had + // note 1: been deleted, the order will be as before; thus, this function is not + // note 1: really recommended with associative arrays (objects) in IE environments + // example 1: array_push(['kevin','van'], 'zonneveld') + // returns 1: 3 + + var i = 0; + var pr = ''; + var argv = arguments; + var argc = argv.length; + var allDigits = /^\d$/; + var size = 0; + var highestIdx = 0; + var len = 0; + + if (inputArr.hasOwnProperty('length')) { + for (i = 1; i < argc; i++) { + inputArr[inputArr.length] = argv[i]; + } + return inputArr.length; + } + + // Associative (object) + for (pr in inputArr) { + if (inputArr.hasOwnProperty(pr)) { + ++len; + if (pr.search(allDigits) !== -1) { + size = parseInt(pr, 10); + highestIdx = size > highestIdx ? size : highestIdx; + } + } + } + for (i = 1; i < argc; i++) { + inputArr[++highestIdx] = argv[i]; + } + + return len + i - 1; +}; +//# sourceMappingURL=array_push.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_push.js.map b/node_modules/locutus/php/array/array_push.js.map new file mode 100644 index 0000000..0ba5386 --- /dev/null +++ b/node_modules/locutus/php/array/array_push.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_push.js"],"names":["module","exports","array_push","inputArr","i","pr","argv","arguments","argc","length","allDigits","size","highestIdx","len","hasOwnProperty","search","parseInt"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,UAAT,CAAqBC,QAArB,EAA+B;AAAE;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,IAAI,CAAR;AACA,MAAIC,KAAK,EAAT;AACA,MAAIC,OAAOC,SAAX;AACA,MAAIC,OAAOF,KAAKG,MAAhB;AACA,MAAIC,YAAY,MAAhB;AACA,MAAIC,OAAO,CAAX;AACA,MAAIC,aAAa,CAAjB;AACA,MAAIC,MAAM,CAAV;;AAEA,MAAIV,SAASW,cAAT,CAAwB,QAAxB,CAAJ,EAAuC;AACrC,SAAKV,IAAI,CAAT,EAAYA,IAAII,IAAhB,EAAsBJ,GAAtB,EAA2B;AACzBD,eAASA,SAASM,MAAlB,IAA4BH,KAAKF,CAAL,CAA5B;AACD;AACD,WAAOD,SAASM,MAAhB;AACD;;AAED;AACA,OAAKJ,EAAL,IAAWF,QAAX,EAAqB;AACnB,QAAIA,SAASW,cAAT,CAAwBT,EAAxB,CAAJ,EAAiC;AAC/B,QAAEQ,GAAF;AACA,UAAIR,GAAGU,MAAH,CAAUL,SAAV,MAAyB,CAAC,CAA9B,EAAiC;AAC/BC,eAAOK,SAASX,EAAT,EAAa,EAAb,CAAP;AACAO,qBAAaD,OAAOC,UAAP,GAAoBD,IAApB,GAA2BC,UAAxC;AACD;AACF;AACF;AACD,OAAKR,IAAI,CAAT,EAAYA,IAAII,IAAhB,EAAsBJ,GAAtB,EAA2B;AACzBD,aAAS,EAAES,UAAX,IAAyBN,KAAKF,CAAL,CAAzB;AACD;;AAED,SAAOS,MAAMT,CAAN,GAAU,CAAjB;AACD,CA3CD","file":"array_push.js","sourcesContent":["module.exports = function array_push (inputArr) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_push/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // note 1: Note also that IE retains information about property position even\n // note 1: after being supposedly deleted, so if you delete properties and then\n // note 1: add back properties with the same keys (including numeric) that had\n // note 1: been deleted, the order will be as before; thus, this function is not\n // note 1: really recommended with associative arrays (objects) in IE environments\n // example 1: array_push(['kevin','van'], 'zonneveld')\n // returns 1: 3\n\n var i = 0\n var pr = ''\n var argv = arguments\n var argc = argv.length\n var allDigits = /^\\d$/\n var size = 0\n var highestIdx = 0\n var len = 0\n\n if (inputArr.hasOwnProperty('length')) {\n for (i = 1; i < argc; i++) {\n inputArr[inputArr.length] = argv[i]\n }\n return inputArr.length\n }\n\n // Associative (object)\n for (pr in inputArr) {\n if (inputArr.hasOwnProperty(pr)) {\n ++len\n if (pr.search(allDigits) !== -1) {\n size = parseInt(pr, 10)\n highestIdx = size > highestIdx ? size : highestIdx\n }\n }\n }\n for (i = 1; i < argc; i++) {\n inputArr[++highestIdx] = argv[i]\n }\n\n return len + i - 1\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_rand.js b/node_modules/locutus/php/array/array_rand.js new file mode 100644 index 0000000..dbdfc08 --- /dev/null +++ b/node_modules/locutus/php/array/array_rand.js @@ -0,0 +1,36 @@ +'use strict'; + +module.exports = function array_rand(array, num) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_rand/ + // original by: Waldo Malqui Silva (http://waldo.malqui.info) + // reimplemented by: Rafał Kukawski + // example 1: array_rand( ['Kevin'], 1 ) + // returns 1: '0' + + // By using Object.keys we support both, arrays and objects + // which phpjs wants to support + var keys = Object.keys(array); + + if (typeof num === 'undefined' || num === null) { + num = 1; + } else { + num = +num; + } + + if (isNaN(num) || num < 1 || num > keys.length) { + return null; + } + + // shuffle the array of keys + for (var i = keys.length - 1; i > 0; i--) { + var j = Math.floor(Math.random() * (i + 1)); // 0 ≤ j ≤ i + + var tmp = keys[j]; + keys[j] = keys[i]; + keys[i] = tmp; + } + + return num === 1 ? keys[0] : keys.slice(0, num); +}; +//# sourceMappingURL=array_rand.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_rand.js.map b/node_modules/locutus/php/array/array_rand.js.map new file mode 100644 index 0000000..8c4d255 --- /dev/null +++ b/node_modules/locutus/php/array/array_rand.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_rand.js"],"names":["module","exports","array_rand","array","num","keys","Object","isNaN","length","i","j","Math","floor","random","tmp","slice"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,UAAT,CAAqBC,KAArB,EAA4BC,GAA5B,EAAiC;AAAE;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAIC,OAAOC,OAAOD,IAAP,CAAYF,KAAZ,CAAX;;AAEA,MAAI,OAAOC,GAAP,KAAe,WAAf,IAA8BA,QAAQ,IAA1C,EAAgD;AAC9CA,UAAM,CAAN;AACD,GAFD,MAEO;AACLA,UAAM,CAACA,GAAP;AACD;;AAED,MAAIG,MAAMH,GAAN,KAAcA,MAAM,CAApB,IAAyBA,MAAMC,KAAKG,MAAxC,EAAgD;AAC9C,WAAO,IAAP;AACD;;AAED;AACA,OAAK,IAAIC,IAAIJ,KAAKG,MAAL,GAAc,CAA3B,EAA8BC,IAAI,CAAlC,EAAqCA,GAArC,EAA0C;AACxC,QAAIC,IAAIC,KAAKC,KAAL,CAAWD,KAAKE,MAAL,MAAiBJ,IAAI,CAArB,CAAX,CAAR,CADwC,CACI;;AAE5C,QAAIK,MAAMT,KAAKK,CAAL,CAAV;AACAL,SAAKK,CAAL,IAAUL,KAAKI,CAAL,CAAV;AACAJ,SAAKI,CAAL,IAAUK,GAAV;AACD;;AAED,SAAOV,QAAQ,CAAR,GAAYC,KAAK,CAAL,CAAZ,GAAsBA,KAAKU,KAAL,CAAW,CAAX,EAAcX,GAAd,CAA7B;AACD,CA/BD","file":"array_rand.js","sourcesContent":["module.exports = function array_rand (array, num) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_rand/\n // original by: Waldo Malqui Silva (http://waldo.malqui.info)\n // reimplemented by: Rafał Kukawski\n // example 1: array_rand( ['Kevin'], 1 )\n // returns 1: '0'\n\n // By using Object.keys we support both, arrays and objects\n // which phpjs wants to support\n var keys = Object.keys(array)\n\n if (typeof num === 'undefined' || num === null) {\n num = 1\n } else {\n num = +num\n }\n\n if (isNaN(num) || num < 1 || num > keys.length) {\n return null\n }\n\n // shuffle the array of keys\n for (var i = keys.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1)) // 0 ≤ j ≤ i\n\n var tmp = keys[j]\n keys[j] = keys[i]\n keys[i] = tmp\n }\n\n return num === 1 ? keys[0] : keys.slice(0, num)\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_reduce.js b/node_modules/locutus/php/array/array_reduce.js new file mode 100644 index 0000000..41200ab --- /dev/null +++ b/node_modules/locutus/php/array/array_reduce.js @@ -0,0 +1,29 @@ +"use strict"; + +module.exports = function array_reduce(aInput, callback) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_reduce/ + // original by: Alfonso Jimenez (http://www.alfonsojimenez.com) + // note 1: Takes a function as an argument, not a function's name + // example 1: array_reduce([1, 2, 3, 4, 5], function (v, w){v += w;return v;}) + // returns 1: 15 + + var lon = aInput.length; + var res = 0; + var i = 0; + var tmp = []; + + for (i = 0; i < lon; i += 2) { + tmp[0] = aInput[i]; + if (aInput[i + 1]) { + tmp[1] = aInput[i + 1]; + } else { + tmp[1] = 0; + } + res += callback.apply(null, tmp); + tmp = []; + } + + return res; +}; +//# sourceMappingURL=array_reduce.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_reduce.js.map b/node_modules/locutus/php/array/array_reduce.js.map new file mode 100644 index 0000000..5910fb8 --- /dev/null +++ b/node_modules/locutus/php/array/array_reduce.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_reduce.js"],"names":["module","exports","array_reduce","aInput","callback","lon","length","res","i","tmp","apply"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,YAAT,CAAuBC,MAAvB,EAA+BC,QAA/B,EAAyC;AAAE;AAC1D;AACA;AACA;AACA;AACA;;AAEA,MAAIC,MAAMF,OAAOG,MAAjB;AACA,MAAIC,MAAM,CAAV;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,MAAM,EAAV;;AAEA,OAAKD,IAAI,CAAT,EAAYA,IAAIH,GAAhB,EAAqBG,KAAK,CAA1B,EAA6B;AAC3BC,QAAI,CAAJ,IAASN,OAAOK,CAAP,CAAT;AACA,QAAIL,OAAQK,IAAI,CAAZ,CAAJ,EAAqB;AACnBC,UAAI,CAAJ,IAASN,OAAQK,IAAI,CAAZ,CAAT;AACD,KAFD,MAEO;AACLC,UAAI,CAAJ,IAAS,CAAT;AACD;AACDF,WAAOH,SAASM,KAAT,CAAe,IAAf,EAAqBD,GAArB,CAAP;AACAA,UAAM,EAAN;AACD;;AAED,SAAOF,GAAP;AACD,CAxBD","file":"array_reduce.js","sourcesContent":["module.exports = function array_reduce (aInput, callback) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_reduce/\n // original by: Alfonso Jimenez (http://www.alfonsojimenez.com)\n // note 1: Takes a function as an argument, not a function's name\n // example 1: array_reduce([1, 2, 3, 4, 5], function (v, w){v += w;return v;})\n // returns 1: 15\n\n var lon = aInput.length\n var res = 0\n var i = 0\n var tmp = []\n\n for (i = 0; i < lon; i += 2) {\n tmp[0] = aInput[i]\n if (aInput[(i + 1)]) {\n tmp[1] = aInput[(i + 1)]\n } else {\n tmp[1] = 0\n }\n res += callback.apply(null, tmp)\n tmp = []\n }\n\n return res\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_replace.js b/node_modules/locutus/php/array/array_replace.js new file mode 100644 index 0000000..ec29c9a --- /dev/null +++ b/node_modules/locutus/php/array/array_replace.js @@ -0,0 +1,34 @@ +'use strict'; + +module.exports = function array_replace(arr) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_replace/ + // original by: Brett Zamir (http://brett-zamir.me) + // example 1: array_replace(["orange", "banana", "apple", "raspberry"], {0 : "pineapple", 4 : "cherry"}, {0:"grape"}) + // returns 1: {0: 'grape', 1: 'banana', 2: 'apple', 3: 'raspberry', 4: 'cherry'} + + var retObj = {}; + var i = 0; + var p = ''; + var argl = arguments.length; + + if (argl < 2) { + throw new Error('There should be at least 2 arguments passed to array_replace()'); + } + + // Although docs state that the arguments are passed in by reference, + // it seems they are not altered, but rather the copy that is returned + // (just guessing), so we make a copy here, instead of acting on arr itself + for (p in arr) { + retObj[p] = arr[p]; + } + + for (i = 1; i < argl; i++) { + for (p in arguments[i]) { + retObj[p] = arguments[i][p]; + } + } + + return retObj; +}; +//# sourceMappingURL=array_replace.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_replace.js.map b/node_modules/locutus/php/array/array_replace.js.map new file mode 100644 index 0000000..821f45d --- /dev/null +++ b/node_modules/locutus/php/array/array_replace.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_replace.js"],"names":["module","exports","array_replace","arr","retObj","i","p","argl","arguments","length","Error"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,aAAT,CAAwBC,GAAxB,EAA6B;AAAE;AAC9C;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,OAAOC,UAAUC,MAArB;;AAEA,MAAIF,OAAO,CAAX,EAAc;AACZ,UAAM,IAAIG,KAAJ,CAAU,gEAAV,CAAN;AACD;;AAED;AACA;AACA;AACA,OAAKJ,CAAL,IAAUH,GAAV,EAAe;AACbC,WAAOE,CAAP,IAAYH,IAAIG,CAAJ,CAAZ;AACD;;AAED,OAAKD,IAAI,CAAT,EAAYA,IAAIE,IAAhB,EAAsBF,GAAtB,EAA2B;AACzB,SAAKC,CAAL,IAAUE,UAAUH,CAAV,CAAV,EAAwB;AACtBD,aAAOE,CAAP,IAAYE,UAAUH,CAAV,EAAaC,CAAb,CAAZ;AACD;AACF;;AAED,SAAOF,MAAP;AACD,CA7BD","file":"array_replace.js","sourcesContent":["module.exports = function array_replace (arr) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_replace/\n // original by: Brett Zamir (http://brett-zamir.me)\n // example 1: array_replace([\"orange\", \"banana\", \"apple\", \"raspberry\"], {0 : \"pineapple\", 4 : \"cherry\"}, {0:\"grape\"})\n // returns 1: {0: 'grape', 1: 'banana', 2: 'apple', 3: 'raspberry', 4: 'cherry'}\n\n var retObj = {}\n var i = 0\n var p = ''\n var argl = arguments.length\n\n if (argl < 2) {\n throw new Error('There should be at least 2 arguments passed to array_replace()')\n }\n\n // Although docs state that the arguments are passed in by reference,\n // it seems they are not altered, but rather the copy that is returned\n // (just guessing), so we make a copy here, instead of acting on arr itself\n for (p in arr) {\n retObj[p] = arr[p]\n }\n\n for (i = 1; i < argl; i++) {\n for (p in arguments[i]) {\n retObj[p] = arguments[i][p]\n }\n }\n\n return retObj\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_replace_recursive.js b/node_modules/locutus/php/array/array_replace_recursive.js new file mode 100644 index 0000000..b4cc56b --- /dev/null +++ b/node_modules/locutus/php/array/array_replace_recursive.js @@ -0,0 +1,48 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +module.exports = function array_replace_recursive(arr) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_replace_recursive/ + // original by: Brett Zamir (http://brett-zamir.me) + // example 1: array_replace_recursive({'citrus' : ['orange'], 'berries' : ['blackberry', 'raspberry']}, {'citrus' : ['pineapple'], 'berries' : ['blueberry']}) + // returns 1: {citrus : ['pineapple'], berries : ['blueberry', 'raspberry']} + + var i = 0; + var p = ''; + var argl = arguments.length; + var retObj; + + if (argl < 2) { + throw new Error('There should be at least 2 arguments passed to array_replace_recursive()'); + } + + // Although docs state that the arguments are passed in by reference, + // it seems they are not altered, but rather the copy that is returned + // So we make a copy here, instead of acting on arr itself + if (Object.prototype.toString.call(arr) === '[object Array]') { + retObj = []; + for (p in arr) { + retObj.push(arr[p]); + } + } else { + retObj = {}; + for (p in arr) { + retObj[p] = arr[p]; + } + } + + for (i = 1; i < argl; i++) { + for (p in arguments[i]) { + if (retObj[p] && _typeof(retObj[p]) === 'object') { + retObj[p] = array_replace_recursive(retObj[p], arguments[i][p]); + } else { + retObj[p] = arguments[i][p]; + } + } + } + + return retObj; +}; +//# sourceMappingURL=array_replace_recursive.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_replace_recursive.js.map b/node_modules/locutus/php/array/array_replace_recursive.js.map new file mode 100644 index 0000000..3b4b0fc --- /dev/null +++ b/node_modules/locutus/php/array/array_replace_recursive.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_replace_recursive.js"],"names":["module","exports","array_replace_recursive","arr","i","p","argl","arguments","length","retObj","Error","Object","prototype","toString","call","push"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,uBAAT,CAAkCC,GAAlC,EAAuC;AAAE;AACxD;AACA;AACA;AACA;;AAEA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,OAAOC,UAAUC,MAArB;AACA,MAAIC,MAAJ;;AAEA,MAAIH,OAAO,CAAX,EAAc;AACZ,UAAM,IAAII,KAAJ,CAAU,0EAAV,CAAN;AACD;;AAED;AACA;AACA;AACA,MAAIC,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BX,GAA/B,MAAwC,gBAA5C,EAA8D;AAC5DM,aAAS,EAAT;AACA,SAAKJ,CAAL,IAAUF,GAAV,EAAe;AACbM,aAAOM,IAAP,CAAYZ,IAAIE,CAAJ,CAAZ;AACD;AACF,GALD,MAKO;AACLI,aAAS,EAAT;AACA,SAAKJ,CAAL,IAAUF,GAAV,EAAe;AACbM,aAAOJ,CAAP,IAAYF,IAAIE,CAAJ,CAAZ;AACD;AACF;;AAED,OAAKD,IAAI,CAAT,EAAYA,IAAIE,IAAhB,EAAsBF,GAAtB,EAA2B;AACzB,SAAKC,CAAL,IAAUE,UAAUH,CAAV,CAAV,EAAwB;AACtB,UAAIK,OAAOJ,CAAP,KAAa,QAAOI,OAAOJ,CAAP,CAAP,MAAqB,QAAtC,EAAgD;AAC9CI,eAAOJ,CAAP,IAAYH,wBAAwBO,OAAOJ,CAAP,CAAxB,EAAmCE,UAAUH,CAAV,EAAaC,CAAb,CAAnC,CAAZ;AACD,OAFD,MAEO;AACLI,eAAOJ,CAAP,IAAYE,UAAUH,CAAV,EAAaC,CAAb,CAAZ;AACD;AACF;AACF;;AAED,SAAOI,MAAP;AACD,CAzCD","file":"array_replace_recursive.js","sourcesContent":["module.exports = function array_replace_recursive (arr) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_replace_recursive/\n // original by: Brett Zamir (http://brett-zamir.me)\n // example 1: array_replace_recursive({'citrus' : ['orange'], 'berries' : ['blackberry', 'raspberry']}, {'citrus' : ['pineapple'], 'berries' : ['blueberry']})\n // returns 1: {citrus : ['pineapple'], berries : ['blueberry', 'raspberry']}\n\n var i = 0\n var p = ''\n var argl = arguments.length\n var retObj\n\n if (argl < 2) {\n throw new Error('There should be at least 2 arguments passed to array_replace_recursive()')\n }\n\n // Although docs state that the arguments are passed in by reference,\n // it seems they are not altered, but rather the copy that is returned\n // So we make a copy here, instead of acting on arr itself\n if (Object.prototype.toString.call(arr) === '[object Array]') {\n retObj = []\n for (p in arr) {\n retObj.push(arr[p])\n }\n } else {\n retObj = {}\n for (p in arr) {\n retObj[p] = arr[p]\n }\n }\n\n for (i = 1; i < argl; i++) {\n for (p in arguments[i]) {\n if (retObj[p] && typeof retObj[p] === 'object') {\n retObj[p] = array_replace_recursive(retObj[p], arguments[i][p])\n } else {\n retObj[p] = arguments[i][p]\n }\n }\n }\n\n return retObj\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_reverse.js b/node_modules/locutus/php/array/array_reverse.js new file mode 100644 index 0000000..fe157aa --- /dev/null +++ b/node_modules/locutus/php/array/array_reverse.js @@ -0,0 +1,41 @@ +'use strict'; + +module.exports = function array_reverse(array, preserveKeys) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_reverse/ + // original by: Kevin van Zonneveld (http://kvz.io) + // improved by: Karol Kowalski + // example 1: array_reverse( [ 'php', '4.0', ['green', 'red'] ], true) + // returns 1: { 2: ['green', 'red'], 1: '4.0', 0: 'php'} + + var isArray = Object.prototype.toString.call(array) === '[object Array]'; + var tmpArr = preserveKeys ? {} : []; + var key; + + if (isArray && !preserveKeys) { + return array.slice(0).reverse(); + } + + if (preserveKeys) { + var keys = []; + for (key in array) { + keys.push(key); + } + + var i = keys.length; + while (i--) { + key = keys[i]; + // @todo: don't rely on browsers keeping keys in insertion order + // it's implementation specific + // eg. the result will differ from expected in Google Chrome + tmpArr[key] = array[key]; + } + } else { + for (key in array) { + tmpArr.unshift(array[key]); + } + } + + return tmpArr; +}; +//# sourceMappingURL=array_reverse.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_reverse.js.map b/node_modules/locutus/php/array/array_reverse.js.map new file mode 100644 index 0000000..9b6bea1 --- /dev/null +++ b/node_modules/locutus/php/array/array_reverse.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_reverse.js"],"names":["module","exports","array_reverse","array","preserveKeys","isArray","Object","prototype","toString","call","tmpArr","key","slice","reverse","keys","push","i","length","unshift"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,aAAT,CAAwBC,KAAxB,EAA+BC,YAA/B,EAA6C;AAAE;AAC9D;AACA;AACA;AACA;AACA;;AAEA,MAAIC,UAAUC,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BN,KAA/B,MAA0C,gBAAxD;AACA,MAAIO,SAASN,eAAe,EAAf,GAAoB,EAAjC;AACA,MAAIO,GAAJ;;AAEA,MAAIN,WAAW,CAACD,YAAhB,EAA8B;AAC5B,WAAOD,MAAMS,KAAN,CAAY,CAAZ,EAAeC,OAAf,EAAP;AACD;;AAED,MAAIT,YAAJ,EAAkB;AAChB,QAAIU,OAAO,EAAX;AACA,SAAKH,GAAL,IAAYR,KAAZ,EAAmB;AACjBW,WAAKC,IAAL,CAAUJ,GAAV;AACD;;AAED,QAAIK,IAAIF,KAAKG,MAAb;AACA,WAAOD,GAAP,EAAY;AACVL,YAAMG,KAAKE,CAAL,CAAN;AACA;AACA;AACA;AACAN,aAAOC,GAAP,IAAcR,MAAMQ,GAAN,CAAd;AACD;AACF,GAdD,MAcO;AACL,SAAKA,GAAL,IAAYR,KAAZ,EAAmB;AACjBO,aAAOQ,OAAP,CAAef,MAAMQ,GAAN,CAAf;AACD;AACF;;AAED,SAAOD,MAAP;AACD,CApCD","file":"array_reverse.js","sourcesContent":["module.exports = function array_reverse (array, preserveKeys) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_reverse/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Karol Kowalski\n // example 1: array_reverse( [ 'php', '4.0', ['green', 'red'] ], true)\n // returns 1: { 2: ['green', 'red'], 1: '4.0', 0: 'php'}\n\n var isArray = Object.prototype.toString.call(array) === '[object Array]'\n var tmpArr = preserveKeys ? {} : []\n var key\n\n if (isArray && !preserveKeys) {\n return array.slice(0).reverse()\n }\n\n if (preserveKeys) {\n var keys = []\n for (key in array) {\n keys.push(key)\n }\n\n var i = keys.length\n while (i--) {\n key = keys[i]\n // @todo: don't rely on browsers keeping keys in insertion order\n // it's implementation specific\n // eg. the result will differ from expected in Google Chrome\n tmpArr[key] = array[key]\n }\n } else {\n for (key in array) {\n tmpArr.unshift(array[key])\n }\n }\n\n return tmpArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_search.js b/node_modules/locutus/php/array/array_search.js new file mode 100644 index 0000000..9765630 --- /dev/null +++ b/node_modules/locutus/php/array/array_search.js @@ -0,0 +1,51 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +module.exports = function array_search(needle, haystack, argStrict) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_search/ + // original by: Kevin van Zonneveld (http://kvz.io) + // input by: Brett Zamir (http://brett-zamir.me) + // bugfixed by: Kevin van Zonneveld (http://kvz.io) + // bugfixed by: Reynier de la Rosa (http://scriptinside.blogspot.com.es/) + // test: skip-all + // example 1: array_search('zonneveld', {firstname: 'kevin', middle: 'van', surname: 'zonneveld'}) + // returns 1: 'surname' + // example 2: array_search('3', {a: 3, b: 5, c: 7}) + // returns 2: 'a' + + var strict = !!argStrict; + var key = ''; + + if ((typeof needle === 'undefined' ? 'undefined' : _typeof(needle)) === 'object' && needle.exec) { + // Duck-type for RegExp + if (!strict) { + // Let's consider case sensitive searches as strict + var flags = 'i' + (needle.global ? 'g' : '') + (needle.multiline ? 'm' : '') + ( + // sticky is FF only + needle.sticky ? 'y' : ''); + needle = new RegExp(needle.source, flags); + } + for (key in haystack) { + if (haystack.hasOwnProperty(key)) { + if (needle.test(haystack[key])) { + return key; + } + } + } + return false; + } + + for (key in haystack) { + if (haystack.hasOwnProperty(key)) { + if (strict && haystack[key] === needle || !strict && haystack[key] == needle) { + // eslint-disable-line eqeqeq + return key; + } + } + } + + return false; +}; +//# sourceMappingURL=array_search.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_search.js.map b/node_modules/locutus/php/array/array_search.js.map new file mode 100644 index 0000000..97b2c5b --- /dev/null +++ b/node_modules/locutus/php/array/array_search.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_search.js"],"names":["module","exports","array_search","needle","haystack","argStrict","strict","key","exec","flags","global","multiline","sticky","RegExp","source","hasOwnProperty","test"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,YAAT,CAAuBC,MAAvB,EAA+BC,QAA/B,EAAyCC,SAAzC,EAAoD;AAAE;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,CAAC,CAACD,SAAf;AACA,MAAIE,MAAM,EAAV;;AAEA,MAAI,QAAOJ,MAAP,yCAAOA,MAAP,OAAkB,QAAlB,IAA8BA,OAAOK,IAAzC,EAA+C;AAC7C;AACA,QAAI,CAACF,MAAL,EAAa;AACX;AACA,UAAIG,QAAQ,OAAON,OAAOO,MAAP,GAAgB,GAAhB,GAAsB,EAA7B,KACTP,OAAOQ,SAAP,GAAmB,GAAnB,GAAyB,EADhB;AAEV;AACCR,aAAOS,MAAP,GAAgB,GAAhB,GAAsB,EAHb,CAAZ;AAIAT,eAAS,IAAIU,MAAJ,CAAWV,OAAOW,MAAlB,EAA0BL,KAA1B,CAAT;AACD;AACD,SAAKF,GAAL,IAAYH,QAAZ,EAAsB;AACpB,UAAIA,SAASW,cAAT,CAAwBR,GAAxB,CAAJ,EAAkC;AAChC,YAAIJ,OAAOa,IAAP,CAAYZ,SAASG,GAAT,CAAZ,CAAJ,EAAgC;AAC9B,iBAAOA,GAAP;AACD;AACF;AACF;AACD,WAAO,KAAP;AACD;;AAED,OAAKA,GAAL,IAAYH,QAAZ,EAAsB;AACpB,QAAIA,SAASW,cAAT,CAAwBR,GAAxB,CAAJ,EAAkC;AAChC,UAAKD,UAAUF,SAASG,GAAT,MAAkBJ,MAA7B,IAAyC,CAACG,MAAD,IAAWF,SAASG,GAAT,KAAiBJ,MAAzE,EAAkF;AAAE;AAClF,eAAOI,GAAP;AACD;AACF;AACF;;AAED,SAAO,KAAP;AACD,CA5CD","file":"array_search.js","sourcesContent":["module.exports = function array_search (needle, haystack, argStrict) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_search/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // input by: Brett Zamir (http://brett-zamir.me)\n // bugfixed by: Kevin van Zonneveld (http://kvz.io)\n // bugfixed by: Reynier de la Rosa (http://scriptinside.blogspot.com.es/)\n // test: skip-all\n // example 1: array_search('zonneveld', {firstname: 'kevin', middle: 'van', surname: 'zonneveld'})\n // returns 1: 'surname'\n // example 2: array_search('3', {a: 3, b: 5, c: 7})\n // returns 2: 'a'\n\n var strict = !!argStrict\n var key = ''\n\n if (typeof needle === 'object' && needle.exec) {\n // Duck-type for RegExp\n if (!strict) {\n // Let's consider case sensitive searches as strict\n var flags = 'i' + (needle.global ? 'g' : '') +\n (needle.multiline ? 'm' : '') +\n // sticky is FF only\n (needle.sticky ? 'y' : '')\n needle = new RegExp(needle.source, flags)\n }\n for (key in haystack) {\n if (haystack.hasOwnProperty(key)) {\n if (needle.test(haystack[key])) {\n return key\n }\n }\n }\n return false\n }\n\n for (key in haystack) {\n if (haystack.hasOwnProperty(key)) {\n if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) { // eslint-disable-line eqeqeq\n return key\n }\n }\n }\n\n return false\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_shift.js b/node_modules/locutus/php/array/array_shift.js new file mode 100644 index 0000000..f68ba7d --- /dev/null +++ b/node_modules/locutus/php/array/array_shift.js @@ -0,0 +1,38 @@ +"use strict"; + +module.exports = function array_shift(inputArr) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_shift/ + // original by: Kevin van Zonneveld (http://kvz.io) + // improved by: Martijn Wieringa + // note 1: Currently does not handle objects + // example 1: array_shift(['Kevin', 'van', 'Zonneveld']) + // returns 1: 'Kevin' + + var _checkToUpIndices = function _checkToUpIndices(arr, ct, key) { + // Deal with situation, e.g., if encounter index 4 and try + // to set it to 0, but 0 exists later in loop (need to + // increment all subsequent (skipping current key, since + // we need its value below) until find unused) + if (arr[ct] !== undefined) { + var tmp = ct; + ct += 1; + if (ct === key) { + ct += 1; + } + ct = _checkToUpIndices(arr, ct, key); + arr[ct] = arr[tmp]; + delete arr[tmp]; + } + + return ct; + }; + + if (inputArr.length === 0) { + return null; + } + if (inputArr.length > 0) { + return inputArr.shift(); + } +}; +//# sourceMappingURL=array_shift.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_shift.js.map b/node_modules/locutus/php/array/array_shift.js.map new file mode 100644 index 0000000..3a83c19 --- /dev/null +++ b/node_modules/locutus/php/array/array_shift.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_shift.js"],"names":["module","exports","array_shift","inputArr","_checkToUpIndices","arr","ct","key","undefined","tmp","length","shift"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,WAAT,CAAsBC,QAAtB,EAAgC;AAAE;AACjD;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,oBAAoB,SAApBA,iBAAoB,CAAUC,GAAV,EAAeC,EAAf,EAAmBC,GAAnB,EAAwB;AAC9C;AACA;AACA;AACA;AACA,QAAIF,IAAIC,EAAJ,MAAYE,SAAhB,EAA2B;AACzB,UAAIC,MAAMH,EAAV;AACAA,YAAM,CAAN;AACA,UAAIA,OAAOC,GAAX,EAAgB;AACdD,cAAM,CAAN;AACD;AACDA,WAAKF,kBAAkBC,GAAlB,EAAuBC,EAAvB,EAA2BC,GAA3B,CAAL;AACAF,UAAIC,EAAJ,IAAUD,IAAII,GAAJ,CAAV;AACA,aAAOJ,IAAII,GAAJ,CAAP;AACD;;AAED,WAAOH,EAAP;AACD,GAjBD;;AAmBA,MAAIH,SAASO,MAAT,KAAoB,CAAxB,EAA2B;AACzB,WAAO,IAAP;AACD;AACD,MAAIP,SAASO,MAAT,GAAkB,CAAtB,EAAyB;AACvB,WAAOP,SAASQ,KAAT,EAAP;AACD;AACF,CAjCD","file":"array_shift.js","sourcesContent":["module.exports = function array_shift (inputArr) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_shift/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Martijn Wieringa\n // note 1: Currently does not handle objects\n // example 1: array_shift(['Kevin', 'van', 'Zonneveld'])\n // returns 1: 'Kevin'\n\n var _checkToUpIndices = function (arr, ct, key) {\n // Deal with situation, e.g., if encounter index 4 and try\n // to set it to 0, but 0 exists later in loop (need to\n // increment all subsequent (skipping current key, since\n // we need its value below) until find unused)\n if (arr[ct] !== undefined) {\n var tmp = ct\n ct += 1\n if (ct === key) {\n ct += 1\n }\n ct = _checkToUpIndices(arr, ct, key)\n arr[ct] = arr[tmp]\n delete arr[tmp]\n }\n\n return ct\n }\n\n if (inputArr.length === 0) {\n return null\n }\n if (inputArr.length > 0) {\n return inputArr.shift()\n }\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_slice.js b/node_modules/locutus/php/array/array_slice.js new file mode 100644 index 0000000..0d90d80 --- /dev/null +++ b/node_modules/locutus/php/array/array_slice.js @@ -0,0 +1,74 @@ +'use strict'; + +module.exports = function array_slice(arr, offst, lgth, preserveKeys) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_slice/ + // original by: Brett Zamir (http://brett-zamir.me) + // input by: Brett Zamir (http://brett-zamir.me) + // bugfixed by: Kevin van Zonneveld (http://kvz.io) + // note 1: Relies on is_int because !isNaN accepts floats + // example 1: array_slice(["a", "b", "c", "d", "e"], 2, -1) + // returns 1: [ 'c', 'd' ] + // example 2: array_slice(["a", "b", "c", "d", "e"], 2, -1, true) + // returns 2: {2: 'c', 3: 'd'} + + var isInt = require('../var/is_int'); + + /* + if ('callee' in arr && 'length' in arr) { + arr = Array.prototype.slice.call(arr); + } + */ + + var key = ''; + + if (Object.prototype.toString.call(arr) !== '[object Array]' || preserveKeys && offst !== 0) { + // Assoc. array as input or if required as output + var lgt = 0; + var newAssoc = {}; + for (key in arr) { + lgt += 1; + newAssoc[key] = arr[key]; + } + arr = newAssoc; + + offst = offst < 0 ? lgt + offst : offst; + lgth = lgth === undefined ? lgt : lgth < 0 ? lgt + lgth - offst : lgth; + + var assoc = {}; + var start = false; + var it = -1; + var arrlgth = 0; + var noPkIdx = 0; + + for (key in arr) { + ++it; + if (arrlgth >= lgth) { + break; + } + if (it === offst) { + start = true; + } + if (!start) { + continue; + }++arrlgth; + if (isInt(key) && !preserveKeys) { + assoc[noPkIdx++] = arr[key]; + } else { + assoc[key] = arr[key]; + } + } + // Make as array-like object (though length will not be dynamic) + // assoc.length = arrlgth; + return assoc; + } + + if (lgth === undefined) { + return arr.slice(offst); + } else if (lgth >= 0) { + return arr.slice(offst, offst + lgth); + } else { + return arr.slice(offst, lgth); + } +}; +//# sourceMappingURL=array_slice.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_slice.js.map b/node_modules/locutus/php/array/array_slice.js.map new file mode 100644 index 0000000..f9e65d0 --- /dev/null +++ b/node_modules/locutus/php/array/array_slice.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_slice.js"],"names":["module","exports","array_slice","arr","offst","lgth","preserveKeys","isInt","require","key","Object","prototype","toString","call","lgt","newAssoc","undefined","assoc","start","it","arrlgth","noPkIdx","slice"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,WAAT,CAAsBC,GAAtB,EAA2BC,KAA3B,EAAkCC,IAAlC,EAAwCC,YAAxC,EAAsD;AAAE;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,QAAQC,QAAQ,eAAR,CAAZ;;AAEA;;;;;;AAMA,MAAIC,MAAM,EAAV;;AAEA,MAAIC,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BV,GAA/B,MAAwC,gBAAxC,IAA6DG,gBAAgBF,UAAU,CAA3F,EAA+F;AAC7F;AACA,QAAIU,MAAM,CAAV;AACA,QAAIC,WAAW,EAAf;AACA,SAAKN,GAAL,IAAYN,GAAZ,EAAiB;AACfW,aAAO,CAAP;AACAC,eAASN,GAAT,IAAgBN,IAAIM,GAAJ,CAAhB;AACD;AACDN,UAAMY,QAAN;;AAEAX,YAASA,QAAQ,CAAT,GAAcU,MAAMV,KAApB,GAA4BA,KAApC;AACAC,WAAOA,SAASW,SAAT,GAAqBF,GAArB,GAA4BT,OAAO,CAAR,GAAaS,MAAMT,IAAN,GAAaD,KAA1B,GAAkCC,IAApE;;AAEA,QAAIY,QAAQ,EAAZ;AACA,QAAIC,QAAQ,KAAZ;AACA,QAAIC,KAAK,CAAC,CAAV;AACA,QAAIC,UAAU,CAAd;AACA,QAAIC,UAAU,CAAd;;AAEA,SAAKZ,GAAL,IAAYN,GAAZ,EAAiB;AACf,QAAEgB,EAAF;AACA,UAAIC,WAAWf,IAAf,EAAqB;AACnB;AACD;AACD,UAAIc,OAAOf,KAAX,EAAkB;AAChBc,gBAAQ,IAAR;AACD;AACD,UAAI,CAACA,KAAL,EAAY;AACV;AACD,SAAEE,OAAF;AACD,UAAIb,MAAME,GAAN,KAAc,CAACH,YAAnB,EAAiC;AAC/BW,cAAMI,SAAN,IAAmBlB,IAAIM,GAAJ,CAAnB;AACD,OAFD,MAEO;AACLQ,cAAMR,GAAN,IAAaN,IAAIM,GAAJ,CAAb;AACD;AACF;AACD;AACA;AACA,WAAOQ,KAAP;AACD;;AAED,MAAIZ,SAASW,SAAb,EAAwB;AACtB,WAAOb,IAAImB,KAAJ,CAAUlB,KAAV,CAAP;AACD,GAFD,MAEO,IAAIC,QAAQ,CAAZ,EAAe;AACpB,WAAOF,IAAImB,KAAJ,CAAUlB,KAAV,EAAiBA,QAAQC,IAAzB,CAAP;AACD,GAFM,MAEA;AACL,WAAOF,IAAImB,KAAJ,CAAUlB,KAAV,EAAiBC,IAAjB,CAAP;AACD;AACF,CArED","file":"array_slice.js","sourcesContent":["module.exports = function array_slice (arr, offst, lgth, preserveKeys) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_slice/\n // original by: Brett Zamir (http://brett-zamir.me)\n // input by: Brett Zamir (http://brett-zamir.me)\n // bugfixed by: Kevin van Zonneveld (http://kvz.io)\n // note 1: Relies on is_int because !isNaN accepts floats\n // example 1: array_slice([\"a\", \"b\", \"c\", \"d\", \"e\"], 2, -1)\n // returns 1: [ 'c', 'd' ]\n // example 2: array_slice([\"a\", \"b\", \"c\", \"d\", \"e\"], 2, -1, true)\n // returns 2: {2: 'c', 3: 'd'}\n\n var isInt = require('../var/is_int')\n\n /*\n if ('callee' in arr && 'length' in arr) {\n arr = Array.prototype.slice.call(arr);\n }\n */\n\n var key = ''\n\n if (Object.prototype.toString.call(arr) !== '[object Array]' || (preserveKeys && offst !== 0)) {\n // Assoc. array as input or if required as output\n var lgt = 0\n var newAssoc = {}\n for (key in arr) {\n lgt += 1\n newAssoc[key] = arr[key]\n }\n arr = newAssoc\n\n offst = (offst < 0) ? lgt + offst : offst\n lgth = lgth === undefined ? lgt : (lgth < 0) ? lgt + lgth - offst : lgth\n\n var assoc = {}\n var start = false\n var it = -1\n var arrlgth = 0\n var noPkIdx = 0\n\n for (key in arr) {\n ++it\n if (arrlgth >= lgth) {\n break\n }\n if (it === offst) {\n start = true\n }\n if (!start) {\n continue\n }++arrlgth\n if (isInt(key) && !preserveKeys) {\n assoc[noPkIdx++] = arr[key]\n } else {\n assoc[key] = arr[key]\n }\n }\n // Make as array-like object (though length will not be dynamic)\n // assoc.length = arrlgth;\n return assoc\n }\n\n if (lgth === undefined) {\n return arr.slice(offst)\n } else if (lgth >= 0) {\n return arr.slice(offst, offst + lgth)\n } else {\n return arr.slice(offst, lgth)\n }\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_splice.js b/node_modules/locutus/php/array/array_splice.js new file mode 100644 index 0000000..443ef91 --- /dev/null +++ b/node_modules/locutus/php/array/array_splice.js @@ -0,0 +1,123 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +module.exports = function array_splice(arr, offst, lgth, replacement) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_splice/ + // original by: Brett Zamir (http://brett-zamir.me) + // input by: Theriault (https://github.com/Theriault) + // note 1: Order does get shifted in associative array input with numeric indices, + // note 1: since PHP behavior doesn't preserve keys, but I understand order is + // note 1: not reliable anyways + // note 1: Note also that IE retains information about property position even + // note 1: after being supposedly deleted, so use of this function may produce + // note 1: unexpected results in IE if you later attempt to add back properties + // note 1: with the same keys that had been deleted + // example 1: var $input = {4: "red", 'abc': "green", 2: "blue", 'dud': "yellow"} + // example 1: array_splice($input, 2) + // returns 1: {4: "red", 'abc': "green"} + // example 2: var $input = ["red", "green", "blue", "yellow"] + // example 2: array_splice($input, 3, 0, "purple") + // returns 2: [] + // example 3: var $input = ["red", "green", "blue", "yellow"] + // example 3: array_splice($input, -1, 1, ["black", "maroon"]) + // returns 3: ["yellow"] + // test: skip-1 + + var isInt = require('../var/is_int'); + + var _checkToUpIndices = function _checkToUpIndices(arr, ct, key) { + // Deal with situation, e.g., if encounter index 4 and try + // to set it to 0, but 0 exists later in loop (need to + // increment all subsequent (skipping current key, + // since we need its value below) until find unused) + if (arr[ct] !== undefined) { + var tmp = ct; + ct += 1; + if (ct === key) { + ct += 1; + } + ct = _checkToUpIndices(arr, ct, key); + arr[ct] = arr[tmp]; + delete arr[tmp]; + } + return ct; + }; + + if (replacement && (typeof replacement === 'undefined' ? 'undefined' : _typeof(replacement)) !== 'object') { + replacement = [replacement]; + } + if (lgth === undefined) { + lgth = offst >= 0 ? arr.length - offst : -offst; + } else if (lgth < 0) { + lgth = (offst >= 0 ? arr.length - offst : -offst) + lgth; + } + + if (Object.prototype.toString.call(arr) !== '[object Array]') { + /* if (arr.length !== undefined) { + // Deal with array-like objects as input + delete arr.length; + } */ + var lgt = 0; + var ct = -1; + var rmvd = []; + var rmvdObj = {}; + var replCt = -1; + var intCt = -1; + var returnArr = true; + var rmvdCt = 0; + // var rmvdLngth = 0 + var key = ''; + // rmvdObj.length = 0; + for (key in arr) { + // Can do arr.__count__ in some browsers + lgt += 1; + } + offst = offst >= 0 ? offst : lgt + offst; + for (key in arr) { + ct += 1; + if (ct < offst) { + if (isInt(key)) { + intCt += 1; + if (parseInt(key, 10) === intCt) { + // Key is already numbered ok, so don't need to change key for value + continue; + } + // Deal with situation, e.g., + _checkToUpIndices(arr, intCt, key); + // if encounter index 4 and try to set it to 0, but 0 exists later in loop + arr[intCt] = arr[key]; + delete arr[key]; + } + continue; + } + if (returnArr && isInt(key)) { + rmvd.push(arr[key]); + // PHP starts over here too + rmvdObj[rmvdCt++] = arr[key]; + } else { + rmvdObj[key] = arr[key]; + returnArr = false; + } + // rmvdLngth += 1 + // rmvdObj.length += 1; + if (replacement && replacement[++replCt]) { + arr[key] = replacement[replCt]; + } else { + delete arr[key]; + } + } + // Make (back) into an array-like object + // arr.length = lgt - rmvdLngth + (replacement ? replacement.length : 0); + return returnArr ? rmvd : rmvdObj; + } + + if (replacement) { + replacement.unshift(offst, lgth); + return Array.prototype.splice.apply(arr, replacement); + } + + return arr.splice(offst, lgth); +}; +//# sourceMappingURL=array_splice.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_splice.js.map b/node_modules/locutus/php/array/array_splice.js.map new file mode 100644 index 0000000..4027e16 --- /dev/null +++ b/node_modules/locutus/php/array/array_splice.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_splice.js"],"names":["module","exports","array_splice","arr","offst","lgth","replacement","isInt","require","_checkToUpIndices","ct","key","undefined","tmp","length","Object","prototype","toString","call","lgt","rmvd","rmvdObj","replCt","intCt","returnArr","rmvdCt","parseInt","push","unshift","Array","splice","apply"],"mappings":"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","file":"array_splice.js","sourcesContent":["module.exports = function array_splice (arr, offst, lgth, replacement) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_splice/\n // original by: Brett Zamir (http://brett-zamir.me)\n // input by: Theriault (https://github.com/Theriault)\n // note 1: Order does get shifted in associative array input with numeric indices,\n // note 1: since PHP behavior doesn't preserve keys, but I understand order is\n // note 1: not reliable anyways\n // note 1: Note also that IE retains information about property position even\n // note 1: after being supposedly deleted, so use of this function may produce\n // note 1: unexpected results in IE if you later attempt to add back properties\n // note 1: with the same keys that had been deleted\n // example 1: var $input = {4: \"red\", 'abc': \"green\", 2: \"blue\", 'dud': \"yellow\"}\n // example 1: array_splice($input, 2)\n // returns 1: {4: \"red\", 'abc': \"green\"}\n // example 2: var $input = [\"red\", \"green\", \"blue\", \"yellow\"]\n // example 2: array_splice($input, 3, 0, \"purple\")\n // returns 2: []\n // example 3: var $input = [\"red\", \"green\", \"blue\", \"yellow\"]\n // example 3: array_splice($input, -1, 1, [\"black\", \"maroon\"])\n // returns 3: [\"yellow\"]\n // test: skip-1\n\n var isInt = require('../var/is_int')\n\n var _checkToUpIndices = function (arr, ct, key) {\n // Deal with situation, e.g., if encounter index 4 and try\n // to set it to 0, but 0 exists later in loop (need to\n // increment all subsequent (skipping current key,\n // since we need its value below) until find unused)\n if (arr[ct] !== undefined) {\n var tmp = ct\n ct += 1\n if (ct === key) {\n ct += 1\n }\n ct = _checkToUpIndices(arr, ct, key)\n arr[ct] = arr[tmp]\n delete arr[tmp]\n }\n return ct\n }\n\n if (replacement && typeof replacement !== 'object') {\n replacement = [replacement]\n }\n if (lgth === undefined) {\n lgth = offst >= 0 ? arr.length - offst : -offst\n } else if (lgth < 0) {\n lgth = (offst >= 0 ? arr.length - offst : -offst) + lgth\n }\n\n if (Object.prototype.toString.call(arr) !== '[object Array]') {\n /* if (arr.length !== undefined) {\n // Deal with array-like objects as input\n delete arr.length;\n } */\n var lgt = 0\n var ct = -1\n var rmvd = []\n var rmvdObj = {}\n var replCt = -1\n var intCt = -1\n var returnArr = true\n var rmvdCt = 0\n // var rmvdLngth = 0\n var key = ''\n // rmvdObj.length = 0;\n for (key in arr) {\n // Can do arr.__count__ in some browsers\n lgt += 1\n }\n offst = (offst >= 0) ? offst : lgt + offst\n for (key in arr) {\n ct += 1\n if (ct < offst) {\n if (isInt(key)) {\n intCt += 1\n if (parseInt(key, 10) === intCt) {\n // Key is already numbered ok, so don't need to change key for value\n continue\n }\n // Deal with situation, e.g.,\n _checkToUpIndices(arr, intCt, key)\n // if encounter index 4 and try to set it to 0, but 0 exists later in loop\n arr[intCt] = arr[key]\n delete arr[key]\n }\n continue\n }\n if (returnArr && isInt(key)) {\n rmvd.push(arr[key])\n // PHP starts over here too\n rmvdObj[rmvdCt++] = arr[key]\n } else {\n rmvdObj[key] = arr[key]\n returnArr = false\n }\n // rmvdLngth += 1\n // rmvdObj.length += 1;\n if (replacement && replacement[++replCt]) {\n arr[key] = replacement[replCt]\n } else {\n delete arr[key]\n }\n }\n // Make (back) into an array-like object\n // arr.length = lgt - rmvdLngth + (replacement ? replacement.length : 0);\n return returnArr ? rmvd : rmvdObj\n }\n\n if (replacement) {\n replacement.unshift(offst, lgth)\n return Array.prototype.splice.apply(arr, replacement)\n }\n\n return arr.splice(offst, lgth)\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_sum.js b/node_modules/locutus/php/array/array_sum.js new file mode 100644 index 0000000..336688c --- /dev/null +++ b/node_modules/locutus/php/array/array_sum.js @@ -0,0 +1,37 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +module.exports = function array_sum(array) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_sum/ + // original by: Kevin van Zonneveld (http://kvz.io) + // bugfixed by: Nate + // bugfixed by: Gilbert + // improved by: David Pilia (http://www.beteck.it/) + // improved by: Brett Zamir (http://brett-zamir.me) + // example 1: array_sum([4, 9, 182.6]) + // returns 1: 195.6 + // example 2: var $total = [] + // example 2: var $index = 0.1 + // example 2: for (var $y = 0; $y < 12; $y++){ $total[$y] = $y + $index } + // example 2: array_sum($total) + // returns 2: 67.2 + + var key; + var sum = 0; + + // input sanitation + if ((typeof array === 'undefined' ? 'undefined' : _typeof(array)) !== 'object') { + return null; + } + + for (key in array) { + if (!isNaN(parseFloat(array[key]))) { + sum += parseFloat(array[key]); + } + } + + return sum; +}; +//# sourceMappingURL=array_sum.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_sum.js.map b/node_modules/locutus/php/array/array_sum.js.map new file mode 100644 index 0000000..218f22b --- /dev/null +++ b/node_modules/locutus/php/array/array_sum.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_sum.js"],"names":["module","exports","array_sum","array","key","sum","isNaN","parseFloat"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,SAAT,CAAoBC,KAApB,EAA2B;AAAE;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,GAAJ;AACA,MAAIC,MAAM,CAAV;;AAEA;AACA,MAAI,QAAOF,KAAP,yCAAOA,KAAP,OAAiB,QAArB,EAA+B;AAC7B,WAAO,IAAP;AACD;;AAED,OAAKC,GAAL,IAAYD,KAAZ,EAAmB;AACjB,QAAI,CAACG,MAAMC,WAAWJ,MAAMC,GAAN,CAAX,CAAN,CAAL,EAAoC;AAClCC,aAAOE,WAAWJ,MAAMC,GAAN,CAAX,CAAP;AACD;AACF;;AAED,SAAOC,GAAP;AACD,CA9BD","file":"array_sum.js","sourcesContent":["module.exports = function array_sum (array) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_sum/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // bugfixed by: Nate\n // bugfixed by: Gilbert\n // improved by: David Pilia (http://www.beteck.it/)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // example 1: array_sum([4, 9, 182.6])\n // returns 1: 195.6\n // example 2: var $total = []\n // example 2: var $index = 0.1\n // example 2: for (var $y = 0; $y < 12; $y++){ $total[$y] = $y + $index }\n // example 2: array_sum($total)\n // returns 2: 67.2\n\n var key\n var sum = 0\n\n // input sanitation\n if (typeof array !== 'object') {\n return null\n }\n\n for (key in array) {\n if (!isNaN(parseFloat(array[key]))) {\n sum += parseFloat(array[key])\n }\n }\n\n return sum\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_udiff.js b/node_modules/locutus/php/array/array_udiff.js new file mode 100644 index 0000000..5d7da80 --- /dev/null +++ b/node_modules/locutus/php/array/array_udiff.js @@ -0,0 +1,41 @@ +'use strict'; + +module.exports = function array_udiff(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_udiff/ + // original by: Brett Zamir (http://brett-zamir.me) + // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'} + // example 1: var $array2 = {a: 'GREEN', B: 'brown', 0: 'yellow', 1: 'red'} + // example 1: array_udiff($array1, $array2, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;}) + // returns 1: {c: 'blue'} + + var retArr = {}; + var arglm1 = arguments.length - 1; + var cb = arguments[arglm1]; + var arr = ''; + var i = 1; + var k1 = ''; + var k = ''; + + var $global = typeof window !== 'undefined' ? window : global; + + cb = typeof cb === 'string' ? $global[cb] : Object.prototype.toString.call(cb) === '[object Array]' ? $global[cb[0]][cb[1]] : cb; + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + for (i = 1; i < arglm1; i++) { + // eslint-disable-line no-labels + arr = arguments[i]; + for (k in arr) { + if (cb(arr[k], arr1[k1]) === 0) { + // If it reaches here, it was found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + retArr[k1] = arr1[k1]; + } + } + + return retArr; +}; +//# sourceMappingURL=array_udiff.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_udiff.js.map b/node_modules/locutus/php/array/array_udiff.js.map new file mode 100644 index 0000000..443c7fd --- /dev/null +++ b/node_modules/locutus/php/array/array_udiff.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_udiff.js"],"names":["module","exports","array_udiff","arr1","retArr","arglm1","arguments","length","cb","arr","i","k1","k","$global","window","global","Object","prototype","toString","call","arr1keys"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,WAAT,CAAsBC,IAAtB,EAA4B;AAAE;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,SAASC,UAAUC,MAAV,GAAmB,CAAhC;AACA,MAAIC,KAAKF,UAAUD,MAAV,CAAT;AACA,MAAII,MAAM,EAAV;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,KAAK,EAAT;AACA,MAAIC,IAAI,EAAR;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;;AAEAP,OAAM,OAAOA,EAAP,KAAc,QAAf,GACDK,QAAQL,EAAR,CADC,GAEAQ,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BX,EAA/B,MAAuC,gBAAxC,GACEK,QAAQL,GAAG,CAAH,CAAR,EAAeA,GAAG,CAAH,CAAf,CADF,GAEEA,EAJN;;AAMAY,YAAU,KAAKT,EAAL,IAAWR,IAAX,EAAiB;AAAE;AAC3B,SAAKO,IAAI,CAAT,EAAYA,IAAIL,MAAhB,EAAwBK,GAAxB,EAA6B;AAAE;AAC7BD,YAAMH,UAAUI,CAAV,CAAN;AACA,WAAKE,CAAL,IAAUH,GAAV,EAAe;AACb,YAAID,GAAGC,IAAIG,CAAJ,CAAH,EAAWT,KAAKQ,EAAL,CAAX,MAAyB,CAA7B,EAAgC;AAC9B;AACA,mBAASS,QAAT,CAF8B,CAEZ;AACnB;AACF;AACDhB,aAAOO,EAAP,IAAaR,KAAKQ,EAAL,CAAb;AACD;AACF;;AAED,SAAOP,MAAP;AACD,CAtCD","file":"array_udiff.js","sourcesContent":["module.exports = function array_udiff (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_udiff/\n // original by: Brett Zamir (http://brett-zamir.me)\n // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'}\n // example 1: var $array2 = {a: 'GREEN', B: 'brown', 0: 'yellow', 1: 'red'}\n // example 1: array_udiff($array1, $array2, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;})\n // returns 1: {c: 'blue'}\n\n var retArr = {}\n var arglm1 = arguments.length - 1\n var cb = arguments[arglm1]\n var arr = ''\n var i = 1\n var k1 = ''\n var k = ''\n\n var $global = (typeof window !== 'undefined' ? window : global)\n\n cb = (typeof cb === 'string')\n ? $global[cb]\n : (Object.prototype.toString.call(cb) === '[object Array]')\n ? $global[cb[0]][cb[1]]\n : cb\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n for (i = 1; i < arglm1; i++) { // eslint-disable-line no-labels\n arr = arguments[i]\n for (k in arr) {\n if (cb(arr[k], arr1[k1]) === 0) {\n // If it reaches here, it was found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n retArr[k1] = arr1[k1]\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_udiff_assoc.js b/node_modules/locutus/php/array/array_udiff_assoc.js new file mode 100644 index 0000000..0506af7 --- /dev/null +++ b/node_modules/locutus/php/array/array_udiff_assoc.js @@ -0,0 +1,38 @@ +'use strict'; + +module.exports = function array_udiff_assoc(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_udiff_assoc/ + // original by: Brett Zamir (http://brett-zamir.me) + // example 1: array_udiff_assoc({0: 'kevin', 1: 'van', 2: 'Zonneveld'}, {0: 'Kevin', 4: 'van', 5: 'Zonneveld'}, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;}) + // returns 1: {1: 'van', 2: 'Zonneveld'} + + var retArr = {}; + var arglm1 = arguments.length - 1; + var cb = arguments[arglm1]; + var arr = {}; + var i = 1; + var k1 = ''; + var k = ''; + + var $global = typeof window !== 'undefined' ? window : global; + + cb = typeof cb === 'string' ? $global[cb] : Object.prototype.toString.call(cb) === '[object Array]' ? $global[cb[0]][cb[1]] : cb; + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + for (i = 1; i < arglm1; i++) { + arr = arguments[i]; + for (k in arr) { + if (cb(arr[k], arr1[k1]) === 0 && k === k1) { + // If it reaches here, it was found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + retArr[k1] = arr1[k1]; + } + } + + return retArr; +}; +//# sourceMappingURL=array_udiff_assoc.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_udiff_assoc.js.map b/node_modules/locutus/php/array/array_udiff_assoc.js.map new file mode 100644 index 0000000..80c488f --- /dev/null +++ b/node_modules/locutus/php/array/array_udiff_assoc.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_udiff_assoc.js"],"names":["module","exports","array_udiff_assoc","arr1","retArr","arglm1","arguments","length","cb","arr","i","k1","k","$global","window","global","Object","prototype","toString","call","arr1keys"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,iBAAT,CAA4BC,IAA5B,EAAkC;AAAE;AACnD;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,SAASC,UAAUC,MAAV,GAAmB,CAAhC;AACA,MAAIC,KAAKF,UAAUD,MAAV,CAAT;AACA,MAAII,MAAM,EAAV;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,KAAK,EAAT;AACA,MAAIC,IAAI,EAAR;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;;AAEAP,OAAM,OAAOA,EAAP,KAAc,QAAf,GACDK,QAAQL,EAAR,CADC,GAEAQ,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BX,EAA/B,MAAuC,gBAAxC,GACEK,QAAQL,GAAG,CAAH,CAAR,EAAeA,GAAG,CAAH,CAAf,CADF,GAEEA,EAJN;;AAMAY,YAAU,KAAKT,EAAL,IAAWR,IAAX,EAAiB;AAAE;AAC3B,SAAKO,IAAI,CAAT,EAAYA,IAAIL,MAAhB,EAAwBK,GAAxB,EAA6B;AAC3BD,YAAMH,UAAUI,CAAV,CAAN;AACA,WAAKE,CAAL,IAAUH,GAAV,EAAe;AACb,YAAID,GAAGC,IAAIG,CAAJ,CAAH,EAAWT,KAAKQ,EAAL,CAAX,MAAyB,CAAzB,IAA8BC,MAAMD,EAAxC,EAA4C;AAC1C;AACA,mBAASS,QAAT,CAF0C,CAExB;AACnB;AACF;AACDhB,aAAOO,EAAP,IAAaR,KAAKQ,EAAL,CAAb;AACD;AACF;;AAED,SAAOP,MAAP;AACD,CApCD","file":"array_udiff_assoc.js","sourcesContent":["module.exports = function array_udiff_assoc (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_udiff_assoc/\n // original by: Brett Zamir (http://brett-zamir.me)\n // example 1: array_udiff_assoc({0: 'kevin', 1: 'van', 2: 'Zonneveld'}, {0: 'Kevin', 4: 'van', 5: 'Zonneveld'}, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;})\n // returns 1: {1: 'van', 2: 'Zonneveld'}\n\n var retArr = {}\n var arglm1 = arguments.length - 1\n var cb = arguments[arglm1]\n var arr = {}\n var i = 1\n var k1 = ''\n var k = ''\n\n var $global = (typeof window !== 'undefined' ? window : global)\n\n cb = (typeof cb === 'string')\n ? $global[cb]\n : (Object.prototype.toString.call(cb) === '[object Array]')\n ? $global[cb[0]][cb[1]]\n : cb\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n for (i = 1; i < arglm1; i++) {\n arr = arguments[i]\n for (k in arr) {\n if (cb(arr[k], arr1[k1]) === 0 && k === k1) {\n // If it reaches here, it was found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n retArr[k1] = arr1[k1]\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_udiff_uassoc.js b/node_modules/locutus/php/array/array_udiff_uassoc.js new file mode 100644 index 0000000..5706197 --- /dev/null +++ b/node_modules/locutus/php/array/array_udiff_uassoc.js @@ -0,0 +1,44 @@ +'use strict'; + +module.exports = function array_udiff_uassoc(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_udiff_uassoc/ + // original by: Brett Zamir (http://brett-zamir.me) + // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'} + // example 1: var $array2 = {a: 'GREEN', B: 'brown', 0: 'yellow', 1: 'red'} + // example 1: array_udiff_uassoc($array1, $array2, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;}, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;}) + // returns 1: {0: 'red', c: 'blue'} + + var retArr = {}; + var arglm1 = arguments.length - 1; + var arglm2 = arglm1 - 1; + var cb = arguments[arglm1]; + var cb0 = arguments[arglm2]; + var k1 = ''; + var i = 1; + var k = ''; + var arr = {}; + + var $global = typeof window !== 'undefined' ? window : global; + + cb = typeof cb === 'string' ? $global[cb] : Object.prototype.toString.call(cb) === '[object Array]' ? $global[cb[0]][cb[1]] : cb; + + cb0 = typeof cb0 === 'string' ? $global[cb0] : Object.prototype.toString.call(cb0) === '[object Array]' ? $global[cb0[0]][cb0[1]] : cb0; + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + for (i = 1; i < arglm2; i++) { + arr = arguments[i]; + for (k in arr) { + if (cb0(arr[k], arr1[k1]) === 0 && cb(k, k1) === 0) { + // If it reaches here, it was found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + retArr[k1] = arr1[k1]; + } + } + + return retArr; +}; +//# sourceMappingURL=array_udiff_uassoc.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_udiff_uassoc.js.map b/node_modules/locutus/php/array/array_udiff_uassoc.js.map new file mode 100644 index 0000000..8cf93e4 --- /dev/null +++ b/node_modules/locutus/php/array/array_udiff_uassoc.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_udiff_uassoc.js"],"names":["module","exports","array_udiff_uassoc","arr1","retArr","arglm1","arguments","length","arglm2","cb","cb0","k1","i","k","arr","$global","window","global","Object","prototype","toString","call","arr1keys"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,kBAAT,CAA6BC,IAA7B,EAAmC;AAAE;AACpD;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,SAASC,UAAUC,MAAV,GAAmB,CAAhC;AACA,MAAIC,SAASH,SAAS,CAAtB;AACA,MAAII,KAAKH,UAAUD,MAAV,CAAT;AACA,MAAIK,MAAMJ,UAAUE,MAAV,CAAV;AACA,MAAIG,KAAK,EAAT;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,MAAM,EAAV;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;;AAEAR,OAAM,OAAOA,EAAP,KAAc,QAAf,GACDM,QAAQN,EAAR,CADC,GAEAS,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BZ,EAA/B,MAAuC,gBAAxC,GACEM,QAAQN,GAAG,CAAH,CAAR,EAAeA,GAAG,CAAH,CAAf,CADF,GAEEA,EAJN;;AAMAC,QAAO,OAAOA,GAAP,KAAe,QAAhB,GACFK,QAAQL,GAAR,CADE,GAEDQ,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BX,GAA/B,MAAwC,gBAAzC,GACEK,QAAQL,IAAI,CAAJ,CAAR,EAAgBA,IAAI,CAAJ,CAAhB,CADF,GAEEA,GAJN;;AAMAY,YAAU,KAAKX,EAAL,IAAWR,IAAX,EAAiB;AAAE;AAC3B,SAAKS,IAAI,CAAT,EAAYA,IAAIJ,MAAhB,EAAwBI,GAAxB,EAA6B;AAC3BE,YAAMR,UAAUM,CAAV,CAAN;AACA,WAAKC,CAAL,IAAUC,GAAV,EAAe;AACb,YAAIJ,IAAII,IAAID,CAAJ,CAAJ,EAAYV,KAAKQ,EAAL,CAAZ,MAA0B,CAA1B,IAA+BF,GAAGI,CAAH,EAAMF,EAAN,MAAc,CAAjD,EAAoD;AAClD;AACA,mBAASW,QAAT,CAFkD,CAEhC;AACnB;AACF;AACDlB,aAAOO,EAAP,IAAaR,KAAKQ,EAAL,CAAb;AACD;AACF;;AAED,SAAOP,MAAP;AACD,CA9CD","file":"array_udiff_uassoc.js","sourcesContent":["module.exports = function array_udiff_uassoc (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_udiff_uassoc/\n // original by: Brett Zamir (http://brett-zamir.me)\n // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'}\n // example 1: var $array2 = {a: 'GREEN', B: 'brown', 0: 'yellow', 1: 'red'}\n // example 1: array_udiff_uassoc($array1, $array2, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;}, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;})\n // returns 1: {0: 'red', c: 'blue'}\n\n var retArr = {}\n var arglm1 = arguments.length - 1\n var arglm2 = arglm1 - 1\n var cb = arguments[arglm1]\n var cb0 = arguments[arglm2]\n var k1 = ''\n var i = 1\n var k = ''\n var arr = {}\n\n var $global = (typeof window !== 'undefined' ? window : global)\n\n cb = (typeof cb === 'string')\n ? $global[cb]\n : (Object.prototype.toString.call(cb) === '[object Array]')\n ? $global[cb[0]][cb[1]]\n : cb\n\n cb0 = (typeof cb0 === 'string')\n ? $global[cb0]\n : (Object.prototype.toString.call(cb0) === '[object Array]')\n ? $global[cb0[0]][cb0[1]]\n : cb0\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n for (i = 1; i < arglm2; i++) {\n arr = arguments[i]\n for (k in arr) {\n if (cb0(arr[k], arr1[k1]) === 0 && cb(k, k1) === 0) {\n // If it reaches here, it was found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n retArr[k1] = arr1[k1]\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_uintersect.js b/node_modules/locutus/php/array/array_uintersect.js new file mode 100644 index 0000000..6fc9b28 --- /dev/null +++ b/node_modules/locutus/php/array/array_uintersect.js @@ -0,0 +1,48 @@ +'use strict'; + +module.exports = function array_uintersect(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_uintersect/ + // original by: Brett Zamir (http://brett-zamir.me) + // bugfixed by: Demosthenes Koptsis + // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'} + // example 1: var $array2 = {a: 'GREEN', B: 'brown', 0: 'yellow', 1: 'red'} + // example 1: array_uintersect($array1, $array2, function( f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;}) + // returns 1: {a: 'green', b: 'brown', 0: 'red'} + + var retArr = {}; + var arglm1 = arguments.length - 1; + var arglm2 = arglm1 - 1; + var cb = arguments[arglm1]; + var k1 = ''; + var i = 1; + var arr = {}; + var k = ''; + + var $global = typeof window !== 'undefined' ? window : global; + + cb = typeof cb === 'string' ? $global[cb] : Object.prototype.toString.call(cb) === '[object Array]' ? $global[cb[0]][cb[1]] : cb; + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + arrs: for (i = 1; i < arglm1; i++) { + // eslint-disable-line no-labels + arr = arguments[i]; + for (k in arr) { + if (cb(arr[k], arr1[k1]) === 0) { + if (i === arglm2) { + retArr[k1] = arr1[k1]; + } + // If the innermost loop always leads at least once to an equal value, + // continue the loop until done + continue arrs; // eslint-disable-line no-labels + } + } + // If it reaches here, it wasn't found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + + return retArr; +}; +//# sourceMappingURL=array_uintersect.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_uintersect.js.map b/node_modules/locutus/php/array/array_uintersect.js.map new file mode 100644 index 0000000..091615e --- /dev/null +++ b/node_modules/locutus/php/array/array_uintersect.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_uintersect.js"],"names":["module","exports","array_uintersect","arr1","retArr","arglm1","arguments","length","arglm2","cb","k1","i","arr","k","$global","window","global","Object","prototype","toString","call","arr1keys","arrs"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,gBAAT,CAA2BC,IAA3B,EAAiC;AAAE;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,SAASC,UAAUC,MAAV,GAAmB,CAAhC;AACA,MAAIC,SAASH,SAAS,CAAtB;AACA,MAAII,KAAKH,UAAUD,MAAV,CAAT;AACA,MAAIK,KAAK,EAAT;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,MAAM,EAAV;AACA,MAAIC,IAAI,EAAR;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;;AAEAP,OAAM,OAAOA,EAAP,KAAc,QAAf,GACDK,QAAQL,EAAR,CADC,GAEAQ,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BX,EAA/B,MAAuC,gBAAxC,GACEK,QAAQL,GAAG,CAAH,CAAR,EAAeA,GAAG,CAAH,CAAf,CADF,GAEEA,EAJN;;AAMAY,YAAU,KAAKX,EAAL,IAAWP,IAAX,EAAiB;AAAE;AAC3BmB,UAAM,KAAKX,IAAI,CAAT,EAAYA,IAAIN,MAAhB,EAAwBM,GAAxB,EAA6B;AAAE;AACnCC,YAAMN,UAAUK,CAAV,CAAN;AACA,WAAKE,CAAL,IAAUD,GAAV,EAAe;AACb,YAAIH,GAAGG,IAAIC,CAAJ,CAAH,EAAWV,KAAKO,EAAL,CAAX,MAAyB,CAA7B,EAAgC;AAC9B,cAAIC,MAAMH,MAAV,EAAkB;AAChBJ,mBAAOM,EAAP,IAAaP,KAAKO,EAAL,CAAb;AACD;AACD;AACA;AACA,mBAASY,IAAT,CAN8B,CAMhB;AACf;AACF;AACD;AACA,eAASD,QAAT,CAbiC,CAaf;AACnB;AACF;;AAED,SAAOjB,MAAP;AACD,CA7CD","file":"array_uintersect.js","sourcesContent":["module.exports = function array_uintersect (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_uintersect/\n // original by: Brett Zamir (http://brett-zamir.me)\n // bugfixed by: Demosthenes Koptsis\n // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'}\n // example 1: var $array2 = {a: 'GREEN', B: 'brown', 0: 'yellow', 1: 'red'}\n // example 1: array_uintersect($array1, $array2, function( f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;})\n // returns 1: {a: 'green', b: 'brown', 0: 'red'}\n\n var retArr = {}\n var arglm1 = arguments.length - 1\n var arglm2 = arglm1 - 1\n var cb = arguments[arglm1]\n var k1 = ''\n var i = 1\n var arr = {}\n var k = ''\n\n var $global = (typeof window !== 'undefined' ? window : global)\n\n cb = (typeof cb === 'string')\n ? $global[cb]\n : (Object.prototype.toString.call(cb) === '[object Array]')\n ? $global[cb[0]][cb[1]]\n : cb\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n arrs: for (i = 1; i < arglm1; i++) { // eslint-disable-line no-labels\n arr = arguments[i]\n for (k in arr) {\n if (cb(arr[k], arr1[k1]) === 0) {\n if (i === arglm2) {\n retArr[k1] = arr1[k1]\n }\n // If the innermost loop always leads at least once to an equal value,\n // continue the loop until done\n continue arrs // eslint-disable-line no-labels\n }\n }\n // If it reaches here, it wasn't found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_uintersect_uassoc.js b/node_modules/locutus/php/array/array_uintersect_uassoc.js new file mode 100644 index 0000000..63581a9 --- /dev/null +++ b/node_modules/locutus/php/array/array_uintersect_uassoc.js @@ -0,0 +1,50 @@ +'use strict'; + +module.exports = function array_uintersect_uassoc(arr1) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_uintersect_uassoc/ + // original by: Brett Zamir (http://brett-zamir.me) + // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'} + // example 1: var $array2 = {a: 'GREEN', B: 'brown', 0: 'yellow', 1: 'red'} + // example 1: array_uintersect_uassoc($array1, $array2, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;}, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;}) + // returns 1: {a: 'green', b: 'brown'} + + var retArr = {}; + var arglm1 = arguments.length - 1; + var arglm2 = arglm1 - 1; + var cb = arguments[arglm1]; + var cb0 = arguments[arglm2]; + var k1 = ''; + var i = 1; + var k = ''; + var arr = {}; + + var $global = typeof window !== 'undefined' ? window : global; + + cb = typeof cb === 'string' ? $global[cb] : Object.prototype.toString.call(cb) === '[object Array]' ? $global[cb[0]][cb[1]] : cb; + + cb0 = typeof cb0 === 'string' ? $global[cb0] : Object.prototype.toString.call(cb0) === '[object Array]' ? $global[cb0[0]][cb0[1]] : cb0; + + arr1keys: for (k1 in arr1) { + // eslint-disable-line no-labels + arrs: for (i = 1; i < arglm2; i++) { + // eslint-disable-line no-labels + arr = arguments[i]; + for (k in arr) { + if (cb0(arr[k], arr1[k1]) === 0 && cb(k, k1) === 0) { + if (i === arguments.length - 3) { + retArr[k1] = arr1[k1]; + } + // If the innermost loop always leads at least once to an equal value, + // continue the loop until done + continue arrs; // eslint-disable-line no-labels + } + } + // If it reaches here, it wasn't found in at least one array, so try next value + continue arr1keys; // eslint-disable-line no-labels + } + } + + return retArr; +}; +//# sourceMappingURL=array_uintersect_uassoc.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_uintersect_uassoc.js.map b/node_modules/locutus/php/array/array_uintersect_uassoc.js.map new file mode 100644 index 0000000..7e6d068 --- /dev/null +++ b/node_modules/locutus/php/array/array_uintersect_uassoc.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_uintersect_uassoc.js"],"names":["module","exports","array_uintersect_uassoc","arr1","retArr","arglm1","arguments","length","arglm2","cb","cb0","k1","i","k","arr","$global","window","global","Object","prototype","toString","call","arr1keys","arrs"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,uBAAT,CAAkCC,IAAlC,EAAwC;AAAE;AACzD;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,SAASC,UAAUC,MAAV,GAAmB,CAAhC;AACA,MAAIC,SAASH,SAAS,CAAtB;AACA,MAAII,KAAKH,UAAUD,MAAV,CAAT;AACA,MAAIK,MAAMJ,UAAUE,MAAV,CAAV;AACA,MAAIG,KAAK,EAAT;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,MAAM,EAAV;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;;AAEAR,OAAM,OAAOA,EAAP,KAAc,QAAf,GACDM,QAAQN,EAAR,CADC,GAEAS,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BZ,EAA/B,MAAuC,gBAAxC,GACEM,QAAQN,GAAG,CAAH,CAAR,EAAeA,GAAG,CAAH,CAAf,CADF,GAEEA,EAJN;;AAMAC,QAAO,OAAOA,GAAP,KAAe,QAAhB,GACFK,QAAQL,GAAR,CADE,GAEDQ,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BX,GAA/B,MAAwC,gBAAzC,GACEK,QAAQL,IAAI,CAAJ,CAAR,EAAgBA,IAAI,CAAJ,CAAhB,CADF,GAEEA,GAJN;;AAMAY,YAAU,KAAKX,EAAL,IAAWR,IAAX,EAAiB;AAAE;AAC3BoB,UAAM,KAAKX,IAAI,CAAT,EAAYA,IAAIJ,MAAhB,EAAwBI,GAAxB,EAA6B;AAAE;AACnCE,YAAMR,UAAUM,CAAV,CAAN;AACA,WAAKC,CAAL,IAAUC,GAAV,EAAe;AACb,YAAIJ,IAAII,IAAID,CAAJ,CAAJ,EAAYV,KAAKQ,EAAL,CAAZ,MAA0B,CAA1B,IAA+BF,GAAGI,CAAH,EAAMF,EAAN,MAAc,CAAjD,EAAoD;AAClD,cAAIC,MAAMN,UAAUC,MAAV,GAAmB,CAA7B,EAAgC;AAC9BH,mBAAOO,EAAP,IAAaR,KAAKQ,EAAL,CAAb;AACD;AACD;AACA;AACA,mBAASY,IAAT,CANkD,CAMpC;AACf;AACF;AACD;AACA,eAASD,QAAT,CAbiC,CAaf;AACnB;AACF;;AAED,SAAOlB,MAAP;AACD,CAnDD","file":"array_uintersect_uassoc.js","sourcesContent":["module.exports = function array_uintersect_uassoc (arr1) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_uintersect_uassoc/\n // original by: Brett Zamir (http://brett-zamir.me)\n // example 1: var $array1 = {a: 'green', b: 'brown', c: 'blue', 0: 'red'}\n // example 1: var $array2 = {a: 'GREEN', B: 'brown', 0: 'yellow', 1: 'red'}\n // example 1: array_uintersect_uassoc($array1, $array2, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;}, function (f_string1, f_string2){var string1 = (f_string1+'').toLowerCase(); var string2 = (f_string2+'').toLowerCase(); if (string1 > string2) return 1; if (string1 === string2) return 0; return -1;})\n // returns 1: {a: 'green', b: 'brown'}\n\n var retArr = {}\n var arglm1 = arguments.length - 1\n var arglm2 = arglm1 - 1\n var cb = arguments[arglm1]\n var cb0 = arguments[arglm2]\n var k1 = ''\n var i = 1\n var k = ''\n var arr = {}\n\n var $global = (typeof window !== 'undefined' ? window : global)\n\n cb = (typeof cb === 'string')\n ? $global[cb]\n : (Object.prototype.toString.call(cb) === '[object Array]')\n ? $global[cb[0]][cb[1]]\n : cb\n\n cb0 = (typeof cb0 === 'string')\n ? $global[cb0]\n : (Object.prototype.toString.call(cb0) === '[object Array]')\n ? $global[cb0[0]][cb0[1]]\n : cb0\n\n arr1keys: for (k1 in arr1) { // eslint-disable-line no-labels\n arrs: for (i = 1; i < arglm2; i++) { // eslint-disable-line no-labels\n arr = arguments[i]\n for (k in arr) {\n if (cb0(arr[k], arr1[k1]) === 0 && cb(k, k1) === 0) {\n if (i === arguments.length - 3) {\n retArr[k1] = arr1[k1]\n }\n // If the innermost loop always leads at least once to an equal value,\n // continue the loop until done\n continue arrs // eslint-disable-line no-labels\n }\n }\n // If it reaches here, it wasn't found in at least one array, so try next value\n continue arr1keys // eslint-disable-line no-labels\n }\n }\n\n return retArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_unique.js b/node_modules/locutus/php/array/array_unique.js new file mode 100644 index 0000000..0e8faa1 --- /dev/null +++ b/node_modules/locutus/php/array/array_unique.js @@ -0,0 +1,48 @@ +'use strict'; + +module.exports = function array_unique(inputArr) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_unique/ + // original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com) + // input by: duncan + // input by: Brett Zamir (http://brett-zamir.me) + // bugfixed by: Kevin van Zonneveld (http://kvz.io) + // bugfixed by: Nate + // bugfixed by: Kevin van Zonneveld (http://kvz.io) + // bugfixed by: Brett Zamir (http://brett-zamir.me) + // improved by: Michael Grier + // note 1: The second argument, sort_flags is not implemented; + // note 1: also should be sorted (asort?) first according to docs + // example 1: array_unique(['Kevin','Kevin','van','Zonneveld','Kevin']) + // returns 1: {0: 'Kevin', 2: 'van', 3: 'Zonneveld'} + // example 2: array_unique({'a': 'green', 0: 'red', 'b': 'green', 1: 'blue', 2: 'red'}) + // returns 2: {a: 'green', 0: 'red', 1: 'blue'} + + var key = ''; + var tmpArr2 = {}; + var val = ''; + + var _arraySearch = function _arraySearch(needle, haystack) { + var fkey = ''; + for (fkey in haystack) { + if (haystack.hasOwnProperty(fkey)) { + if (haystack[fkey] + '' === needle + '') { + return fkey; + } + } + } + return false; + }; + + for (key in inputArr) { + if (inputArr.hasOwnProperty(key)) { + val = inputArr[key]; + if (_arraySearch(val, tmpArr2) === false) { + tmpArr2[key] = val; + } + } + } + + return tmpArr2; +}; +//# sourceMappingURL=array_unique.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_unique.js.map b/node_modules/locutus/php/array/array_unique.js.map new file mode 100644 index 0000000..818449f --- /dev/null +++ b/node_modules/locutus/php/array/array_unique.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_unique.js"],"names":["module","exports","array_unique","inputArr","key","tmpArr2","val","_arraySearch","needle","haystack","fkey","hasOwnProperty"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,YAAT,CAAuBC,QAAvB,EAAiC;AAAE;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,MAAM,EAAV;AACA,MAAIC,UAAU,EAAd;AACA,MAAIC,MAAM,EAAV;;AAEA,MAAIC,eAAe,SAAfA,YAAe,CAAUC,MAAV,EAAkBC,QAAlB,EAA4B;AAC7C,QAAIC,OAAO,EAAX;AACA,SAAKA,IAAL,IAAaD,QAAb,EAAuB;AACrB,UAAIA,SAASE,cAAT,CAAwBD,IAAxB,CAAJ,EAAmC;AACjC,YAAKD,SAASC,IAAT,IAAiB,EAAlB,KAA2BF,SAAS,EAAxC,EAA6C;AAC3C,iBAAOE,IAAP;AACD;AACF;AACF;AACD,WAAO,KAAP;AACD,GAVD;;AAYA,OAAKN,GAAL,IAAYD,QAAZ,EAAsB;AACpB,QAAIA,SAASQ,cAAT,CAAwBP,GAAxB,CAAJ,EAAkC;AAChCE,YAAMH,SAASC,GAAT,CAAN;AACA,UAAIG,aAAaD,GAAb,EAAkBD,OAAlB,MAA+B,KAAnC,EAA0C;AACxCA,gBAAQD,GAAR,IAAeE,GAAf;AACD;AACF;AACF;;AAED,SAAOD,OAAP;AACD,CA3CD","file":"array_unique.js","sourcesContent":["module.exports = function array_unique (inputArr) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_unique/\n // original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com)\n // input by: duncan\n // input by: Brett Zamir (http://brett-zamir.me)\n // bugfixed by: Kevin van Zonneveld (http://kvz.io)\n // bugfixed by: Nate\n // bugfixed by: Kevin van Zonneveld (http://kvz.io)\n // bugfixed by: Brett Zamir (http://brett-zamir.me)\n // improved by: Michael Grier\n // note 1: The second argument, sort_flags is not implemented;\n // note 1: also should be sorted (asort?) first according to docs\n // example 1: array_unique(['Kevin','Kevin','van','Zonneveld','Kevin'])\n // returns 1: {0: 'Kevin', 2: 'van', 3: 'Zonneveld'}\n // example 2: array_unique({'a': 'green', 0: 'red', 'b': 'green', 1: 'blue', 2: 'red'})\n // returns 2: {a: 'green', 0: 'red', 1: 'blue'}\n\n var key = ''\n var tmpArr2 = {}\n var val = ''\n\n var _arraySearch = function (needle, haystack) {\n var fkey = ''\n for (fkey in haystack) {\n if (haystack.hasOwnProperty(fkey)) {\n if ((haystack[fkey] + '') === (needle + '')) {\n return fkey\n }\n }\n }\n return false\n }\n\n for (key in inputArr) {\n if (inputArr.hasOwnProperty(key)) {\n val = inputArr[key]\n if (_arraySearch(val, tmpArr2) === false) {\n tmpArr2[key] = val\n }\n }\n }\n\n return tmpArr2\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_unshift.js b/node_modules/locutus/php/array/array_unshift.js new file mode 100644 index 0000000..251bd7a --- /dev/null +++ b/node_modules/locutus/php/array/array_unshift.js @@ -0,0 +1,21 @@ +"use strict"; + +module.exports = function array_unshift(array) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_unshift/ + // original by: Kevin van Zonneveld (http://kvz.io) + // improved by: Martijn Wieringa + // improved by: jmweb + // note 1: Currently does not handle objects + // example 1: array_unshift(['van', 'Zonneveld'], 'Kevin') + // returns 1: 3 + + var i = arguments.length; + + while (--i !== 0) { + arguments[0].unshift(arguments[i]); + } + + return arguments[0].length; +}; +//# sourceMappingURL=array_unshift.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_unshift.js.map b/node_modules/locutus/php/array/array_unshift.js.map new file mode 100644 index 0000000..40fce00 --- /dev/null +++ b/node_modules/locutus/php/array/array_unshift.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_unshift.js"],"names":["module","exports","array_unshift","array","i","arguments","length","unshift"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,aAAT,CAAwBC,KAAxB,EAA+B;AAAE;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,IAAIC,UAAUC,MAAlB;;AAEA,SAAO,EAAEF,CAAF,KAAQ,CAAf,EAAkB;AAChBC,cAAU,CAAV,EAAaE,OAAb,CAAqBF,UAAUD,CAAV,CAArB;AACD;;AAED,SAAOC,UAAU,CAAV,EAAaC,MAApB;AACD,CAhBD","file":"array_unshift.js","sourcesContent":["module.exports = function array_unshift (array) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_unshift/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Martijn Wieringa\n // improved by: jmweb\n // note 1: Currently does not handle objects\n // example 1: array_unshift(['van', 'Zonneveld'], 'Kevin')\n // returns 1: 3\n\n var i = arguments.length\n\n while (--i !== 0) {\n arguments[0].unshift(arguments[i])\n }\n\n return arguments[0].length\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_values.js b/node_modules/locutus/php/array/array_values.js new file mode 100644 index 0000000..119cd0d --- /dev/null +++ b/node_modules/locutus/php/array/array_values.js @@ -0,0 +1,20 @@ +'use strict'; + +module.exports = function array_values(input) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_values/ + // original by: Kevin van Zonneveld (http://kvz.io) + // improved by: Brett Zamir (http://brett-zamir.me) + // example 1: array_values( {firstname: 'Kevin', surname: 'van Zonneveld'} ) + // returns 1: [ 'Kevin', 'van Zonneveld' ] + + var tmpArr = []; + var key = ''; + + for (key in input) { + tmpArr[tmpArr.length] = input[key]; + } + + return tmpArr; +}; +//# sourceMappingURL=array_values.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_values.js.map b/node_modules/locutus/php/array/array_values.js.map new file mode 100644 index 0000000..cd36e14 --- /dev/null +++ b/node_modules/locutus/php/array/array_values.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_values.js"],"names":["module","exports","array_values","input","tmpArr","key","length"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,YAAT,CAAuBC,KAAvB,EAA8B;AAAE;AAC/C;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,MAAM,EAAV;;AAEA,OAAKA,GAAL,IAAYF,KAAZ,EAAmB;AACjBC,WAAOA,OAAOE,MAAd,IAAwBH,MAAME,GAAN,CAAxB;AACD;;AAED,SAAOD,MAAP;AACD,CAfD","file":"array_values.js","sourcesContent":["module.exports = function array_values (input) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_values/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // example 1: array_values( {firstname: 'Kevin', surname: 'van Zonneveld'} )\n // returns 1: [ 'Kevin', 'van Zonneveld' ]\n\n var tmpArr = []\n var key = ''\n\n for (key in input) {\n tmpArr[tmpArr.length] = input[key]\n }\n\n return tmpArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_walk.js b/node_modules/locutus/php/array/array_walk.js new file mode 100644 index 0000000..f193479 --- /dev/null +++ b/node_modules/locutus/php/array/array_walk.js @@ -0,0 +1,41 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +module.exports = function array_walk(array, funcname, userdata) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/array_walk/ + // original by: Johnny Mast (http://www.phpvrouwen.nl) + // bugfixed by: David + // improved by: Brett Zamir (http://brett-zamir.me) + // note 1: Only works with user-defined functions, not built-in functions like void() + // example 1: array_walk ([3, 4], function () {}, 'userdata') + // returns 1: true + // example 2: array_walk ('mystring', function () {}) + // returns 2: false + // example 3: array_walk ({"title":"my title"}, function () {}) + // returns 3: true + + if (!array || (typeof array === 'undefined' ? 'undefined' : _typeof(array)) !== 'object') { + return false; + } + + try { + if (typeof funcname === 'function') { + for (var key in array) { + if (arguments.length > 2) { + funcname(array[key], key, userdata); + } else { + funcname(array[key], key); + } + } + } else { + return false; + } + } catch (e) { + return false; + } + + return true; +}; +//# sourceMappingURL=array_walk.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_walk.js.map b/node_modules/locutus/php/array/array_walk.js.map new file mode 100644 index 0000000..a69b1a7 --- /dev/null +++ b/node_modules/locutus/php/array/array_walk.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_walk.js"],"names":["module","exports","array_walk","array","funcname","userdata","key","arguments","length","e"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,UAAT,CAAqBC,KAArB,EAA4BC,QAA5B,EAAsCC,QAAtC,EAAgD;AAAE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAI,CAACF,KAAD,IAAU,QAAOA,KAAP,yCAAOA,KAAP,OAAiB,QAA/B,EAAyC;AACvC,WAAO,KAAP;AACD;;AAED,MAAI;AACF,QAAI,OAAOC,QAAP,KAAoB,UAAxB,EAAoC;AAClC,WAAK,IAAIE,GAAT,IAAgBH,KAAhB,EAAuB;AACrB,YAAII,UAAUC,MAAV,GAAmB,CAAvB,EAA0B;AACxBJ,mBAASD,MAAMG,GAAN,CAAT,EAAqBA,GAArB,EAA0BD,QAA1B;AACD,SAFD,MAEO;AACLD,mBAASD,MAAMG,GAAN,CAAT,EAAqBA,GAArB;AACD;AACF;AACF,KARD,MAQO;AACL,aAAO,KAAP;AACD;AACF,GAZD,CAYE,OAAOG,CAAP,EAAU;AACV,WAAO,KAAP;AACD;;AAED,SAAO,IAAP;AACD,CAlCD","file":"array_walk.js","sourcesContent":["module.exports = function array_walk (array, funcname, userdata) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/array_walk/\n // original by: Johnny Mast (http://www.phpvrouwen.nl)\n // bugfixed by: David\n // improved by: Brett Zamir (http://brett-zamir.me)\n // note 1: Only works with user-defined functions, not built-in functions like void()\n // example 1: array_walk ([3, 4], function () {}, 'userdata')\n // returns 1: true\n // example 2: array_walk ('mystring', function () {})\n // returns 2: false\n // example 3: array_walk ({\"title\":\"my title\"}, function () {})\n // returns 3: true\n\n if (!array || typeof array !== 'object') {\n return false\n }\n\n try {\n if (typeof funcname === 'function') {\n for (var key in array) {\n if (arguments.length > 2) {\n funcname(array[key], key, userdata)\n } else {\n funcname(array[key], key)\n }\n }\n } else {\n return false\n }\n } catch (e) {\n return false\n }\n\n return true\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_walk_recursive.js b/node_modules/locutus/php/array/array_walk_recursive.js new file mode 100644 index 0000000..c4d3090 --- /dev/null +++ b/node_modules/locutus/php/array/array_walk_recursive.js @@ -0,0 +1,49 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +module.exports = function array_walk_recursive(array, funcname, userdata) { + // eslint-disable-line camelcase + // original by: Hugues Peccatte + // note 1: Only works with user-defined functions, not built-in functions like void() + // example 1: array_walk_recursive([3, 4], function () {}, 'userdata') + // returns 1: true + // example 2: array_walk_recursive([3, [4]], function () {}, 'userdata') + // returns 2: true + // example 3: array_walk_recursive([3, []], function () {}, 'userdata') + // returns 3: true + + if (!array || (typeof array === 'undefined' ? 'undefined' : _typeof(array)) !== 'object') { + return false; + } + + if (typeof funcname !== 'function') { + return false; + } + + for (var key in array) { + // apply "funcname" recursively only on arrays + if (Object.prototype.toString.call(array[key]) === '[object Array]') { + var funcArgs = [array[key], funcname]; + if (arguments.length > 2) { + funcArgs.push(userdata); + } + if (array_walk_recursive.apply(null, funcArgs) === false) { + return false; + } + continue; + } + try { + if (arguments.length > 2) { + funcname(array[key], key, userdata); + } else { + funcname(array[key], key); + } + } catch (e) { + return false; + } + } + + return true; +}; +//# sourceMappingURL=array_walk_recursive.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/array_walk_recursive.js.map b/node_modules/locutus/php/array/array_walk_recursive.js.map new file mode 100644 index 0000000..8c46fe1 --- /dev/null +++ b/node_modules/locutus/php/array/array_walk_recursive.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/array_walk_recursive.js"],"names":["module","exports","array_walk_recursive","array","funcname","userdata","key","Object","prototype","toString","call","funcArgs","arguments","length","push","apply","e"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,oBAAT,CAA+BC,KAA/B,EAAsCC,QAAtC,EAAgDC,QAAhD,EAA0D;AAAE;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAI,CAACF,KAAD,IAAU,QAAOA,KAAP,yCAAOA,KAAP,OAAiB,QAA/B,EAAyC;AACvC,WAAO,KAAP;AACD;;AAED,MAAI,OAAOC,QAAP,KAAoB,UAAxB,EAAoC;AAClC,WAAO,KAAP;AACD;;AAED,OAAK,IAAIE,GAAT,IAAgBH,KAAhB,EAAuB;AACrB;AACA,QAAII,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BP,MAAMG,GAAN,CAA/B,MAA+C,gBAAnD,EAAqE;AACnE,UAAIK,WAAW,CAACR,MAAMG,GAAN,CAAD,EAAaF,QAAb,CAAf;AACA,UAAIQ,UAAUC,MAAV,GAAmB,CAAvB,EAA0B;AACxBF,iBAASG,IAAT,CAAcT,QAAd;AACD;AACD,UAAIH,qBAAqBa,KAArB,CAA2B,IAA3B,EAAiCJ,QAAjC,MAA+C,KAAnD,EAA0D;AACxD,eAAO,KAAP;AACD;AACD;AACD;AACD,QAAI;AACF,UAAIC,UAAUC,MAAV,GAAmB,CAAvB,EAA0B;AACxBT,iBAASD,MAAMG,GAAN,CAAT,EAAqBA,GAArB,EAA0BD,QAA1B;AACD,OAFD,MAEO;AACLD,iBAASD,MAAMG,GAAN,CAAT,EAAqBA,GAArB;AACD;AACF,KAND,CAME,OAAOU,CAAP,EAAU;AACV,aAAO,KAAP;AACD;AACF;;AAED,SAAO,IAAP;AACD,CA1CD","file":"array_walk_recursive.js","sourcesContent":["module.exports = function array_walk_recursive (array, funcname, userdata) { // eslint-disable-line camelcase\n // original by: Hugues Peccatte\n // note 1: Only works with user-defined functions, not built-in functions like void()\n // example 1: array_walk_recursive([3, 4], function () {}, 'userdata')\n // returns 1: true\n // example 2: array_walk_recursive([3, [4]], function () {}, 'userdata')\n // returns 2: true\n // example 3: array_walk_recursive([3, []], function () {}, 'userdata')\n // returns 3: true\n\n if (!array || typeof array !== 'object') {\n return false\n }\n\n if (typeof funcname !== 'function') {\n return false\n }\n\n for (var key in array) {\n // apply \"funcname\" recursively only on arrays\n if (Object.prototype.toString.call(array[key]) === '[object Array]') {\n var funcArgs = [array[key], funcname]\n if (arguments.length > 2) {\n funcArgs.push(userdata)\n }\n if (array_walk_recursive.apply(null, funcArgs) === false) {\n return false\n }\n continue\n }\n try {\n if (arguments.length > 2) {\n funcname(array[key], key, userdata)\n } else {\n funcname(array[key], key)\n }\n } catch (e) {\n return false\n }\n }\n\n return true\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/arsort.js b/node_modules/locutus/php/array/arsort.js new file mode 100644 index 0000000..66ab91e --- /dev/null +++ b/node_modules/locutus/php/array/arsort.js @@ -0,0 +1,121 @@ +'use strict'; + +module.exports = function arsort(inputArr, sortFlags) { + // discuss at: http://locutus.io/php/arsort/ + // original by: Brett Zamir (http://brett-zamir.me) + // improved by: Brett Zamir (http://brett-zamir.me) + // improved by: Theriault (https://github.com/Theriault) + // note 1: SORT_STRING (as well as natsort and natcasesort) might also be + // note 1: integrated into all of these functions by adapting the code at + // note 1: http://sourcefrog.net/projects/natsort/natcompare.js + // note 1: The examples are correct, this is a new way + // note 1: Credits to: http://javascript.internet.com/math-related/bubble-sort.html + // note 1: This function deviates from PHP in returning a copy of the array instead + // note 1: of acting by reference and returning true; this was necessary because + // note 1: IE does not allow deleting and re-adding of properties without caching + // note 1: of property position; you can set the ini of "locutus.sortByReference" to true to + // note 1: get the PHP behavior, but use this only if you are in an environment + // note 1: such as Firefox extensions where for-in iteration order is fixed and true + // note 1: property deletion is supported. Note that we intend to implement the PHP + // note 1: behavior by default if IE ever does allow it; only gives shallow copy since + // note 1: is by reference in PHP anyways + // note 1: Since JS objects' keys are always strings, and (the + // note 1: default) SORT_REGULAR flag distinguishes by key type, + // note 1: if the content is a numeric string, we treat the + // note 1: "original type" as numeric. + // example 1: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'} + // example 1: arsort($data) + // example 1: var $result = $data + // returns 1: {a: 'orange', d: 'lemon', b: 'banana', c: 'apple'} + // example 2: ini_set('locutus.sortByReference', true) + // example 2: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'} + // example 2: arsort($data) + // example 2: var $result = $data + // returns 2: {a: 'orange', d: 'lemon', b: 'banana', c: 'apple'} + // test: skip-1 + + var i18lgd = require('../i18n/i18n_loc_get_default'); + var strnatcmp = require('../strings/strnatcmp'); + var valArr = []; + var valArrLen = 0; + var k; + var i; + var sorter; + var sortByReference = false; + var populateArr = {}; + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.locales = $locutus.php.locales || {}; + + switch (sortFlags) { + case 'SORT_STRING': + // compare items as strings + sorter = function sorter(a, b) { + return strnatcmp(b, a); + }; + break; + case 'SORT_LOCALE_STRING': + // compare items as strings, based on the current locale + // (set with i18n_loc_set_default() as of PHP6) + var loc = i18lgd(); + sorter = $locutus.php.locales[loc].sorting; + break; + case 'SORT_NUMERIC': + // compare items numerically + sorter = function sorter(a, b) { + return a - b; + }; + break; + case 'SORT_REGULAR': + // compare items normally (don't change types) + break; + default: + sorter = function sorter(b, a) { + var aFloat = parseFloat(a); + var bFloat = parseFloat(b); + var aNumeric = aFloat + '' === a; + var bNumeric = bFloat + '' === b; + + if (aNumeric && bNumeric) { + return aFloat > bFloat ? 1 : aFloat < bFloat ? -1 : 0; + } else if (aNumeric && !bNumeric) { + return 1; + } else if (!aNumeric && bNumeric) { + return -1; + } + + return a > b ? 1 : a < b ? -1 : 0; + }; + break; + } + + var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'; + sortByReference = iniVal === 'on'; + + // Get key and value arrays + for (k in inputArr) { + if (inputArr.hasOwnProperty(k)) { + valArr.push([k, inputArr[k]]); + if (sortByReference) { + delete inputArr[k]; + } + } + } + valArr.sort(function (a, b) { + return sorter(a[1], b[1]); + }); + + // Repopulate the old array + for (i = 0, valArrLen = valArr.length; i < valArrLen; i++) { + populateArr[valArr[i][0]] = valArr[i][1]; + if (sortByReference) { + inputArr[valArr[i][0]] = valArr[i][1]; + } + } + + return sortByReference || populateArr; +}; +//# sourceMappingURL=arsort.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/arsort.js.map b/node_modules/locutus/php/array/arsort.js.map new file mode 100644 index 0000000..5b73d11 --- /dev/null +++ b/node_modules/locutus/php/array/arsort.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/arsort.js"],"names":["module","exports","arsort","inputArr","sortFlags","i18lgd","require","strnatcmp","valArr","valArrLen","k","i","sorter","sortByReference","populateArr","$global","window","global","$locutus","php","locales","a","b","loc","sorting","aFloat","parseFloat","bFloat","aNumeric","bNumeric","iniVal","undefined","hasOwnProperty","push","sort","length"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,MAAT,CAAiBC,QAAjB,EAA2BC,SAA3B,EAAsC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAASC,QAAQ,8BAAR,CAAb;AACA,MAAIC,YAAYD,QAAQ,sBAAR,CAAhB;AACA,MAAIE,SAAS,EAAb;AACA,MAAIC,YAAY,CAAhB;AACA,MAAIC,CAAJ;AACA,MAAIC,CAAJ;AACA,MAAIC,MAAJ;AACA,MAAIC,kBAAkB,KAAtB;AACA,MAAIC,cAAc,EAAlB;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;AACAF,UAAQG,QAAR,GAAmBH,QAAQG,QAAR,IAAoB,EAAvC;AACA,MAAIA,WAAWH,QAAQG,QAAvB;AACAA,WAASC,GAAT,GAAeD,SAASC,GAAT,IAAgB,EAA/B;AACAD,WAASC,GAAT,CAAaC,OAAb,GAAuBF,SAASC,GAAT,CAAaC,OAAb,IAAwB,EAA/C;;AAEA,UAAQhB,SAAR;AACE,SAAK,aAAL;AACE;AACAQ,eAAS,gBAAUS,CAAV,EAAaC,CAAb,EAAgB;AACvB,eAAOf,UAAUe,CAAV,EAAaD,CAAb,CAAP;AACD,OAFD;AAGA;AACF,SAAK,oBAAL;AACE;AACA;AACA,UAAIE,MAAMlB,QAAV;AACAO,eAASM,SAASC,GAAT,CAAaC,OAAb,CAAqBG,GAArB,EAA0BC,OAAnC;AACA;AACF,SAAK,cAAL;AACE;AACAZ,eAAS,gBAAUS,CAAV,EAAaC,CAAb,EAAgB;AACvB,eAAQD,IAAIC,CAAZ;AACD,OAFD;AAGA;AACF,SAAK,cAAL;AACE;AACA;AACF;AACEV,eAAS,gBAAUU,CAAV,EAAaD,CAAb,EAAgB;AACvB,YAAII,SAASC,WAAWL,CAAX,CAAb;AACA,YAAIM,SAASD,WAAWJ,CAAX,CAAb;AACA,YAAIM,WAAWH,SAAS,EAAT,KAAgBJ,CAA/B;AACA,YAAIQ,WAAWF,SAAS,EAAT,KAAgBL,CAA/B;;AAEA,YAAIM,YAAYC,QAAhB,EAA0B;AACxB,iBAAOJ,SAASE,MAAT,GAAkB,CAAlB,GAAsBF,SAASE,MAAT,GAAkB,CAAC,CAAnB,GAAuB,CAApD;AACD,SAFD,MAEO,IAAIC,YAAY,CAACC,QAAjB,EAA2B;AAChC,iBAAO,CAAP;AACD,SAFM,MAEA,IAAI,CAACD,QAAD,IAAaC,QAAjB,EAA2B;AAChC,iBAAO,CAAC,CAAR;AACD;;AAED,eAAOR,IAAIC,CAAJ,GAAQ,CAAR,GAAYD,IAAIC,CAAJ,GAAQ,CAAC,CAAT,GAAa,CAAhC;AACD,OAfD;AAgBA;AAvCJ;;AA0CA,MAAIQ,SAAS,CAAC,OAAOxB,OAAP,KAAmB,WAAnB,GAAiCA,QAAQ,iBAAR,EAA2B,yBAA3B,CAAjC,GAAyFyB,SAA1F,KAAwG,IAArH;AACAlB,oBAAkBiB,WAAW,IAA7B;;AAEA;AACA,OAAKpB,CAAL,IAAUP,QAAV,EAAoB;AAClB,QAAIA,SAAS6B,cAAT,CAAwBtB,CAAxB,CAAJ,EAAgC;AAC9BF,aAAOyB,IAAP,CAAY,CAACvB,CAAD,EAAIP,SAASO,CAAT,CAAJ,CAAZ;AACA,UAAIG,eAAJ,EAAqB;AACnB,eAAOV,SAASO,CAAT,CAAP;AACD;AACF;AACF;AACDF,SAAO0B,IAAP,CAAY,UAAUb,CAAV,EAAaC,CAAb,EAAgB;AAC1B,WAAOV,OAAOS,EAAE,CAAF,CAAP,EAAaC,EAAE,CAAF,CAAb,CAAP;AACD,GAFD;;AAIA;AACA,OAAKX,IAAI,CAAJ,EAAOF,YAAYD,OAAO2B,MAA/B,EAAuCxB,IAAIF,SAA3C,EAAsDE,GAAtD,EAA2D;AACzDG,gBAAYN,OAAOG,CAAP,EAAU,CAAV,CAAZ,IAA4BH,OAAOG,CAAP,EAAU,CAAV,CAA5B;AACA,QAAIE,eAAJ,EAAqB;AACnBV,eAASK,OAAOG,CAAP,EAAU,CAAV,CAAT,IAAyBH,OAAOG,CAAP,EAAU,CAAV,CAAzB;AACD;AACF;;AAED,SAAOE,mBAAmBC,WAA1B;AACD,CArHD","file":"arsort.js","sourcesContent":["module.exports = function arsort (inputArr, sortFlags) {\n // discuss at: http://locutus.io/php/arsort/\n // original by: Brett Zamir (http://brett-zamir.me)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // improved by: Theriault (https://github.com/Theriault)\n // note 1: SORT_STRING (as well as natsort and natcasesort) might also be\n // note 1: integrated into all of these functions by adapting the code at\n // note 1: http://sourcefrog.net/projects/natsort/natcompare.js\n // note 1: The examples are correct, this is a new way\n // note 1: Credits to: http://javascript.internet.com/math-related/bubble-sort.html\n // note 1: This function deviates from PHP in returning a copy of the array instead\n // note 1: of acting by reference and returning true; this was necessary because\n // note 1: IE does not allow deleting and re-adding of properties without caching\n // note 1: of property position; you can set the ini of \"locutus.sortByReference\" to true to\n // note 1: get the PHP behavior, but use this only if you are in an environment\n // note 1: such as Firefox extensions where for-in iteration order is fixed and true\n // note 1: property deletion is supported. Note that we intend to implement the PHP\n // note 1: behavior by default if IE ever does allow it; only gives shallow copy since\n // note 1: is by reference in PHP anyways\n // note 1: Since JS objects' keys are always strings, and (the\n // note 1: default) SORT_REGULAR flag distinguishes by key type,\n // note 1: if the content is a numeric string, we treat the\n // note 1: \"original type\" as numeric.\n // example 1: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'}\n // example 1: arsort($data)\n // example 1: var $result = $data\n // returns 1: {a: 'orange', d: 'lemon', b: 'banana', c: 'apple'}\n // example 2: ini_set('locutus.sortByReference', true)\n // example 2: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'}\n // example 2: arsort($data)\n // example 2: var $result = $data\n // returns 2: {a: 'orange', d: 'lemon', b: 'banana', c: 'apple'}\n // test: skip-1\n\n var i18lgd = require('../i18n/i18n_loc_get_default')\n var strnatcmp = require('../strings/strnatcmp')\n var valArr = []\n var valArrLen = 0\n var k\n var i\n var sorter\n var sortByReference = false\n var populateArr = {}\n\n var $global = (typeof window !== 'undefined' ? window : global)\n $global.$locutus = $global.$locutus || {}\n var $locutus = $global.$locutus\n $locutus.php = $locutus.php || {}\n $locutus.php.locales = $locutus.php.locales || {}\n\n switch (sortFlags) {\n case 'SORT_STRING':\n // compare items as strings\n sorter = function (a, b) {\n return strnatcmp(b, a)\n }\n break\n case 'SORT_LOCALE_STRING':\n // compare items as strings, based on the current locale\n // (set with i18n_loc_set_default() as of PHP6)\n var loc = i18lgd()\n sorter = $locutus.php.locales[loc].sorting\n break\n case 'SORT_NUMERIC':\n // compare items numerically\n sorter = function (a, b) {\n return (a - b)\n }\n break\n case 'SORT_REGULAR':\n // compare items normally (don't change types)\n break\n default:\n sorter = function (b, a) {\n var aFloat = parseFloat(a)\n var bFloat = parseFloat(b)\n var aNumeric = aFloat + '' === a\n var bNumeric = bFloat + '' === b\n\n if (aNumeric && bNumeric) {\n return aFloat > bFloat ? 1 : aFloat < bFloat ? -1 : 0\n } else if (aNumeric && !bNumeric) {\n return 1\n } else if (!aNumeric && bNumeric) {\n return -1\n }\n\n return a > b ? 1 : a < b ? -1 : 0\n }\n break\n }\n\n var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'\n sortByReference = iniVal === 'on'\n\n // Get key and value arrays\n for (k in inputArr) {\n if (inputArr.hasOwnProperty(k)) {\n valArr.push([k, inputArr[k]])\n if (sortByReference) {\n delete inputArr[k]\n }\n }\n }\n valArr.sort(function (a, b) {\n return sorter(a[1], b[1])\n })\n\n // Repopulate the old array\n for (i = 0, valArrLen = valArr.length; i < valArrLen; i++) {\n populateArr[valArr[i][0]] = valArr[i][1]\n if (sortByReference) {\n inputArr[valArr[i][0]] = valArr[i][1]\n }\n }\n\n return sortByReference || populateArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/asort.js b/node_modules/locutus/php/array/asort.js new file mode 100644 index 0000000..bc2cfad --- /dev/null +++ b/node_modules/locutus/php/array/asort.js @@ -0,0 +1,121 @@ +'use strict'; + +module.exports = function asort(inputArr, sortFlags) { + // discuss at: http://locutus.io/php/asort/ + // original by: Brett Zamir (http://brett-zamir.me) + // improved by: Brett Zamir (http://brett-zamir.me) + // improved by: Brett Zamir (http://brett-zamir.me) + // improved by: Theriault (https://github.com/Theriault) + // input by: paulo kuong + // bugfixed by: Adam Wallner (http://web2.bitbaro.hu/) + // note 1: SORT_STRING (as well as natsort and natcasesort) might also be + // note 1: integrated into all of these functions by adapting the code at + // note 1: http://sourcefrog.net/projects/natsort/natcompare.js + // note 1: The examples are correct, this is a new way + // note 1: Credits to: http://javascript.internet.com/math-related/bubble-sort.html + // note 1: This function deviates from PHP in returning a copy of the array instead + // note 1: of acting by reference and returning true; this was necessary because + // note 1: IE does not allow deleting and re-adding of properties without caching + // note 1: of property position; you can set the ini of "locutus.sortByReference" to true to + // note 1: get the PHP behavior, but use this only if you are in an environment + // note 1: such as Firefox extensions where for-in iteration order is fixed and true + // note 1: property deletion is supported. Note that we intend to implement the PHP + // note 1: behavior by default if IE ever does allow it; only gives shallow copy since + // note 1: is by reference in PHP anyways + // note 1: Since JS objects' keys are always strings, and (the + // note 1: default) SORT_REGULAR flag distinguishes by key type, + // note 1: if the content is a numeric string, we treat the + // note 1: "original type" as numeric. + // example 1: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'} + // example 1: asort($data) + // example 1: var $result = $data + // returns 1: {c: 'apple', b: 'banana', d: 'lemon', a: 'orange'} + // example 2: ini_set('locutus.sortByReference', true) + // example 2: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'} + // example 2: asort($data) + // example 2: var $result = $data + // returns 2: {c: 'apple', b: 'banana', d: 'lemon', a: 'orange'} + + var strnatcmp = require('../strings/strnatcmp'); + var i18nlgd = require('../i18n/i18n_loc_get_default'); + + var valArr = []; + var valArrLen = 0; + var k; + var i; + var sorter; + var sortByReference = false; + var populateArr = {}; + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.locales = $locutus.php.locales || {}; + + switch (sortFlags) { + case 'SORT_STRING': + // compare items as strings + sorter = function sorter(a, b) { + return strnatcmp(a, b); + }; + break; + case 'SORT_LOCALE_STRING': + // compare items as strings, based on the current locale + // (set with i18n_loc_set_default() as of PHP6) + var loc = i18nlgd(); + sorter = $locutus.php.locales[loc].sorting; + break; + case 'SORT_NUMERIC': + // compare items numerically + sorter = function sorter(a, b) { + return a - b; + }; + break; + case 'SORT_REGULAR': + // compare items normally (don't change types) + break; + default: + sorter = function sorter(a, b) { + var aFloat = parseFloat(a); + var bFloat = parseFloat(b); + var aNumeric = aFloat + '' === a; + var bNumeric = bFloat + '' === b; + if (aNumeric && bNumeric) { + return aFloat > bFloat ? 1 : aFloat < bFloat ? -1 : 0; + } else if (aNumeric && !bNumeric) { + return 1; + } else if (!aNumeric && bNumeric) { + return -1; + } + return a > b ? 1 : a < b ? -1 : 0; + }; + break; + } + + var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'; + sortByReference = iniVal === 'on'; + populateArr = sortByReference ? inputArr : populateArr; + + // Get key and value arrays + for (k in inputArr) { + if (inputArr.hasOwnProperty(k)) { + valArr.push([k, inputArr[k]]); + if (sortByReference) { + delete inputArr[k]; + } + } + } + + valArr.sort(function (a, b) { + return sorter(a[1], b[1]); + }); + + // Repopulate the old array + for (i = 0, valArrLen = valArr.length; i < valArrLen; i++) { + populateArr[valArr[i][0]] = valArr[i][1]; + } + + return sortByReference || populateArr; +}; +//# sourceMappingURL=asort.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/asort.js.map b/node_modules/locutus/php/array/asort.js.map new file mode 100644 index 0000000..a24b7f5 --- /dev/null +++ b/node_modules/locutus/php/array/asort.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/asort.js"],"names":["module","exports","asort","inputArr","sortFlags","strnatcmp","require","i18nlgd","valArr","valArrLen","k","i","sorter","sortByReference","populateArr","$global","window","global","$locutus","php","locales","a","b","loc","sorting","aFloat","parseFloat","bFloat","aNumeric","bNumeric","iniVal","undefined","hasOwnProperty","push","sort","length"],"mappings":"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","file":"asort.js","sourcesContent":["module.exports = function asort (inputArr, sortFlags) {\n // discuss at: http://locutus.io/php/asort/\n // original by: Brett Zamir (http://brett-zamir.me)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // improved by: Theriault (https://github.com/Theriault)\n // input by: paulo kuong\n // bugfixed by: Adam Wallner (http://web2.bitbaro.hu/)\n // note 1: SORT_STRING (as well as natsort and natcasesort) might also be\n // note 1: integrated into all of these functions by adapting the code at\n // note 1: http://sourcefrog.net/projects/natsort/natcompare.js\n // note 1: The examples are correct, this is a new way\n // note 1: Credits to: http://javascript.internet.com/math-related/bubble-sort.html\n // note 1: This function deviates from PHP in returning a copy of the array instead\n // note 1: of acting by reference and returning true; this was necessary because\n // note 1: IE does not allow deleting and re-adding of properties without caching\n // note 1: of property position; you can set the ini of \"locutus.sortByReference\" to true to\n // note 1: get the PHP behavior, but use this only if you are in an environment\n // note 1: such as Firefox extensions where for-in iteration order is fixed and true\n // note 1: property deletion is supported. Note that we intend to implement the PHP\n // note 1: behavior by default if IE ever does allow it; only gives shallow copy since\n // note 1: is by reference in PHP anyways\n // note 1: Since JS objects' keys are always strings, and (the\n // note 1: default) SORT_REGULAR flag distinguishes by key type,\n // note 1: if the content is a numeric string, we treat the\n // note 1: \"original type\" as numeric.\n // example 1: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'}\n // example 1: asort($data)\n // example 1: var $result = $data\n // returns 1: {c: 'apple', b: 'banana', d: 'lemon', a: 'orange'}\n // example 2: ini_set('locutus.sortByReference', true)\n // example 2: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'}\n // example 2: asort($data)\n // example 2: var $result = $data\n // returns 2: {c: 'apple', b: 'banana', d: 'lemon', a: 'orange'}\n\n var strnatcmp = require('../strings/strnatcmp')\n var i18nlgd = require('../i18n/i18n_loc_get_default')\n\n var valArr = []\n var valArrLen = 0\n var k\n var i\n var sorter\n var sortByReference = false\n var populateArr = {}\n\n var $global = (typeof window !== 'undefined' ? window : global)\n $global.$locutus = $global.$locutus || {}\n var $locutus = $global.$locutus\n $locutus.php = $locutus.php || {}\n $locutus.php.locales = $locutus.php.locales || {}\n\n switch (sortFlags) {\n case 'SORT_STRING':\n // compare items as strings\n sorter = function (a, b) {\n return strnatcmp(a, b)\n }\n break\n case 'SORT_LOCALE_STRING':\n // compare items as strings, based on the current locale\n // (set with i18n_loc_set_default() as of PHP6)\n var loc = i18nlgd()\n sorter = $locutus.php.locales[loc].sorting\n break\n case 'SORT_NUMERIC':\n // compare items numerically\n sorter = function (a, b) {\n return (a - b)\n }\n break\n case 'SORT_REGULAR':\n // compare items normally (don't change types)\n break\n default:\n sorter = function (a, b) {\n var aFloat = parseFloat(a)\n var bFloat = parseFloat(b)\n var aNumeric = aFloat + '' === a\n var bNumeric = bFloat + '' === b\n if (aNumeric && bNumeric) {\n return aFloat > bFloat ? 1 : aFloat < bFloat ? -1 : 0\n } else if (aNumeric && !bNumeric) {\n return 1\n } else if (!aNumeric && bNumeric) {\n return -1\n }\n return a > b ? 1 : a < b ? -1 : 0\n }\n break\n }\n\n var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'\n sortByReference = iniVal === 'on'\n populateArr = sortByReference ? inputArr : populateArr\n\n // Get key and value arrays\n for (k in inputArr) {\n if (inputArr.hasOwnProperty(k)) {\n valArr.push([k, inputArr[k]])\n if (sortByReference) {\n delete inputArr[k]\n }\n }\n }\n\n valArr.sort(function (a, b) {\n return sorter(a[1], b[1])\n })\n\n // Repopulate the old array\n for (i = 0, valArrLen = valArr.length; i < valArrLen; i++) {\n populateArr[valArr[i][0]] = valArr[i][1]\n }\n\n return sortByReference || populateArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/count.js b/node_modules/locutus/php/array/count.js new file mode 100644 index 0000000..379699b --- /dev/null +++ b/node_modules/locutus/php/array/count.js @@ -0,0 +1,43 @@ +'use strict'; + +module.exports = function count(mixedVar, mode) { + // discuss at: http://locutus.io/php/count/ + // original by: Kevin van Zonneveld (http://kvz.io) + // input by: Waldo Malqui Silva (http://waldo.malqui.info) + // input by: merabi + // bugfixed by: Soren Hansen + // bugfixed by: Olivier Louvignes (http://mg-crea.com/) + // improved by: Brett Zamir (http://brett-zamir.me) + // example 1: count([[0,0],[0,-4]], 'COUNT_RECURSIVE') + // returns 1: 6 + // example 2: count({'one' : [1,2,3,4,5]}, 'COUNT_RECURSIVE') + // returns 2: 6 + + var key; + var cnt = 0; + + if (mixedVar === null || typeof mixedVar === 'undefined') { + return 0; + } else if (mixedVar.constructor !== Array && mixedVar.constructor !== Object) { + return 1; + } + + if (mode === 'COUNT_RECURSIVE') { + mode = 1; + } + if (mode !== 1) { + mode = 0; + } + + for (key in mixedVar) { + if (mixedVar.hasOwnProperty(key)) { + cnt++; + if (mode === 1 && mixedVar[key] && (mixedVar[key].constructor === Array || mixedVar[key].constructor === Object)) { + cnt += count(mixedVar[key], 1); + } + } + } + + return cnt; +}; +//# sourceMappingURL=count.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/count.js.map b/node_modules/locutus/php/array/count.js.map new file mode 100644 index 0000000..7ca0deb --- /dev/null +++ b/node_modules/locutus/php/array/count.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/count.js"],"names":["module","exports","count","mixedVar","mode","key","cnt","constructor","Array","Object","hasOwnProperty"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,KAAT,CAAgBC,QAAhB,EAA0BC,IAA1B,EAAgC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,GAAJ;AACA,MAAIC,MAAM,CAAV;;AAEA,MAAIH,aAAa,IAAb,IAAqB,OAAOA,QAAP,KAAoB,WAA7C,EAA0D;AACxD,WAAO,CAAP;AACD,GAFD,MAEO,IAAIA,SAASI,WAAT,KAAyBC,KAAzB,IAAkCL,SAASI,WAAT,KAAyBE,MAA/D,EAAuE;AAC5E,WAAO,CAAP;AACD;;AAED,MAAIL,SAAS,iBAAb,EAAgC;AAC9BA,WAAO,CAAP;AACD;AACD,MAAIA,SAAS,CAAb,EAAgB;AACdA,WAAO,CAAP;AACD;;AAED,OAAKC,GAAL,IAAYF,QAAZ,EAAsB;AACpB,QAAIA,SAASO,cAAT,CAAwBL,GAAxB,CAAJ,EAAkC;AAChCC;AACA,UAAIF,SAAS,CAAT,IAAcD,SAASE,GAAT,CAAd,KACDF,SAASE,GAAT,EAAcE,WAAd,KAA8BC,KAA9B,IACCL,SAASE,GAAT,EAAcE,WAAd,KAA8BE,MAF9B,CAAJ,EAE2C;AACzCH,eAAOJ,MAAMC,SAASE,GAAT,CAAN,EAAqB,CAArB,CAAP;AACD;AACF;AACF;;AAED,SAAOC,GAAP;AACD,CAzCD","file":"count.js","sourcesContent":["module.exports = function count (mixedVar, mode) {\n // discuss at: http://locutus.io/php/count/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // input by: Waldo Malqui Silva (http://waldo.malqui.info)\n // input by: merabi\n // bugfixed by: Soren Hansen\n // bugfixed by: Olivier Louvignes (http://mg-crea.com/)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // example 1: count([[0,0],[0,-4]], 'COUNT_RECURSIVE')\n // returns 1: 6\n // example 2: count({'one' : [1,2,3,4,5]}, 'COUNT_RECURSIVE')\n // returns 2: 6\n\n var key\n var cnt = 0\n\n if (mixedVar === null || typeof mixedVar === 'undefined') {\n return 0\n } else if (mixedVar.constructor !== Array && mixedVar.constructor !== Object) {\n return 1\n }\n\n if (mode === 'COUNT_RECURSIVE') {\n mode = 1\n }\n if (mode !== 1) {\n mode = 0\n }\n\n for (key in mixedVar) {\n if (mixedVar.hasOwnProperty(key)) {\n cnt++\n if (mode === 1 && mixedVar[key] &&\n (mixedVar[key].constructor === Array ||\n mixedVar[key].constructor === Object)) {\n cnt += count(mixedVar[key], 1)\n }\n }\n }\n\n return cnt\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/current.js b/node_modules/locutus/php/array/current.js new file mode 100644 index 0000000..3cfc05c --- /dev/null +++ b/node_modules/locutus/php/array/current.js @@ -0,0 +1,47 @@ +'use strict'; + +module.exports = function current(arr) { + // discuss at: http://locutus.io/php/current/ + // original by: Brett Zamir (http://brett-zamir.me) + // note 1: Uses global: locutus to store the array pointer + // example 1: var $transport = ['foot', 'bike', 'car', 'plane'] + // example 1: current($transport) + // returns 1: 'foot' + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.pointers = $locutus.php.pointers || []; + var pointers = $locutus.php.pointers; + + var indexOf = function indexOf(value) { + for (var i = 0, length = this.length; i < length; i++) { + if (this[i] === value) { + return i; + } + } + return -1; + }; + if (!pointers.indexOf) { + pointers.indexOf = indexOf; + } + if (pointers.indexOf(arr) === -1) { + pointers.push(arr, 0); + } + var arrpos = pointers.indexOf(arr); + var cursor = pointers[arrpos + 1]; + if (Object.prototype.toString.call(arr) === '[object Array]') { + return arr[cursor] || false; + } + var ct = 0; + for (var k in arr) { + if (ct === cursor) { + return arr[k]; + } + ct++; + } + // Empty + return false; +}; +//# sourceMappingURL=current.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/current.js.map b/node_modules/locutus/php/array/current.js.map new file mode 100644 index 0000000..37ed9b0 --- /dev/null +++ b/node_modules/locutus/php/array/current.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/current.js"],"names":["module","exports","current","arr","$global","window","global","$locutus","php","pointers","indexOf","value","i","length","push","arrpos","cursor","Object","prototype","toString","call","ct","k"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,OAAT,CAAkBC,GAAlB,EAAuB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;AACAF,UAAQG,QAAR,GAAmBH,QAAQG,QAAR,IAAoB,EAAvC;AACA,MAAIA,WAAWH,QAAQG,QAAvB;AACAA,WAASC,GAAT,GAAeD,SAASC,GAAT,IAAgB,EAA/B;AACAD,WAASC,GAAT,CAAaC,QAAb,GAAwBF,SAASC,GAAT,CAAaC,QAAb,IAAyB,EAAjD;AACA,MAAIA,WAAWF,SAASC,GAAT,CAAaC,QAA5B;;AAEA,MAAIC,UAAU,SAAVA,OAAU,CAAUC,KAAV,EAAiB;AAC7B,SAAK,IAAIC,IAAI,CAAR,EAAWC,SAAS,KAAKA,MAA9B,EAAsCD,IAAIC,MAA1C,EAAkDD,GAAlD,EAAuD;AACrD,UAAI,KAAKA,CAAL,MAAYD,KAAhB,EAAuB;AACrB,eAAOC,CAAP;AACD;AACF;AACD,WAAO,CAAC,CAAR;AACD,GAPD;AAQA,MAAI,CAACH,SAASC,OAAd,EAAuB;AACrBD,aAASC,OAAT,GAAmBA,OAAnB;AACD;AACD,MAAID,SAASC,OAAT,CAAiBP,GAAjB,MAA0B,CAAC,CAA/B,EAAkC;AAChCM,aAASK,IAAT,CAAcX,GAAd,EAAmB,CAAnB;AACD;AACD,MAAIY,SAASN,SAASC,OAAT,CAAiBP,GAAjB,CAAb;AACA,MAAIa,SAASP,SAASM,SAAS,CAAlB,CAAb;AACA,MAAIE,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BjB,GAA/B,MAAwC,gBAA5C,EAA8D;AAC5D,WAAOA,IAAIa,MAAJ,KAAe,KAAtB;AACD;AACD,MAAIK,KAAK,CAAT;AACA,OAAK,IAAIC,CAAT,IAAcnB,GAAd,EAAmB;AACjB,QAAIkB,OAAOL,MAAX,EAAmB;AACjB,aAAOb,IAAImB,CAAJ,CAAP;AACD;AACDD;AACD;AACD;AACA,SAAO,KAAP;AACD,CA3CD","file":"current.js","sourcesContent":["module.exports = function current (arr) {\n // discuss at: http://locutus.io/php/current/\n // original by: Brett Zamir (http://brett-zamir.me)\n // note 1: Uses global: locutus to store the array pointer\n // example 1: var $transport = ['foot', 'bike', 'car', 'plane']\n // example 1: current($transport)\n // returns 1: 'foot'\n\n var $global = (typeof window !== 'undefined' ? window : global)\n $global.$locutus = $global.$locutus || {}\n var $locutus = $global.$locutus\n $locutus.php = $locutus.php || {}\n $locutus.php.pointers = $locutus.php.pointers || []\n var pointers = $locutus.php.pointers\n\n var indexOf = function (value) {\n for (var i = 0, length = this.length; i < length; i++) {\n if (this[i] === value) {\n return i\n }\n }\n return -1\n }\n if (!pointers.indexOf) {\n pointers.indexOf = indexOf\n }\n if (pointers.indexOf(arr) === -1) {\n pointers.push(arr, 0)\n }\n var arrpos = pointers.indexOf(arr)\n var cursor = pointers[arrpos + 1]\n if (Object.prototype.toString.call(arr) === '[object Array]') {\n return arr[cursor] || false\n }\n var ct = 0\n for (var k in arr) {\n if (ct === cursor) {\n return arr[k]\n }\n ct++\n }\n // Empty\n return false\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/each.js b/node_modules/locutus/php/array/each.js new file mode 100644 index 0000000..162ed28 --- /dev/null +++ b/node_modules/locutus/php/array/each.js @@ -0,0 +1,74 @@ +'use strict'; + +module.exports = function each(arr) { + // discuss at: http://locutus.io/php/each/ + // original by: Ates Goral (http://magnetiq.com) + // revised by: Brett Zamir (http://brett-zamir.me) + // note 1: Uses global: locutus to store the array pointer + // example 1: each({a: "apple", b: "balloon"}) + // returns 1: {0: "a", 1: "apple", key: "a", value: "apple"} + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.pointers = $locutus.php.pointers || []; + var pointers = $locutus.php.pointers; + + var indexOf = function indexOf(value) { + for (var i = 0, length = this.length; i < length; i++) { + if (this[i] === value) { + return i; + } + } + return -1; + }; + + if (!pointers.indexOf) { + pointers.indexOf = indexOf; + } + if (pointers.indexOf(arr) === -1) { + pointers.push(arr, 0); + } + var arrpos = pointers.indexOf(arr); + var cursor = pointers[arrpos + 1]; + var pos = 0; + + if (Object.prototype.toString.call(arr) !== '[object Array]') { + var ct = 0; + for (var k in arr) { + if (ct === cursor) { + pointers[arrpos + 1] += 1; + if (each.returnArrayOnly) { + return [k, arr[k]]; + } else { + return { + 1: arr[k], + value: arr[k], + 0: k, + key: k + }; + } + } + ct++; + } + // Empty + return false; + } + if (arr.length === 0 || cursor === arr.length) { + return false; + } + pos = cursor; + pointers[arrpos + 1] += 1; + if (each.returnArrayOnly) { + return [pos, arr[pos]]; + } else { + return { + 1: arr[pos], + value: arr[pos], + 0: pos, + key: pos + }; + } +}; +//# sourceMappingURL=each.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/each.js.map b/node_modules/locutus/php/array/each.js.map new file mode 100644 index 0000000..dca7d1a --- /dev/null +++ b/node_modules/locutus/php/array/each.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/each.js"],"names":["module","exports","each","arr","$global","window","global","$locutus","php","pointers","indexOf","value","i","length","push","arrpos","cursor","pos","Object","prototype","toString","call","ct","k","returnArrayOnly","key"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,IAAT,CAAeC,GAAf,EAAoB;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;AACAF,UAAQG,QAAR,GAAmBH,QAAQG,QAAR,IAAoB,EAAvC;AACA,MAAIA,WAAWH,QAAQG,QAAvB;AACAA,WAASC,GAAT,GAAeD,SAASC,GAAT,IAAgB,EAA/B;AACAD,WAASC,GAAT,CAAaC,QAAb,GAAwBF,SAASC,GAAT,CAAaC,QAAb,IAAyB,EAAjD;AACA,MAAIA,WAAWF,SAASC,GAAT,CAAaC,QAA5B;;AAEA,MAAIC,UAAU,SAAVA,OAAU,CAAUC,KAAV,EAAiB;AAC7B,SAAK,IAAIC,IAAI,CAAR,EAAWC,SAAS,KAAKA,MAA9B,EAAsCD,IAAIC,MAA1C,EAAkDD,GAAlD,EAAuD;AACrD,UAAI,KAAKA,CAAL,MAAYD,KAAhB,EAAuB;AACrB,eAAOC,CAAP;AACD;AACF;AACD,WAAO,CAAC,CAAR;AACD,GAPD;;AASA,MAAI,CAACH,SAASC,OAAd,EAAuB;AACrBD,aAASC,OAAT,GAAmBA,OAAnB;AACD;AACD,MAAID,SAASC,OAAT,CAAiBP,GAAjB,MAA0B,CAAC,CAA/B,EAAkC;AAChCM,aAASK,IAAT,CAAcX,GAAd,EAAmB,CAAnB;AACD;AACD,MAAIY,SAASN,SAASC,OAAT,CAAiBP,GAAjB,CAAb;AACA,MAAIa,SAASP,SAASM,SAAS,CAAlB,CAAb;AACA,MAAIE,MAAM,CAAV;;AAEA,MAAIC,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BlB,GAA/B,MAAwC,gBAA5C,EAA8D;AAC5D,QAAImB,KAAK,CAAT;AACA,SAAK,IAAIC,CAAT,IAAcpB,GAAd,EAAmB;AACjB,UAAImB,OAAON,MAAX,EAAmB;AACjBP,iBAASM,SAAS,CAAlB,KAAwB,CAAxB;AACA,YAAIb,KAAKsB,eAAT,EAA0B;AACxB,iBAAO,CAACD,CAAD,EAAIpB,IAAIoB,CAAJ,CAAJ,CAAP;AACD,SAFD,MAEO;AACL,iBAAO;AACL,eAAGpB,IAAIoB,CAAJ,CADE;AAELZ,mBAAOR,IAAIoB,CAAJ,CAFF;AAGL,eAAGA,CAHE;AAILE,iBAAKF;AAJA,WAAP;AAMD;AACF;AACDD;AACD;AACD;AACA,WAAO,KAAP;AACD;AACD,MAAInB,IAAIU,MAAJ,KAAe,CAAf,IAAoBG,WAAWb,IAAIU,MAAvC,EAA+C;AAC7C,WAAO,KAAP;AACD;AACDI,QAAMD,MAAN;AACAP,WAASM,SAAS,CAAlB,KAAwB,CAAxB;AACA,MAAIb,KAAKsB,eAAT,EAA0B;AACxB,WAAO,CAACP,GAAD,EAAMd,IAAIc,GAAJ,CAAN,CAAP;AACD,GAFD,MAEO;AACL,WAAO;AACL,SAAGd,IAAIc,GAAJ,CADE;AAELN,aAAOR,IAAIc,GAAJ,CAFF;AAGL,SAAGA,GAHE;AAILQ,WAAKR;AAJA,KAAP;AAMD;AACF,CAtED","file":"each.js","sourcesContent":["module.exports = function each (arr) {\n // discuss at: http://locutus.io/php/each/\n // original by: Ates Goral (http://magnetiq.com)\n // revised by: Brett Zamir (http://brett-zamir.me)\n // note 1: Uses global: locutus to store the array pointer\n // example 1: each({a: \"apple\", b: \"balloon\"})\n // returns 1: {0: \"a\", 1: \"apple\", key: \"a\", value: \"apple\"}\n\n var $global = (typeof window !== 'undefined' ? window : global)\n $global.$locutus = $global.$locutus || {}\n var $locutus = $global.$locutus\n $locutus.php = $locutus.php || {}\n $locutus.php.pointers = $locutus.php.pointers || []\n var pointers = $locutus.php.pointers\n\n var indexOf = function (value) {\n for (var i = 0, length = this.length; i < length; i++) {\n if (this[i] === value) {\n return i\n }\n }\n return -1\n }\n\n if (!pointers.indexOf) {\n pointers.indexOf = indexOf\n }\n if (pointers.indexOf(arr) === -1) {\n pointers.push(arr, 0)\n }\n var arrpos = pointers.indexOf(arr)\n var cursor = pointers[arrpos + 1]\n var pos = 0\n\n if (Object.prototype.toString.call(arr) !== '[object Array]') {\n var ct = 0\n for (var k in arr) {\n if (ct === cursor) {\n pointers[arrpos + 1] += 1\n if (each.returnArrayOnly) {\n return [k, arr[k]]\n } else {\n return {\n 1: arr[k],\n value: arr[k],\n 0: k,\n key: k\n }\n }\n }\n ct++\n }\n // Empty\n return false\n }\n if (arr.length === 0 || cursor === arr.length) {\n return false\n }\n pos = cursor\n pointers[arrpos + 1] += 1\n if (each.returnArrayOnly) {\n return [pos, arr[pos]]\n } else {\n return {\n 1: arr[pos],\n value: arr[pos],\n 0: pos,\n key: pos\n }\n }\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/end.js b/node_modules/locutus/php/array/end.js new file mode 100644 index 0000000..e028212 --- /dev/null +++ b/node_modules/locutus/php/array/end.js @@ -0,0 +1,60 @@ +'use strict'; + +module.exports = function end(arr) { + // discuss at: http://locutus.io/php/end/ + // original by: Kevin van Zonneveld (http://kvz.io) + // bugfixed by: Legaev Andrey + // revised by: J A R + // revised by: Brett Zamir (http://brett-zamir.me) + // improved by: Kevin van Zonneveld (http://kvz.io) + // improved by: Kevin van Zonneveld (http://kvz.io) + // note 1: Uses global: locutus to store the array pointer + // example 1: end({0: 'Kevin', 1: 'van', 2: 'Zonneveld'}) + // returns 1: 'Zonneveld' + // example 2: end(['Kevin', 'van', 'Zonneveld']) + // returns 2: 'Zonneveld' + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.pointers = $locutus.php.pointers || []; + var pointers = $locutus.php.pointers; + + var indexOf = function indexOf(value) { + for (var i = 0, length = this.length; i < length; i++) { + if (this[i] === value) { + return i; + } + } + return -1; + }; + + if (!pointers.indexOf) { + pointers.indexOf = indexOf; + } + if (pointers.indexOf(arr) === -1) { + pointers.push(arr, 0); + } + var arrpos = pointers.indexOf(arr); + if (Object.prototype.toString.call(arr) !== '[object Array]') { + var ct = 0; + var val; + for (var k in arr) { + ct++; + val = arr[k]; + } + if (ct === 0) { + // Empty + return false; + } + pointers[arrpos + 1] = ct - 1; + return val; + } + if (arr.length === 0) { + return false; + } + pointers[arrpos + 1] = arr.length - 1; + return arr[pointers[arrpos + 1]]; +}; +//# sourceMappingURL=end.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/end.js.map b/node_modules/locutus/php/array/end.js.map new file mode 100644 index 0000000..5fbe41b --- /dev/null +++ b/node_modules/locutus/php/array/end.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/end.js"],"names":["module","exports","end","arr","$global","window","global","$locutus","php","pointers","indexOf","value","i","length","push","arrpos","Object","prototype","toString","call","ct","val","k"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,GAAT,CAAcC,GAAd,EAAmB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;AACAF,UAAQG,QAAR,GAAmBH,QAAQG,QAAR,IAAoB,EAAvC;AACA,MAAIA,WAAWH,QAAQG,QAAvB;AACAA,WAASC,GAAT,GAAeD,SAASC,GAAT,IAAgB,EAA/B;AACAD,WAASC,GAAT,CAAaC,QAAb,GAAwBF,SAASC,GAAT,CAAaC,QAAb,IAAyB,EAAjD;AACA,MAAIA,WAAWF,SAASC,GAAT,CAAaC,QAA5B;;AAEA,MAAIC,UAAU,SAAVA,OAAU,CAAUC,KAAV,EAAiB;AAC7B,SAAK,IAAIC,IAAI,CAAR,EAAWC,SAAS,KAAKA,MAA9B,EAAsCD,IAAIC,MAA1C,EAAkDD,GAAlD,EAAuD;AACrD,UAAI,KAAKA,CAAL,MAAYD,KAAhB,EAAuB;AACrB,eAAOC,CAAP;AACD;AACF;AACD,WAAO,CAAC,CAAR;AACD,GAPD;;AASA,MAAI,CAACH,SAASC,OAAd,EAAuB;AACrBD,aAASC,OAAT,GAAmBA,OAAnB;AACD;AACD,MAAID,SAASC,OAAT,CAAiBP,GAAjB,MAA0B,CAAC,CAA/B,EAAkC;AAChCM,aAASK,IAAT,CAAcX,GAAd,EAAmB,CAAnB;AACD;AACD,MAAIY,SAASN,SAASC,OAAT,CAAiBP,GAAjB,CAAb;AACA,MAAIa,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BhB,GAA/B,MAAwC,gBAA5C,EAA8D;AAC5D,QAAIiB,KAAK,CAAT;AACA,QAAIC,GAAJ;AACA,SAAK,IAAIC,CAAT,IAAcnB,GAAd,EAAmB;AACjBiB;AACAC,YAAMlB,IAAImB,CAAJ,CAAN;AACD;AACD,QAAIF,OAAO,CAAX,EAAc;AACZ;AACA,aAAO,KAAP;AACD;AACDX,aAASM,SAAS,CAAlB,IAAuBK,KAAK,CAA5B;AACA,WAAOC,GAAP;AACD;AACD,MAAIlB,IAAIU,MAAJ,KAAe,CAAnB,EAAsB;AACpB,WAAO,KAAP;AACD;AACDJ,WAASM,SAAS,CAAlB,IAAuBZ,IAAIU,MAAJ,GAAa,CAApC;AACA,SAAOV,IAAIM,SAASM,SAAS,CAAlB,CAAJ,CAAP;AACD,CAxDD","file":"end.js","sourcesContent":["module.exports = function end (arr) {\n // discuss at: http://locutus.io/php/end/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // bugfixed by: Legaev Andrey\n // revised by: J A R\n // revised by: Brett Zamir (http://brett-zamir.me)\n // improved by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Kevin van Zonneveld (http://kvz.io)\n // note 1: Uses global: locutus to store the array pointer\n // example 1: end({0: 'Kevin', 1: 'van', 2: 'Zonneveld'})\n // returns 1: 'Zonneveld'\n // example 2: end(['Kevin', 'van', 'Zonneveld'])\n // returns 2: 'Zonneveld'\n\n var $global = (typeof window !== 'undefined' ? window : global)\n $global.$locutus = $global.$locutus || {}\n var $locutus = $global.$locutus\n $locutus.php = $locutus.php || {}\n $locutus.php.pointers = $locutus.php.pointers || []\n var pointers = $locutus.php.pointers\n\n var indexOf = function (value) {\n for (var i = 0, length = this.length; i < length; i++) {\n if (this[i] === value) {\n return i\n }\n }\n return -1\n }\n\n if (!pointers.indexOf) {\n pointers.indexOf = indexOf\n }\n if (pointers.indexOf(arr) === -1) {\n pointers.push(arr, 0)\n }\n var arrpos = pointers.indexOf(arr)\n if (Object.prototype.toString.call(arr) !== '[object Array]') {\n var ct = 0\n var val\n for (var k in arr) {\n ct++\n val = arr[k]\n }\n if (ct === 0) {\n // Empty\n return false\n }\n pointers[arrpos + 1] = ct - 1\n return val\n }\n if (arr.length === 0) {\n return false\n }\n pointers[arrpos + 1] = arr.length - 1\n return arr[pointers[arrpos + 1]]\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/in_array.js b/node_modules/locutus/php/array/in_array.js new file mode 100644 index 0000000..ad9f8fb --- /dev/null +++ b/node_modules/locutus/php/array/in_array.js @@ -0,0 +1,45 @@ +'use strict'; + +module.exports = function in_array(needle, haystack, argStrict) { + // eslint-disable-line camelcase + // discuss at: http://locutus.io/php/in_array/ + // original by: Kevin van Zonneveld (http://kvz.io) + // improved by: vlado houba + // improved by: Jonas Sciangula Street (Joni2Back) + // input by: Billy + // bugfixed by: Brett Zamir (http://brett-zamir.me) + // example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']) + // returns 1: true + // example 2: in_array('vlado', {0: 'Kevin', vlado: 'van', 1: 'Zonneveld'}) + // returns 2: false + // example 3: in_array(1, ['1', '2', '3']) + // example 3: in_array(1, ['1', '2', '3'], false) + // returns 3: true + // returns 3: true + // example 4: in_array(1, ['1', '2', '3'], true) + // returns 4: false + + var key = ''; + var strict = !!argStrict; + + // we prevent the double check (strict && arr[key] === ndl) || (!strict && arr[key] === ndl) + // in just one for, in order to improve the performance + // deciding wich type of comparation will do before walk array + if (strict) { + for (key in haystack) { + if (haystack[key] === needle) { + return true; + } + } + } else { + for (key in haystack) { + if (haystack[key] == needle) { + // eslint-disable-line eqeqeq + return true; + } + } + } + + return false; +}; +//# sourceMappingURL=in_array.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/in_array.js.map b/node_modules/locutus/php/array/in_array.js.map new file mode 100644 index 0000000..c79e1ec --- /dev/null +++ b/node_modules/locutus/php/array/in_array.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/in_array.js"],"names":["module","exports","in_array","needle","haystack","argStrict","key","strict"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,QAAT,CAAmBC,MAAnB,EAA2BC,QAA3B,EAAqCC,SAArC,EAAgD;AAAE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,MAAM,EAAV;AACA,MAAIC,SAAS,CAAC,CAACF,SAAf;;AAEA;AACA;AACA;AACA,MAAIE,MAAJ,EAAY;AACV,SAAKD,GAAL,IAAYF,QAAZ,EAAsB;AACpB,UAAIA,SAASE,GAAT,MAAkBH,MAAtB,EAA8B;AAC5B,eAAO,IAAP;AACD;AACF;AACF,GAND,MAMO;AACL,SAAKG,GAAL,IAAYF,QAAZ,EAAsB;AACpB,UAAIA,SAASE,GAAT,KAAiBH,MAArB,EAA6B;AAAE;AAC7B,eAAO,IAAP;AACD;AACF;AACF;;AAED,SAAO,KAAP;AACD,CAvCD","file":"in_array.js","sourcesContent":["module.exports = function in_array (needle, haystack, argStrict) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/in_array/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // improved by: vlado houba\n // improved by: Jonas Sciangula Street (Joni2Back)\n // input by: Billy\n // bugfixed by: Brett Zamir (http://brett-zamir.me)\n // example 1: in_array('van', ['Kevin', 'van', 'Zonneveld'])\n // returns 1: true\n // example 2: in_array('vlado', {0: 'Kevin', vlado: 'van', 1: 'Zonneveld'})\n // returns 2: false\n // example 3: in_array(1, ['1', '2', '3'])\n // example 3: in_array(1, ['1', '2', '3'], false)\n // returns 3: true\n // returns 3: true\n // example 4: in_array(1, ['1', '2', '3'], true)\n // returns 4: false\n\n var key = ''\n var strict = !!argStrict\n\n // we prevent the double check (strict && arr[key] === ndl) || (!strict && arr[key] === ndl)\n // in just one for, in order to improve the performance\n // deciding wich type of comparation will do before walk array\n if (strict) {\n for (key in haystack) {\n if (haystack[key] === needle) {\n return true\n }\n }\n } else {\n for (key in haystack) {\n if (haystack[key] == needle) { // eslint-disable-line eqeqeq\n return true\n }\n }\n }\n\n return false\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/index.js b/node_modules/locutus/php/array/index.js new file mode 100644 index 0000000..5268e9e --- /dev/null +++ b/node_modules/locutus/php/array/index.js @@ -0,0 +1,75 @@ +'use strict'; + +module.exports['array_change_key_case'] = require('./array_change_key_case'); +module.exports['array_chunk'] = require('./array_chunk'); +module.exports['array_combine'] = require('./array_combine'); +module.exports['array_count_values'] = require('./array_count_values'); +module.exports['array_diff'] = require('./array_diff'); +module.exports['array_diff_assoc'] = require('./array_diff_assoc'); +module.exports['array_diff_key'] = require('./array_diff_key'); +module.exports['array_diff_uassoc'] = require('./array_diff_uassoc'); +module.exports['array_diff_ukey'] = require('./array_diff_ukey'); +module.exports['array_fill'] = require('./array_fill'); +module.exports['array_fill_keys'] = require('./array_fill_keys'); +module.exports['array_filter'] = require('./array_filter'); +module.exports['array_flip'] = require('./array_flip'); +module.exports['array_intersect'] = require('./array_intersect'); +module.exports['array_intersect_assoc'] = require('./array_intersect_assoc'); +module.exports['array_intersect_key'] = require('./array_intersect_key'); +module.exports['array_intersect_uassoc'] = require('./array_intersect_uassoc'); +module.exports['array_intersect_ukey'] = require('./array_intersect_ukey'); +module.exports['array_key_exists'] = require('./array_key_exists'); +module.exports['array_keys'] = require('./array_keys'); +module.exports['array_map'] = require('./array_map'); +module.exports['array_merge'] = require('./array_merge'); +module.exports['array_merge_recursive'] = require('./array_merge_recursive'); +module.exports['array_multisort'] = require('./array_multisort'); +module.exports['array_pad'] = require('./array_pad'); +module.exports['array_pop'] = require('./array_pop'); +module.exports['array_product'] = require('./array_product'); +module.exports['array_push'] = require('./array_push'); +module.exports['array_rand'] = require('./array_rand'); +module.exports['array_reduce'] = require('./array_reduce'); +module.exports['array_replace'] = require('./array_replace'); +module.exports['array_replace_recursive'] = require('./array_replace_recursive'); +module.exports['array_reverse'] = require('./array_reverse'); +module.exports['array_search'] = require('./array_search'); +module.exports['array_shift'] = require('./array_shift'); +module.exports['array_slice'] = require('./array_slice'); +module.exports['array_splice'] = require('./array_splice'); +module.exports['array_sum'] = require('./array_sum'); +module.exports['array_udiff'] = require('./array_udiff'); +module.exports['array_udiff_assoc'] = require('./array_udiff_assoc'); +module.exports['array_udiff_uassoc'] = require('./array_udiff_uassoc'); +module.exports['array_uintersect'] = require('./array_uintersect'); +module.exports['array_uintersect_uassoc'] = require('./array_uintersect_uassoc'); +module.exports['array_unique'] = require('./array_unique'); +module.exports['array_unshift'] = require('./array_unshift'); +module.exports['array_values'] = require('./array_values'); +module.exports['array_walk'] = require('./array_walk'); +module.exports['array_walk_recursive'] = require('./array_walk_recursive'); +module.exports['arsort'] = require('./arsort'); +module.exports['asort'] = require('./asort'); +module.exports['count'] = require('./count'); +module.exports['current'] = require('./current'); +module.exports['each'] = require('./each'); +module.exports['end'] = require('./end'); +module.exports['in_array'] = require('./in_array'); +module.exports['key'] = require('./key'); +module.exports['krsort'] = require('./krsort'); +module.exports['ksort'] = require('./ksort'); +module.exports['natcasesort'] = require('./natcasesort'); +module.exports['natsort'] = require('./natsort'); +module.exports['next'] = require('./next'); +module.exports['pos'] = require('./pos'); +module.exports['prev'] = require('./prev'); +module.exports['range'] = require('./range'); +module.exports['reset'] = require('./reset'); +module.exports['rsort'] = require('./rsort'); +module.exports['shuffle'] = require('./shuffle'); +module.exports['sizeof'] = require('./sizeof'); +module.exports['sort'] = require('./sort'); +module.exports['uasort'] = require('./uasort'); +module.exports['uksort'] = require('./uksort'); +module.exports['usort'] = require('./usort'); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/index.js.map b/node_modules/locutus/php/array/index.js.map new file mode 100644 index 0000000..1679e79 --- /dev/null +++ b/node_modules/locutus/php/array/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/index.js"],"names":["module","exports","require"],"mappings":"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","file":"index.js","sourcesContent":["module.exports['array_change_key_case'] = require('./array_change_key_case')\nmodule.exports['array_chunk'] = require('./array_chunk')\nmodule.exports['array_combine'] = require('./array_combine')\nmodule.exports['array_count_values'] = require('./array_count_values')\nmodule.exports['array_diff'] = require('./array_diff')\nmodule.exports['array_diff_assoc'] = require('./array_diff_assoc')\nmodule.exports['array_diff_key'] = require('./array_diff_key')\nmodule.exports['array_diff_uassoc'] = require('./array_diff_uassoc')\nmodule.exports['array_diff_ukey'] = require('./array_diff_ukey')\nmodule.exports['array_fill'] = require('./array_fill')\nmodule.exports['array_fill_keys'] = require('./array_fill_keys')\nmodule.exports['array_filter'] = require('./array_filter')\nmodule.exports['array_flip'] = require('./array_flip')\nmodule.exports['array_intersect'] = require('./array_intersect')\nmodule.exports['array_intersect_assoc'] = require('./array_intersect_assoc')\nmodule.exports['array_intersect_key'] = require('./array_intersect_key')\nmodule.exports['array_intersect_uassoc'] = require('./array_intersect_uassoc')\nmodule.exports['array_intersect_ukey'] = require('./array_intersect_ukey')\nmodule.exports['array_key_exists'] = require('./array_key_exists')\nmodule.exports['array_keys'] = require('./array_keys')\nmodule.exports['array_map'] = require('./array_map')\nmodule.exports['array_merge'] = require('./array_merge')\nmodule.exports['array_merge_recursive'] = require('./array_merge_recursive')\nmodule.exports['array_multisort'] = require('./array_multisort')\nmodule.exports['array_pad'] = require('./array_pad')\nmodule.exports['array_pop'] = require('./array_pop')\nmodule.exports['array_product'] = require('./array_product')\nmodule.exports['array_push'] = require('./array_push')\nmodule.exports['array_rand'] = require('./array_rand')\nmodule.exports['array_reduce'] = require('./array_reduce')\nmodule.exports['array_replace'] = require('./array_replace')\nmodule.exports['array_replace_recursive'] = require('./array_replace_recursive')\nmodule.exports['array_reverse'] = require('./array_reverse')\nmodule.exports['array_search'] = require('./array_search')\nmodule.exports['array_shift'] = require('./array_shift')\nmodule.exports['array_slice'] = require('./array_slice')\nmodule.exports['array_splice'] = require('./array_splice')\nmodule.exports['array_sum'] = require('./array_sum')\nmodule.exports['array_udiff'] = require('./array_udiff')\nmodule.exports['array_udiff_assoc'] = require('./array_udiff_assoc')\nmodule.exports['array_udiff_uassoc'] = require('./array_udiff_uassoc')\nmodule.exports['array_uintersect'] = require('./array_uintersect')\nmodule.exports['array_uintersect_uassoc'] = require('./array_uintersect_uassoc')\nmodule.exports['array_unique'] = require('./array_unique')\nmodule.exports['array_unshift'] = require('./array_unshift')\nmodule.exports['array_values'] = require('./array_values')\nmodule.exports['array_walk'] = require('./array_walk')\nmodule.exports['array_walk_recursive'] = require('./array_walk_recursive')\nmodule.exports['arsort'] = require('./arsort')\nmodule.exports['asort'] = require('./asort')\nmodule.exports['count'] = require('./count')\nmodule.exports['current'] = require('./current')\nmodule.exports['each'] = require('./each')\nmodule.exports['end'] = require('./end')\nmodule.exports['in_array'] = require('./in_array')\nmodule.exports['key'] = require('./key')\nmodule.exports['krsort'] = require('./krsort')\nmodule.exports['ksort'] = require('./ksort')\nmodule.exports['natcasesort'] = require('./natcasesort')\nmodule.exports['natsort'] = require('./natsort')\nmodule.exports['next'] = require('./next')\nmodule.exports['pos'] = require('./pos')\nmodule.exports['prev'] = require('./prev')\nmodule.exports['range'] = require('./range')\nmodule.exports['reset'] = require('./reset')\nmodule.exports['rsort'] = require('./rsort')\nmodule.exports['shuffle'] = require('./shuffle')\nmodule.exports['sizeof'] = require('./sizeof')\nmodule.exports['sort'] = require('./sort')\nmodule.exports['uasort'] = require('./uasort')\nmodule.exports['uksort'] = require('./uksort')\nmodule.exports['usort'] = require('./usort')\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/key.js b/node_modules/locutus/php/array/key.js new file mode 100644 index 0000000..0fc5977 --- /dev/null +++ b/node_modules/locutus/php/array/key.js @@ -0,0 +1,54 @@ +'use strict'; + +module.exports = function key(arr) { + // discuss at: http://locutus.io/php/key/ + // original by: Brett Zamir (http://brett-zamir.me) + // input by: Riddler (http://www.frontierwebdev.com/) + // bugfixed by: Brett Zamir (http://brett-zamir.me) + // note 1: Uses global: locutus to store the array pointer + // example 1: var $array = {fruit1: 'apple', 'fruit2': 'orange'} + // example 1: key($array) + // returns 1: 'fruit1' + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.pointers = $locutus.php.pointers || []; + var pointers = $locutus.php.pointers; + + var indexOf = function indexOf(value) { + for (var i = 0, length = this.length; i < length; i++) { + if (this[i] === value) { + return i; + } + } + return -1; + }; + + if (!pointers.indexOf) { + pointers.indexOf = indexOf; + } + + if (pointers.indexOf(arr) === -1) { + pointers.push(arr, 0); + } + var cursor = pointers[pointers.indexOf(arr) + 1]; + if (Object.prototype.toString.call(arr) !== '[object Array]') { + var ct = 0; + for (var k in arr) { + if (ct === cursor) { + return k; + } + ct++; + } + // Empty + return false; + } + if (arr.length === 0) { + return false; + } + + return cursor; +}; +//# sourceMappingURL=key.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/key.js.map b/node_modules/locutus/php/array/key.js.map new file mode 100644 index 0000000..9776e32 --- /dev/null +++ b/node_modules/locutus/php/array/key.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/key.js"],"names":["module","exports","key","arr","$global","window","global","$locutus","php","pointers","indexOf","value","i","length","push","cursor","Object","prototype","toString","call","ct","k"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,GAAT,CAAcC,GAAd,EAAmB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;AACAF,UAAQG,QAAR,GAAmBH,QAAQG,QAAR,IAAoB,EAAvC;AACA,MAAIA,WAAWH,QAAQG,QAAvB;AACAA,WAASC,GAAT,GAAeD,SAASC,GAAT,IAAgB,EAA/B;AACAD,WAASC,GAAT,CAAaC,QAAb,GAAwBF,SAASC,GAAT,CAAaC,QAAb,IAAyB,EAAjD;AACA,MAAIA,WAAWF,SAASC,GAAT,CAAaC,QAA5B;;AAEA,MAAIC,UAAU,SAAVA,OAAU,CAAUC,KAAV,EAAiB;AAC7B,SAAK,IAAIC,IAAI,CAAR,EAAWC,SAAS,KAAKA,MAA9B,EAAsCD,IAAIC,MAA1C,EAAkDD,GAAlD,EAAuD;AACrD,UAAI,KAAKA,CAAL,MAAYD,KAAhB,EAAuB;AACrB,eAAOC,CAAP;AACD;AACF;AACD,WAAO,CAAC,CAAR;AACD,GAPD;;AASA,MAAI,CAACH,SAASC,OAAd,EAAuB;AACrBD,aAASC,OAAT,GAAmBA,OAAnB;AACD;;AAED,MAAID,SAASC,OAAT,CAAiBP,GAAjB,MAA0B,CAAC,CAA/B,EAAkC;AAChCM,aAASK,IAAT,CAAcX,GAAd,EAAmB,CAAnB;AACD;AACD,MAAIY,SAASN,SAASA,SAASC,OAAT,CAAiBP,GAAjB,IAAwB,CAAjC,CAAb;AACA,MAAIa,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BhB,GAA/B,MAAwC,gBAA5C,EAA8D;AAC5D,QAAIiB,KAAK,CAAT;AACA,SAAK,IAAIC,CAAT,IAAclB,GAAd,EAAmB;AACjB,UAAIiB,OAAOL,MAAX,EAAmB;AACjB,eAAOM,CAAP;AACD;AACDD;AACD;AACD;AACA,WAAO,KAAP;AACD;AACD,MAAIjB,IAAIU,MAAJ,KAAe,CAAnB,EAAsB;AACpB,WAAO,KAAP;AACD;;AAED,SAAOE,MAAP;AACD,CAlDD","file":"key.js","sourcesContent":["module.exports = function key (arr) {\n // discuss at: http://locutus.io/php/key/\n // original by: Brett Zamir (http://brett-zamir.me)\n // input by: Riddler (http://www.frontierwebdev.com/)\n // bugfixed by: Brett Zamir (http://brett-zamir.me)\n // note 1: Uses global: locutus to store the array pointer\n // example 1: var $array = {fruit1: 'apple', 'fruit2': 'orange'}\n // example 1: key($array)\n // returns 1: 'fruit1'\n\n var $global = (typeof window !== 'undefined' ? window : global)\n $global.$locutus = $global.$locutus || {}\n var $locutus = $global.$locutus\n $locutus.php = $locutus.php || {}\n $locutus.php.pointers = $locutus.php.pointers || []\n var pointers = $locutus.php.pointers\n\n var indexOf = function (value) {\n for (var i = 0, length = this.length; i < length; i++) {\n if (this[i] === value) {\n return i\n }\n }\n return -1\n }\n\n if (!pointers.indexOf) {\n pointers.indexOf = indexOf\n }\n\n if (pointers.indexOf(arr) === -1) {\n pointers.push(arr, 0)\n }\n var cursor = pointers[pointers.indexOf(arr) + 1]\n if (Object.prototype.toString.call(arr) !== '[object Array]') {\n var ct = 0\n for (var k in arr) {\n if (ct === cursor) {\n return k\n }\n ct++\n }\n // Empty\n return false\n }\n if (arr.length === 0) {\n return false\n }\n\n return cursor\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/krsort.js b/node_modules/locutus/php/array/krsort.js new file mode 100644 index 0000000..2574091 --- /dev/null +++ b/node_modules/locutus/php/array/krsort.js @@ -0,0 +1,117 @@ +'use strict'; + +module.exports = function krsort(inputArr, sortFlags) { + // discuss at: http://locutus.io/php/krsort/ + // original by: GeekFG (http://geekfg.blogspot.com) + // improved by: Kevin van Zonneveld (http://kvz.io) + // improved by: Brett Zamir (http://brett-zamir.me) + // bugfixed by: pseudaria (https://github.com/pseudaria) + // note 1: The examples are correct, this is a new way + // note 1: This function deviates from PHP in returning a copy of the array instead + // note 1: of acting by reference and returning true; this was necessary because + // note 1: IE does not allow deleting and re-adding of properties without caching + // note 1: of property position; you can set the ini of "locutus.sortByReference" to true to + // note 1: get the PHP behavior, but use this only if you are in an environment + // note 1: such as Firefox extensions where for-in iteration order is fixed and true + // note 1: property deletion is supported. Note that we intend to implement the PHP + // note 1: behavior by default if IE ever does allow it; only gives shallow copy since + // note 1: is by reference in PHP anyways + // note 1: Since JS objects' keys are always strings, and (the + // note 1: default) SORT_REGULAR flag distinguishes by key type, + // note 1: if the content is a numeric string, we treat the + // note 1: "original type" as numeric. + // example 1: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'} + // example 1: krsort($data) + // example 1: var $result = $data + // returns 1: {d: 'lemon', c: 'apple', b: 'banana', a: 'orange'} + // example 2: ini_set('locutus.sortByReference', true) + // example 2: var $data = {2: 'van', 3: 'Zonneveld', 1: 'Kevin'} + // example 2: krsort($data) + // example 2: var $result = $data + // returns 2: {3: 'Zonneveld', 2: 'van', 1: 'Kevin'} + + var i18nlgd = require('../i18n/i18n_loc_get_default'); + var strnatcmp = require('../strings/strnatcmp'); + + var tmpArr = {}; + var keys = []; + var sorter; + var i; + var k; + var sortByReference = false; + var populateArr = {}; + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.locales = $locutus.php.locales || {}; + + switch (sortFlags) { + case 'SORT_STRING': + // compare items as strings + sorter = function sorter(a, b) { + return strnatcmp(b, a); + }; + break; + case 'SORT_LOCALE_STRING': + // compare items as strings, based on the current locale + // (set with i18n_loc_set_default() as of PHP6) + var loc = i18nlgd(); + sorter = $locutus.locales[loc].sorting; + break; + case 'SORT_NUMERIC': + // compare items numerically + sorter = function sorter(a, b) { + return b - a; + }; + break; + case 'SORT_REGULAR': + default: + // compare items normally (don't change types) + sorter = function sorter(b, a) { + var aFloat = parseFloat(a); + var bFloat = parseFloat(b); + var aNumeric = aFloat + '' === a; + var bNumeric = bFloat + '' === b; + if (aNumeric && bNumeric) { + return aFloat > bFloat ? 1 : aFloat < bFloat ? -1 : 0; + } else if (aNumeric && !bNumeric) { + return 1; + } else if (!aNumeric && bNumeric) { + return -1; + } + return a > b ? 1 : a < b ? -1 : 0; + }; + break; + } + + // Make a list of key names + for (k in inputArr) { + if (inputArr.hasOwnProperty(k)) { + keys.push(k); + } + } + keys.sort(sorter); + + var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'; + sortByReference = iniVal === 'on'; + populateArr = sortByReference ? inputArr : populateArr; + + // Rebuild array with sorted key names + for (i = 0; i < keys.length; i++) { + k = keys[i]; + tmpArr[k] = inputArr[k]; + if (sortByReference) { + delete inputArr[k]; + } + } + for (i in tmpArr) { + if (tmpArr.hasOwnProperty(i)) { + populateArr[i] = tmpArr[i]; + } + } + + return sortByReference || populateArr; +}; +//# sourceMappingURL=krsort.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/krsort.js.map b/node_modules/locutus/php/array/krsort.js.map new file mode 100644 index 0000000..7e369ea --- /dev/null +++ b/node_modules/locutus/php/array/krsort.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/krsort.js"],"names":["module","exports","krsort","inputArr","sortFlags","i18nlgd","require","strnatcmp","tmpArr","keys","sorter","i","k","sortByReference","populateArr","$global","window","global","$locutus","php","locales","a","b","loc","sorting","aFloat","parseFloat","bFloat","aNumeric","bNumeric","hasOwnProperty","push","sort","iniVal","undefined","length"],"mappings":"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","file":"krsort.js","sourcesContent":["module.exports = function krsort (inputArr, sortFlags) {\n // discuss at: http://locutus.io/php/krsort/\n // original by: GeekFG (http://geekfg.blogspot.com)\n // improved by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // bugfixed by: pseudaria (https://github.com/pseudaria)\n // note 1: The examples are correct, this is a new way\n // note 1: This function deviates from PHP in returning a copy of the array instead\n // note 1: of acting by reference and returning true; this was necessary because\n // note 1: IE does not allow deleting and re-adding of properties without caching\n // note 1: of property position; you can set the ini of \"locutus.sortByReference\" to true to\n // note 1: get the PHP behavior, but use this only if you are in an environment\n // note 1: such as Firefox extensions where for-in iteration order is fixed and true\n // note 1: property deletion is supported. Note that we intend to implement the PHP\n // note 1: behavior by default if IE ever does allow it; only gives shallow copy since\n // note 1: is by reference in PHP anyways\n // note 1: Since JS objects' keys are always strings, and (the\n // note 1: default) SORT_REGULAR flag distinguishes by key type,\n // note 1: if the content is a numeric string, we treat the\n // note 1: \"original type\" as numeric.\n // example 1: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'}\n // example 1: krsort($data)\n // example 1: var $result = $data\n // returns 1: {d: 'lemon', c: 'apple', b: 'banana', a: 'orange'}\n // example 2: ini_set('locutus.sortByReference', true)\n // example 2: var $data = {2: 'van', 3: 'Zonneveld', 1: 'Kevin'}\n // example 2: krsort($data)\n // example 2: var $result = $data\n // returns 2: {3: 'Zonneveld', 2: 'van', 1: 'Kevin'}\n\n var i18nlgd = require('../i18n/i18n_loc_get_default')\n var strnatcmp = require('../strings/strnatcmp')\n\n var tmpArr = {}\n var keys = []\n var sorter\n var i\n var k\n var sortByReference = false\n var populateArr = {}\n\n var $global = (typeof window !== 'undefined' ? window : global)\n $global.$locutus = $global.$locutus || {}\n var $locutus = $global.$locutus\n $locutus.php = $locutus.php || {}\n $locutus.php.locales = $locutus.php.locales || {}\n\n switch (sortFlags) {\n case 'SORT_STRING':\n // compare items as strings\n sorter = function (a, b) {\n return strnatcmp(b, a)\n }\n break\n case 'SORT_LOCALE_STRING':\n // compare items as strings, based on the current locale\n // (set with i18n_loc_set_default() as of PHP6)\n var loc = i18nlgd()\n sorter = $locutus.locales[loc].sorting\n break\n case 'SORT_NUMERIC':\n // compare items numerically\n sorter = function (a, b) {\n return (b - a)\n }\n break\n case 'SORT_REGULAR':\n default:\n // compare items normally (don't change types)\n sorter = function (b, a) {\n var aFloat = parseFloat(a)\n var bFloat = parseFloat(b)\n var aNumeric = aFloat + '' === a\n var bNumeric = bFloat + '' === b\n if (aNumeric && bNumeric) {\n return aFloat > bFloat ? 1 : aFloat < bFloat ? -1 : 0\n } else if (aNumeric && !bNumeric) {\n return 1\n } else if (!aNumeric && bNumeric) {\n return -1\n }\n return a > b ? 1 : a < b ? -1 : 0\n }\n break\n }\n\n // Make a list of key names\n for (k in inputArr) {\n if (inputArr.hasOwnProperty(k)) {\n keys.push(k)\n }\n }\n keys.sort(sorter)\n\n var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'\n sortByReference = iniVal === 'on'\n populateArr = sortByReference ? inputArr : populateArr\n\n // Rebuild array with sorted key names\n for (i = 0; i < keys.length; i++) {\n k = keys[i]\n tmpArr[k] = inputArr[k]\n if (sortByReference) {\n delete inputArr[k]\n }\n }\n for (i in tmpArr) {\n if (tmpArr.hasOwnProperty(i)) {\n populateArr[i] = tmpArr[i]\n }\n }\n\n return sortByReference || populateArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/ksort.js b/node_modules/locutus/php/array/ksort.js new file mode 100644 index 0000000..c85b1be --- /dev/null +++ b/node_modules/locutus/php/array/ksort.js @@ -0,0 +1,114 @@ +'use strict'; + +module.exports = function ksort(inputArr, sortFlags) { + // discuss at: http://locutus.io/php/ksort/ + // original by: GeekFG (http://geekfg.blogspot.com) + // improved by: Kevin van Zonneveld (http://kvz.io) + // improved by: Brett Zamir (http://brett-zamir.me) + // note 1: This function deviates from PHP in returning a copy of the array instead + // note 1: of acting by reference and returning true; this was necessary because + // note 1: IE does not allow deleting and re-adding of properties without caching + // note 1: of property position; you can set the ini of "locutus.sortByReference" to true to + // note 1: get the PHP behavior, but use this only if you are in an environment + // note 1: such as Firefox extensions where for-in iteration order is fixed and true + // note 1: property deletion is supported. Note that we intend to implement the PHP + // note 1: behavior by default if IE ever does allow it; only gives shallow copy since + // note 1: is by reference in PHP anyways + // note 1: Since JS objects' keys are always strings, and (the + // note 1: default) SORT_REGULAR flag distinguishes by key type, + // note 1: if the content is a numeric string, we treat the + // note 1: "original type" as numeric. + // example 1: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'} + // example 1: ksort($data) + // example 1: var $result = $data + // returns 1: {a: 'orange', b: 'banana', c: 'apple', d: 'lemon'} + // example 2: ini_set('locutus.sortByReference', true) + // example 2: var $data = {2: 'van', 3: 'Zonneveld', 1: 'Kevin'} + // example 2: ksort($data) + // example 2: var $result = $data + // returns 2: {1: 'Kevin', 2: 'van', 3: 'Zonneveld'} + + var i18nlgd = require('../i18n/i18n_loc_get_default'); + var strnatcmp = require('../strings/strnatcmp'); + + var tmpArr = {}; + var keys = []; + var sorter; + var i; + var k; + var sortByReference = false; + var populateArr = {}; + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.locales = $locutus.php.locales || {}; + + switch (sortFlags) { + case 'SORT_STRING': + // compare items as strings + sorter = function sorter(a, b) { + return strnatcmp(b, a); + }; + break; + case 'SORT_LOCALE_STRING': + // compare items as strings, based on the current locale + // (set with i18n_loc_set_default() as of PHP6) + var loc = i18nlgd(); + sorter = $locutus.locales[loc].sorting; + break; + case 'SORT_NUMERIC': + // compare items numerically + sorter = function sorter(a, b) { + return a + 0 - (b + 0); + }; + break; + default: + // case 'SORT_REGULAR': // compare items normally (don't change types) + sorter = function sorter(a, b) { + var aFloat = parseFloat(a); + var bFloat = parseFloat(b); + var aNumeric = aFloat + '' === a; + var bNumeric = bFloat + '' === b; + if (aNumeric && bNumeric) { + return aFloat > bFloat ? 1 : aFloat < bFloat ? -1 : 0; + } else if (aNumeric && !bNumeric) { + return 1; + } else if (!aNumeric && bNumeric) { + return -1; + } + return a > b ? 1 : a < b ? -1 : 0; + }; + break; + } + + // Make a list of key names + for (k in inputArr) { + if (inputArr.hasOwnProperty(k)) { + keys.push(k); + } + } + keys.sort(sorter); + + var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'; + sortByReference = iniVal === 'on'; + populateArr = sortByReference ? inputArr : populateArr; + + // Rebuild array with sorted key names + for (i = 0; i < keys.length; i++) { + k = keys[i]; + tmpArr[k] = inputArr[k]; + if (sortByReference) { + delete inputArr[k]; + } + } + for (i in tmpArr) { + if (tmpArr.hasOwnProperty(i)) { + populateArr[i] = tmpArr[i]; + } + } + + return sortByReference || populateArr; +}; +//# sourceMappingURL=ksort.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/ksort.js.map b/node_modules/locutus/php/array/ksort.js.map new file mode 100644 index 0000000..9b55654 --- /dev/null +++ b/node_modules/locutus/php/array/ksort.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/ksort.js"],"names":["module","exports","ksort","inputArr","sortFlags","i18nlgd","require","strnatcmp","tmpArr","keys","sorter","i","k","sortByReference","populateArr","$global","window","global","$locutus","php","locales","a","b","loc","sorting","aFloat","parseFloat","bFloat","aNumeric","bNumeric","hasOwnProperty","push","sort","iniVal","undefined","length"],"mappings":"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","file":"ksort.js","sourcesContent":["module.exports = function ksort (inputArr, sortFlags) {\n // discuss at: http://locutus.io/php/ksort/\n // original by: GeekFG (http://geekfg.blogspot.com)\n // improved by: Kevin van Zonneveld (http://kvz.io)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // note 1: This function deviates from PHP in returning a copy of the array instead\n // note 1: of acting by reference and returning true; this was necessary because\n // note 1: IE does not allow deleting and re-adding of properties without caching\n // note 1: of property position; you can set the ini of \"locutus.sortByReference\" to true to\n // note 1: get the PHP behavior, but use this only if you are in an environment\n // note 1: such as Firefox extensions where for-in iteration order is fixed and true\n // note 1: property deletion is supported. Note that we intend to implement the PHP\n // note 1: behavior by default if IE ever does allow it; only gives shallow copy since\n // note 1: is by reference in PHP anyways\n // note 1: Since JS objects' keys are always strings, and (the\n // note 1: default) SORT_REGULAR flag distinguishes by key type,\n // note 1: if the content is a numeric string, we treat the\n // note 1: \"original type\" as numeric.\n // example 1: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'}\n // example 1: ksort($data)\n // example 1: var $result = $data\n // returns 1: {a: 'orange', b: 'banana', c: 'apple', d: 'lemon'}\n // example 2: ini_set('locutus.sortByReference', true)\n // example 2: var $data = {2: 'van', 3: 'Zonneveld', 1: 'Kevin'}\n // example 2: ksort($data)\n // example 2: var $result = $data\n // returns 2: {1: 'Kevin', 2: 'van', 3: 'Zonneveld'}\n\n var i18nlgd = require('../i18n/i18n_loc_get_default')\n var strnatcmp = require('../strings/strnatcmp')\n\n var tmpArr = {}\n var keys = []\n var sorter\n var i\n var k\n var sortByReference = false\n var populateArr = {}\n\n var $global = (typeof window !== 'undefined' ? window : global)\n $global.$locutus = $global.$locutus || {}\n var $locutus = $global.$locutus\n $locutus.php = $locutus.php || {}\n $locutus.php.locales = $locutus.php.locales || {}\n\n switch (sortFlags) {\n case 'SORT_STRING':\n // compare items as strings\n sorter = function (a, b) {\n return strnatcmp(b, a)\n }\n break\n case 'SORT_LOCALE_STRING':\n // compare items as strings, based on the current locale\n // (set with i18n_loc_set_default() as of PHP6)\n var loc = i18nlgd()\n sorter = $locutus.locales[loc].sorting\n break\n case 'SORT_NUMERIC':\n // compare items numerically\n sorter = function (a, b) {\n return ((a + 0) - (b + 0))\n }\n break\n default:\n // case 'SORT_REGULAR': // compare items normally (don't change types)\n sorter = function (a, b) {\n var aFloat = parseFloat(a)\n var bFloat = parseFloat(b)\n var aNumeric = aFloat + '' === a\n var bNumeric = bFloat + '' === b\n if (aNumeric && bNumeric) {\n return aFloat > bFloat ? 1 : aFloat < bFloat ? -1 : 0\n } else if (aNumeric && !bNumeric) {\n return 1\n } else if (!aNumeric && bNumeric) {\n return -1\n }\n return a > b ? 1 : a < b ? -1 : 0\n }\n break\n }\n\n // Make a list of key names\n for (k in inputArr) {\n if (inputArr.hasOwnProperty(k)) {\n keys.push(k)\n }\n }\n keys.sort(sorter)\n\n var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'\n sortByReference = iniVal === 'on'\n populateArr = sortByReference ? inputArr : populateArr\n\n // Rebuild array with sorted key names\n for (i = 0; i < keys.length; i++) {\n k = keys[i]\n tmpArr[k] = inputArr[k]\n if (sortByReference) {\n delete inputArr[k]\n }\n }\n for (i in tmpArr) {\n if (tmpArr.hasOwnProperty(i)) {\n populateArr[i] = tmpArr[i]\n }\n }\n\n return sortByReference || populateArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/natcasesort.js b/node_modules/locutus/php/array/natcasesort.js new file mode 100644 index 0000000..7dfa8c8 --- /dev/null +++ b/node_modules/locutus/php/array/natcasesort.js @@ -0,0 +1,55 @@ +'use strict'; + +module.exports = function natcasesort(inputArr) { + // discuss at: http://locutus.io/php/natcasesort/ + // original by: Brett Zamir (http://brett-zamir.me) + // improved by: Brett Zamir (http://brett-zamir.me) + // improved by: Theriault (https://github.com/Theriault) + // note 1: This function deviates from PHP in returning a copy of the array instead + // note 1: of acting by reference and returning true; this was necessary because + // note 1: IE does not allow deleting and re-adding of properties without caching + // note 1: of property position; you can set the ini of "locutus.sortByReference" to true to + // note 1: get the PHP behavior, but use this only if you are in an environment + // note 1: such as Firefox extensions where for-in iteration order is fixed and true + // note 1: property deletion is supported. Note that we intend to implement the PHP + // note 1: behavior by default if IE ever does allow it; only gives shallow copy since + // note 1: is by reference in PHP anyways + // note 1: We cannot use numbers as keys and have them be reordered since they + // note 1: adhere to numerical order in some implementations + // example 1: var $array1 = {a:'IMG0.png', b:'img12.png', c:'img10.png', d:'img2.png', e:'img1.png', f:'IMG3.png'} + // example 1: natcasesort($array1) + // example 1: var $result = $array1 + // returns 1: {a: 'IMG0.png', e: 'img1.png', d: 'img2.png', f: 'IMG3.png', c: 'img10.png', b: 'img12.png'} + + var strnatcasecmp = require('../strings/strnatcasecmp'); + var valArr = []; + var k; + var i; + var sortByReference = false; + var populateArr = {}; + + var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'; + sortByReference = iniVal === 'on'; + populateArr = sortByReference ? inputArr : populateArr; + + // Get key and value arrays + for (k in inputArr) { + if (inputArr.hasOwnProperty(k)) { + valArr.push([k, inputArr[k]]); + if (sortByReference) { + delete inputArr[k]; + } + } + } + valArr.sort(function (a, b) { + return strnatcasecmp(a[1], b[1]); + }); + + // Repopulate the old array + for (i = 0; i < valArr.length; i++) { + populateArr[valArr[i][0]] = valArr[i][1]; + } + + return sortByReference || populateArr; +}; +//# sourceMappingURL=natcasesort.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/natcasesort.js.map b/node_modules/locutus/php/array/natcasesort.js.map new file mode 100644 index 0000000..e373569 --- /dev/null +++ b/node_modules/locutus/php/array/natcasesort.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/natcasesort.js"],"names":["module","exports","natcasesort","inputArr","strnatcasecmp","require","valArr","k","i","sortByReference","populateArr","iniVal","undefined","hasOwnProperty","push","sort","a","b","length"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,WAAT,CAAsBC,QAAtB,EAAgC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,gBAAgBC,QAAQ,0BAAR,CAApB;AACA,MAAIC,SAAS,EAAb;AACA,MAAIC,CAAJ;AACA,MAAIC,CAAJ;AACA,MAAIC,kBAAkB,KAAtB;AACA,MAAIC,cAAc,EAAlB;;AAEA,MAAIC,SAAS,CAAC,OAAON,OAAP,KAAmB,WAAnB,GAAiCA,QAAQ,iBAAR,EAA2B,yBAA3B,CAAjC,GAAyFO,SAA1F,KAAwG,IAArH;AACAH,oBAAkBE,WAAW,IAA7B;AACAD,gBAAcD,kBAAkBN,QAAlB,GAA6BO,WAA3C;;AAEA;AACA,OAAKH,CAAL,IAAUJ,QAAV,EAAoB;AAClB,QAAIA,SAASU,cAAT,CAAwBN,CAAxB,CAAJ,EAAgC;AAC9BD,aAAOQ,IAAP,CAAY,CAACP,CAAD,EAAIJ,SAASI,CAAT,CAAJ,CAAZ;AACA,UAAIE,eAAJ,EAAqB;AACnB,eAAON,SAASI,CAAT,CAAP;AACD;AACF;AACF;AACDD,SAAOS,IAAP,CAAY,UAAUC,CAAV,EAAaC,CAAb,EAAgB;AAC1B,WAAOb,cAAcY,EAAE,CAAF,CAAd,EAAoBC,EAAE,CAAF,CAApB,CAAP;AACD,GAFD;;AAIA;AACA,OAAKT,IAAI,CAAT,EAAYA,IAAIF,OAAOY,MAAvB,EAA+BV,GAA/B,EAAoC;AAClCE,gBAAYJ,OAAOE,CAAP,EAAU,CAAV,CAAZ,IAA4BF,OAAOE,CAAP,EAAU,CAAV,CAA5B;AACD;;AAED,SAAOC,mBAAmBC,WAA1B;AACD,CAnDD","file":"natcasesort.js","sourcesContent":["module.exports = function natcasesort (inputArr) {\n // discuss at: http://locutus.io/php/natcasesort/\n // original by: Brett Zamir (http://brett-zamir.me)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // improved by: Theriault (https://github.com/Theriault)\n // note 1: This function deviates from PHP in returning a copy of the array instead\n // note 1: of acting by reference and returning true; this was necessary because\n // note 1: IE does not allow deleting and re-adding of properties without caching\n // note 1: of property position; you can set the ini of \"locutus.sortByReference\" to true to\n // note 1: get the PHP behavior, but use this only if you are in an environment\n // note 1: such as Firefox extensions where for-in iteration order is fixed and true\n // note 1: property deletion is supported. Note that we intend to implement the PHP\n // note 1: behavior by default if IE ever does allow it; only gives shallow copy since\n // note 1: is by reference in PHP anyways\n // note 1: We cannot use numbers as keys and have them be reordered since they\n // note 1: adhere to numerical order in some implementations\n // example 1: var $array1 = {a:'IMG0.png', b:'img12.png', c:'img10.png', d:'img2.png', e:'img1.png', f:'IMG3.png'}\n // example 1: natcasesort($array1)\n // example 1: var $result = $array1\n // returns 1: {a: 'IMG0.png', e: 'img1.png', d: 'img2.png', f: 'IMG3.png', c: 'img10.png', b: 'img12.png'}\n\n var strnatcasecmp = require('../strings/strnatcasecmp')\n var valArr = []\n var k\n var i\n var sortByReference = false\n var populateArr = {}\n\n var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'\n sortByReference = iniVal === 'on'\n populateArr = sortByReference ? inputArr : populateArr\n\n // Get key and value arrays\n for (k in inputArr) {\n if (inputArr.hasOwnProperty(k)) {\n valArr.push([k, inputArr[k]])\n if (sortByReference) {\n delete inputArr[k]\n }\n }\n }\n valArr.sort(function (a, b) {\n return strnatcasecmp(a[1], b[1])\n })\n\n // Repopulate the old array\n for (i = 0; i < valArr.length; i++) {\n populateArr[valArr[i][0]] = valArr[i][1]\n }\n\n return sortByReference || populateArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/natsort.js b/node_modules/locutus/php/array/natsort.js new file mode 100644 index 0000000..bb6b5b0 --- /dev/null +++ b/node_modules/locutus/php/array/natsort.js @@ -0,0 +1,54 @@ +'use strict'; + +module.exports = function natsort(inputArr) { + // discuss at: http://locutus.io/php/natsort/ + // original by: Brett Zamir (http://brett-zamir.me) + // improved by: Brett Zamir (http://brett-zamir.me) + // improved by: Theriault (https://github.com/Theriault) + // note 1: This function deviates from PHP in returning a copy of the array instead + // note 1: of acting by reference and returning true; this was necessary because + // note 1: IE does not allow deleting and re-adding of properties without caching + // note 1: of property position; you can set the ini of "locutus.sortByReference" to true to + // note 1: get the PHP behavior, but use this only if you are in an environment + // note 1: such as Firefox extensions where for-in iteration order is fixed and true + // note 1: property deletion is supported. Note that we intend to implement the PHP + // note 1: behavior by default if IE ever does allow it; only gives shallow copy since + // note 1: is by reference in PHP anyways + // example 1: var $array1 = {a:"img12.png", b:"img10.png", c:"img2.png", d:"img1.png"} + // example 1: natsort($array1) + // example 1: var $result = $array1 + // returns 1: {d: 'img1.png', c: 'img2.png', b: 'img10.png', a: 'img12.png'} + + var strnatcmp = require('../strings/strnatcmp'); + + var valArr = []; + var k; + var i; + var sortByReference = false; + var populateArr = {}; + + var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'; + sortByReference = iniVal === 'on'; + populateArr = sortByReference ? inputArr : populateArr; + + // Get key and value arrays + for (k in inputArr) { + if (inputArr.hasOwnProperty(k)) { + valArr.push([k, inputArr[k]]); + if (sortByReference) { + delete inputArr[k]; + } + } + } + valArr.sort(function (a, b) { + return strnatcmp(a[1], b[1]); + }); + + // Repopulate the old array + for (i = 0; i < valArr.length; i++) { + populateArr[valArr[i][0]] = valArr[i][1]; + } + + return sortByReference || populateArr; +}; +//# sourceMappingURL=natsort.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/natsort.js.map b/node_modules/locutus/php/array/natsort.js.map new file mode 100644 index 0000000..7690b08 --- /dev/null +++ b/node_modules/locutus/php/array/natsort.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/natsort.js"],"names":["module","exports","natsort","inputArr","strnatcmp","require","valArr","k","i","sortByReference","populateArr","iniVal","undefined","hasOwnProperty","push","sort","a","b","length"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,OAAT,CAAkBC,QAAlB,EAA4B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,YAAYC,QAAQ,sBAAR,CAAhB;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,CAAJ;AACA,MAAIC,CAAJ;AACA,MAAIC,kBAAkB,KAAtB;AACA,MAAIC,cAAc,EAAlB;;AAEA,MAAIC,SAAS,CAAC,OAAON,OAAP,KAAmB,WAAnB,GAAiCA,QAAQ,iBAAR,EAA2B,yBAA3B,CAAjC,GAAyFO,SAA1F,KAAwG,IAArH;AACAH,oBAAkBE,WAAW,IAA7B;AACAD,gBAAcD,kBAAkBN,QAAlB,GAA6BO,WAA3C;;AAEA;AACA,OAAKH,CAAL,IAAUJ,QAAV,EAAoB;AAClB,QAAIA,SAASU,cAAT,CAAwBN,CAAxB,CAAJ,EAAgC;AAC9BD,aAAOQ,IAAP,CAAY,CAACP,CAAD,EAAIJ,SAASI,CAAT,CAAJ,CAAZ;AACA,UAAIE,eAAJ,EAAqB;AACnB,eAAON,SAASI,CAAT,CAAP;AACD;AACF;AACF;AACDD,SAAOS,IAAP,CAAY,UAAUC,CAAV,EAAaC,CAAb,EAAgB;AAC1B,WAAOb,UAAUY,EAAE,CAAF,CAAV,EAAgBC,EAAE,CAAF,CAAhB,CAAP;AACD,GAFD;;AAIA;AACA,OAAKT,IAAI,CAAT,EAAYA,IAAIF,OAAOY,MAAvB,EAA+BV,GAA/B,EAAoC;AAClCE,gBAAYJ,OAAOE,CAAP,EAAU,CAAV,CAAZ,IAA4BF,OAAOE,CAAP,EAAU,CAAV,CAA5B;AACD;;AAED,SAAOC,mBAAmBC,WAA1B;AACD,CAlDD","file":"natsort.js","sourcesContent":["module.exports = function natsort (inputArr) {\n // discuss at: http://locutus.io/php/natsort/\n // original by: Brett Zamir (http://brett-zamir.me)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // improved by: Theriault (https://github.com/Theriault)\n // note 1: This function deviates from PHP in returning a copy of the array instead\n // note 1: of acting by reference and returning true; this was necessary because\n // note 1: IE does not allow deleting and re-adding of properties without caching\n // note 1: of property position; you can set the ini of \"locutus.sortByReference\" to true to\n // note 1: get the PHP behavior, but use this only if you are in an environment\n // note 1: such as Firefox extensions where for-in iteration order is fixed and true\n // note 1: property deletion is supported. Note that we intend to implement the PHP\n // note 1: behavior by default if IE ever does allow it; only gives shallow copy since\n // note 1: is by reference in PHP anyways\n // example 1: var $array1 = {a:\"img12.png\", b:\"img10.png\", c:\"img2.png\", d:\"img1.png\"}\n // example 1: natsort($array1)\n // example 1: var $result = $array1\n // returns 1: {d: 'img1.png', c: 'img2.png', b: 'img10.png', a: 'img12.png'}\n\n var strnatcmp = require('../strings/strnatcmp')\n\n var valArr = []\n var k\n var i\n var sortByReference = false\n var populateArr = {}\n\n var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'\n sortByReference = iniVal === 'on'\n populateArr = sortByReference ? inputArr : populateArr\n\n // Get key and value arrays\n for (k in inputArr) {\n if (inputArr.hasOwnProperty(k)) {\n valArr.push([k, inputArr[k]])\n if (sortByReference) {\n delete inputArr[k]\n }\n }\n }\n valArr.sort(function (a, b) {\n return strnatcmp(a[1], b[1])\n })\n\n // Repopulate the old array\n for (i = 0; i < valArr.length; i++) {\n populateArr[valArr[i][0]] = valArr[i][1]\n }\n\n return sortByReference || populateArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/next.js b/node_modules/locutus/php/array/next.js new file mode 100644 index 0000000..b959f6c --- /dev/null +++ b/node_modules/locutus/php/array/next.js @@ -0,0 +1,54 @@ +'use strict'; + +module.exports = function next(arr) { + // discuss at: http://locutus.io/php/next/ + // original by: Brett Zamir (http://brett-zamir.me) + // note 1: Uses global: locutus to store the array pointer + // example 1: var $transport = ['foot', 'bike', 'car', 'plane'] + // example 1: next($transport) + // example 1: next($transport) + // returns 1: 'car' + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.pointers = $locutus.php.pointers || []; + var pointers = $locutus.php.pointers; + + var indexOf = function indexOf(value) { + for (var i = 0, length = this.length; i < length; i++) { + if (this[i] === value) { + return i; + } + } + return -1; + }; + + if (!pointers.indexOf) { + pointers.indexOf = indexOf; + } + if (pointers.indexOf(arr) === -1) { + pointers.push(arr, 0); + } + var arrpos = pointers.indexOf(arr); + var cursor = pointers[arrpos + 1]; + if (Object.prototype.toString.call(arr) !== '[object Array]') { + var ct = 0; + for (var k in arr) { + if (ct === cursor + 1) { + pointers[arrpos + 1] += 1; + return arr[k]; + } + ct++; + } + // End + return false; + } + if (arr.length === 0 || cursor === arr.length - 1) { + return false; + } + pointers[arrpos + 1] += 1; + return arr[pointers[arrpos + 1]]; +}; +//# sourceMappingURL=next.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/next.js.map b/node_modules/locutus/php/array/next.js.map new file mode 100644 index 0000000..eac5609 --- /dev/null +++ b/node_modules/locutus/php/array/next.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/next.js"],"names":["module","exports","next","arr","$global","window","global","$locutus","php","pointers","indexOf","value","i","length","push","arrpos","cursor","Object","prototype","toString","call","ct","k"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,IAAT,CAAeC,GAAf,EAAoB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;AACAF,UAAQG,QAAR,GAAmBH,QAAQG,QAAR,IAAoB,EAAvC;AACA,MAAIA,WAAWH,QAAQG,QAAvB;AACAA,WAASC,GAAT,GAAeD,SAASC,GAAT,IAAgB,EAA/B;AACAD,WAASC,GAAT,CAAaC,QAAb,GAAwBF,SAASC,GAAT,CAAaC,QAAb,IAAyB,EAAjD;AACA,MAAIA,WAAWF,SAASC,GAAT,CAAaC,QAA5B;;AAEA,MAAIC,UAAU,SAAVA,OAAU,CAAUC,KAAV,EAAiB;AAC7B,SAAK,IAAIC,IAAI,CAAR,EAAWC,SAAS,KAAKA,MAA9B,EAAsCD,IAAIC,MAA1C,EAAkDD,GAAlD,EAAuD;AACrD,UAAI,KAAKA,CAAL,MAAYD,KAAhB,EAAuB;AACrB,eAAOC,CAAP;AACD;AACF;AACD,WAAO,CAAC,CAAR;AACD,GAPD;;AASA,MAAI,CAACH,SAASC,OAAd,EAAuB;AACrBD,aAASC,OAAT,GAAmBA,OAAnB;AACD;AACD,MAAID,SAASC,OAAT,CAAiBP,GAAjB,MAA0B,CAAC,CAA/B,EAAkC;AAChCM,aAASK,IAAT,CAAcX,GAAd,EAAmB,CAAnB;AACD;AACD,MAAIY,SAASN,SAASC,OAAT,CAAiBP,GAAjB,CAAb;AACA,MAAIa,SAASP,SAASM,SAAS,CAAlB,CAAb;AACA,MAAIE,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BjB,GAA/B,MAAwC,gBAA5C,EAA8D;AAC5D,QAAIkB,KAAK,CAAT;AACA,SAAK,IAAIC,CAAT,IAAcnB,GAAd,EAAmB;AACjB,UAAIkB,OAAOL,SAAS,CAApB,EAAuB;AACrBP,iBAASM,SAAS,CAAlB,KAAwB,CAAxB;AACA,eAAOZ,IAAImB,CAAJ,CAAP;AACD;AACDD;AACD;AACD;AACA,WAAO,KAAP;AACD;AACD,MAAIlB,IAAIU,MAAJ,KAAe,CAAf,IAAoBG,WAAYb,IAAIU,MAAJ,GAAa,CAAjD,EAAqD;AACnD,WAAO,KAAP;AACD;AACDJ,WAASM,SAAS,CAAlB,KAAwB,CAAxB;AACA,SAAOZ,IAAIM,SAASM,SAAS,CAAlB,CAAJ,CAAP;AACD,CAlDD","file":"next.js","sourcesContent":["module.exports = function next (arr) {\n // discuss at: http://locutus.io/php/next/\n // original by: Brett Zamir (http://brett-zamir.me)\n // note 1: Uses global: locutus to store the array pointer\n // example 1: var $transport = ['foot', 'bike', 'car', 'plane']\n // example 1: next($transport)\n // example 1: next($transport)\n // returns 1: 'car'\n\n var $global = (typeof window !== 'undefined' ? window : global)\n $global.$locutus = $global.$locutus || {}\n var $locutus = $global.$locutus\n $locutus.php = $locutus.php || {}\n $locutus.php.pointers = $locutus.php.pointers || []\n var pointers = $locutus.php.pointers\n\n var indexOf = function (value) {\n for (var i = 0, length = this.length; i < length; i++) {\n if (this[i] === value) {\n return i\n }\n }\n return -1\n }\n\n if (!pointers.indexOf) {\n pointers.indexOf = indexOf\n }\n if (pointers.indexOf(arr) === -1) {\n pointers.push(arr, 0)\n }\n var arrpos = pointers.indexOf(arr)\n var cursor = pointers[arrpos + 1]\n if (Object.prototype.toString.call(arr) !== '[object Array]') {\n var ct = 0\n for (var k in arr) {\n if (ct === cursor + 1) {\n pointers[arrpos + 1] += 1\n return arr[k]\n }\n ct++\n }\n // End\n return false\n }\n if (arr.length === 0 || cursor === (arr.length - 1)) {\n return false\n }\n pointers[arrpos + 1] += 1\n return arr[pointers[arrpos + 1]]\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/pos.js b/node_modules/locutus/php/array/pos.js new file mode 100644 index 0000000..424fd35 --- /dev/null +++ b/node_modules/locutus/php/array/pos.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = function pos(arr) { + // discuss at: http://locutus.io/php/pos/ + // original by: Brett Zamir (http://brett-zamir.me) + // note 1: Uses global: locutus to store the array pointer + // example 1: var $transport = ['foot', 'bike', 'car', 'plane'] + // example 1: pos($transport) + // returns 1: 'foot' + + var current = require('../array/current'); + return current(arr); +}; +//# sourceMappingURL=pos.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/pos.js.map b/node_modules/locutus/php/array/pos.js.map new file mode 100644 index 0000000..e0851b2 --- /dev/null +++ b/node_modules/locutus/php/array/pos.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/pos.js"],"names":["module","exports","pos","arr","current","require"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,GAAT,CAAcC,GAAd,EAAmB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,UAAUC,QAAQ,kBAAR,CAAd;AACA,SAAOD,QAAQD,GAAR,CAAP;AACD,CAVD","file":"pos.js","sourcesContent":["module.exports = function pos (arr) {\n // discuss at: http://locutus.io/php/pos/\n // original by: Brett Zamir (http://brett-zamir.me)\n // note 1: Uses global: locutus to store the array pointer\n // example 1: var $transport = ['foot', 'bike', 'car', 'plane']\n // example 1: pos($transport)\n // returns 1: 'foot'\n\n var current = require('../array/current')\n return current(arr)\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/prev.js b/node_modules/locutus/php/array/prev.js new file mode 100644 index 0000000..88f5511 --- /dev/null +++ b/node_modules/locutus/php/array/prev.js @@ -0,0 +1,52 @@ +'use strict'; + +module.exports = function prev(arr) { + // discuss at: http://locutus.io/php/prev/ + // original by: Brett Zamir (http://brett-zamir.me) + // note 1: Uses global: locutus to store the array pointer + // example 1: var $transport = ['foot', 'bike', 'car', 'plane'] + // example 1: prev($transport) + // returns 1: false + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.pointers = $locutus.php.pointers || []; + var pointers = $locutus.php.pointers; + + var indexOf = function indexOf(value) { + for (var i = 0, length = this.length; i < length; i++) { + if (this[i] === value) { + return i; + } + } + return -1; + }; + + if (!pointers.indexOf) { + pointers.indexOf = indexOf; + } + var arrpos = pointers.indexOf(arr); + var cursor = pointers[arrpos + 1]; + if (pointers.indexOf(arr) === -1 || cursor === 0) { + return false; + } + if (Object.prototype.toString.call(arr) !== '[object Array]') { + var ct = 0; + for (var k in arr) { + if (ct === cursor - 1) { + pointers[arrpos + 1] -= 1; + return arr[k]; + } + ct++; + } + // Shouldn't reach here + } + if (arr.length === 0) { + return false; + } + pointers[arrpos + 1] -= 1; + return arr[pointers[arrpos + 1]]; +}; +//# sourceMappingURL=prev.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/prev.js.map b/node_modules/locutus/php/array/prev.js.map new file mode 100644 index 0000000..7aac714 --- /dev/null +++ b/node_modules/locutus/php/array/prev.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/prev.js"],"names":["module","exports","prev","arr","$global","window","global","$locutus","php","pointers","indexOf","value","i","length","arrpos","cursor","Object","prototype","toString","call","ct","k"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,IAAT,CAAeC,GAAf,EAAoB;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;AACAF,UAAQG,QAAR,GAAmBH,QAAQG,QAAR,IAAoB,EAAvC;AACA,MAAIA,WAAWH,QAAQG,QAAvB;AACAA,WAASC,GAAT,GAAeD,SAASC,GAAT,IAAgB,EAA/B;AACAD,WAASC,GAAT,CAAaC,QAAb,GAAwBF,SAASC,GAAT,CAAaC,QAAb,IAAyB,EAAjD;AACA,MAAIA,WAAWF,SAASC,GAAT,CAAaC,QAA5B;;AAEA,MAAIC,UAAU,SAAVA,OAAU,CAAUC,KAAV,EAAiB;AAC7B,SAAK,IAAIC,IAAI,CAAR,EAAWC,SAAS,KAAKA,MAA9B,EAAsCD,IAAIC,MAA1C,EAAkDD,GAAlD,EAAuD;AACrD,UAAI,KAAKA,CAAL,MAAYD,KAAhB,EAAuB;AACrB,eAAOC,CAAP;AACD;AACF;AACD,WAAO,CAAC,CAAR;AACD,GAPD;;AASA,MAAI,CAACH,SAASC,OAAd,EAAuB;AACrBD,aAASC,OAAT,GAAmBA,OAAnB;AACD;AACD,MAAII,SAASL,SAASC,OAAT,CAAiBP,GAAjB,CAAb;AACA,MAAIY,SAASN,SAASK,SAAS,CAAlB,CAAb;AACA,MAAIL,SAASC,OAAT,CAAiBP,GAAjB,MAA0B,CAAC,CAA3B,IAAgCY,WAAW,CAA/C,EAAkD;AAChD,WAAO,KAAP;AACD;AACD,MAAIC,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BhB,GAA/B,MAAwC,gBAA5C,EAA8D;AAC5D,QAAIiB,KAAK,CAAT;AACA,SAAK,IAAIC,CAAT,IAAclB,GAAd,EAAmB;AACjB,UAAIiB,OAAOL,SAAS,CAApB,EAAuB;AACrBN,iBAASK,SAAS,CAAlB,KAAwB,CAAxB;AACA,eAAOX,IAAIkB,CAAJ,CAAP;AACD;AACDD;AACD;AACD;AACD;AACD,MAAIjB,IAAIU,MAAJ,KAAe,CAAnB,EAAsB;AACpB,WAAO,KAAP;AACD;AACDJ,WAASK,SAAS,CAAlB,KAAwB,CAAxB;AACA,SAAOX,IAAIM,SAASK,SAAS,CAAlB,CAAJ,CAAP;AACD,CAhDD","file":"prev.js","sourcesContent":["module.exports = function prev (arr) {\n // discuss at: http://locutus.io/php/prev/\n // original by: Brett Zamir (http://brett-zamir.me)\n // note 1: Uses global: locutus to store the array pointer\n // example 1: var $transport = ['foot', 'bike', 'car', 'plane']\n // example 1: prev($transport)\n // returns 1: false\n\n var $global = (typeof window !== 'undefined' ? window : global)\n $global.$locutus = $global.$locutus || {}\n var $locutus = $global.$locutus\n $locutus.php = $locutus.php || {}\n $locutus.php.pointers = $locutus.php.pointers || []\n var pointers = $locutus.php.pointers\n\n var indexOf = function (value) {\n for (var i = 0, length = this.length; i < length; i++) {\n if (this[i] === value) {\n return i\n }\n }\n return -1\n }\n\n if (!pointers.indexOf) {\n pointers.indexOf = indexOf\n }\n var arrpos = pointers.indexOf(arr)\n var cursor = pointers[arrpos + 1]\n if (pointers.indexOf(arr) === -1 || cursor === 0) {\n return false\n }\n if (Object.prototype.toString.call(arr) !== '[object Array]') {\n var ct = 0\n for (var k in arr) {\n if (ct === cursor - 1) {\n pointers[arrpos + 1] -= 1\n return arr[k]\n }\n ct++\n }\n // Shouldn't reach here\n }\n if (arr.length === 0) {\n return false\n }\n pointers[arrpos + 1] -= 1\n return arr[pointers[arrpos + 1]]\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/range.js b/node_modules/locutus/php/array/range.js new file mode 100644 index 0000000..0bb67a6 --- /dev/null +++ b/node_modules/locutus/php/array/range.js @@ -0,0 +1,49 @@ +"use strict"; + +module.exports = function range(low, high, step) { + // discuss at: http://locutus.io/php/range/ + // original by: Waldo Malqui Silva (http://waldo.malqui.info) + // example 1: range ( 0, 12 ) + // returns 1: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + // example 2: range( 0, 100, 10 ) + // returns 2: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100] + // example 3: range( 'a', 'i' ) + // returns 3: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'] + // example 4: range( 'c', 'a' ) + // returns 4: ['c', 'b', 'a'] + + var matrix = []; + var iVal; + var endval; + var plus; + var walker = step || 1; + var chars = false; + + if (!isNaN(low) && !isNaN(high)) { + iVal = low; + endval = high; + } else if (isNaN(low) && isNaN(high)) { + chars = true; + iVal = low.charCodeAt(0); + endval = high.charCodeAt(0); + } else { + iVal = isNaN(low) ? 0 : low; + endval = isNaN(high) ? 0 : high; + } + + plus = !(iVal > endval); + if (plus) { + while (iVal <= endval) { + matrix.push(chars ? String.fromCharCode(iVal) : iVal); + iVal += walker; + } + } else { + while (iVal >= endval) { + matrix.push(chars ? String.fromCharCode(iVal) : iVal); + iVal -= walker; + } + } + + return matrix; +}; +//# sourceMappingURL=range.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/range.js.map b/node_modules/locutus/php/array/range.js.map new file mode 100644 index 0000000..c106bc5 --- /dev/null +++ b/node_modules/locutus/php/array/range.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/range.js"],"names":["module","exports","range","low","high","step","matrix","iVal","endval","plus","walker","chars","isNaN","charCodeAt","push","String","fromCharCode"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,KAAT,CAAgBC,GAAhB,EAAqBC,IAArB,EAA2BC,IAA3B,EAAiC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,IAAJ;AACA,MAAIC,MAAJ;AACA,MAAIC,IAAJ;AACA,MAAIC,SAASL,QAAQ,CAArB;AACA,MAAIM,QAAQ,KAAZ;;AAEA,MAAI,CAACC,MAAMT,GAAN,CAAD,IAAe,CAACS,MAAMR,IAAN,CAApB,EAAiC;AAC/BG,WAAOJ,GAAP;AACAK,aAASJ,IAAT;AACD,GAHD,MAGO,IAAIQ,MAAMT,GAAN,KAAcS,MAAMR,IAAN,CAAlB,EAA+B;AACpCO,YAAQ,IAAR;AACAJ,WAAOJ,IAAIU,UAAJ,CAAe,CAAf,CAAP;AACAL,aAASJ,KAAKS,UAAL,CAAgB,CAAhB,CAAT;AACD,GAJM,MAIA;AACLN,WAAQK,MAAMT,GAAN,IAAa,CAAb,GAAiBA,GAAzB;AACAK,aAAUI,MAAMR,IAAN,IAAc,CAAd,GAAkBA,IAA5B;AACD;;AAEDK,SAAO,EAAEF,OAAOC,MAAT,CAAP;AACA,MAAIC,IAAJ,EAAU;AACR,WAAOF,QAAQC,MAAf,EAAuB;AACrBF,aAAOQ,IAAP,CAAcH,KAAD,GAAUI,OAAOC,YAAP,CAAoBT,IAApB,CAAV,GAAsCA,IAAnD;AACAA,cAAQG,MAAR;AACD;AACF,GALD,MAKO;AACL,WAAOH,QAAQC,MAAf,EAAuB;AACrBF,aAAOQ,IAAP,CAAcH,KAAD,GAAUI,OAAOC,YAAP,CAAoBT,IAApB,CAAV,GAAsCA,IAAnD;AACAA,cAAQG,MAAR;AACD;AACF;;AAED,SAAOJ,MAAP;AACD,CA7CD","file":"range.js","sourcesContent":["module.exports = function range (low, high, step) {\n // discuss at: http://locutus.io/php/range/\n // original by: Waldo Malqui Silva (http://waldo.malqui.info)\n // example 1: range ( 0, 12 )\n // returns 1: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n // example 2: range( 0, 100, 10 )\n // returns 2: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]\n // example 3: range( 'a', 'i' )\n // returns 3: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']\n // example 4: range( 'c', 'a' )\n // returns 4: ['c', 'b', 'a']\n\n var matrix = []\n var iVal\n var endval\n var plus\n var walker = step || 1\n var chars = false\n\n if (!isNaN(low) && !isNaN(high)) {\n iVal = low\n endval = high\n } else if (isNaN(low) && isNaN(high)) {\n chars = true\n iVal = low.charCodeAt(0)\n endval = high.charCodeAt(0)\n } else {\n iVal = (isNaN(low) ? 0 : low)\n endval = (isNaN(high) ? 0 : high)\n }\n\n plus = !(iVal > endval)\n if (plus) {\n while (iVal <= endval) {\n matrix.push(((chars) ? String.fromCharCode(iVal) : iVal))\n iVal += walker\n }\n } else {\n while (iVal >= endval) {\n matrix.push(((chars) ? String.fromCharCode(iVal) : iVal))\n iVal -= walker\n }\n }\n\n return matrix\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/reset.js b/node_modules/locutus/php/array/reset.js new file mode 100644 index 0000000..dd3ec3f --- /dev/null +++ b/node_modules/locutus/php/array/reset.js @@ -0,0 +1,53 @@ +'use strict'; + +module.exports = function reset(arr) { + // discuss at: http://locutus.io/php/reset/ + // original by: Kevin van Zonneveld (http://kvz.io) + // bugfixed by: Legaev Andrey + // revised by: Brett Zamir (http://brett-zamir.me) + // note 1: Uses global: locutus to store the array pointer + // example 1: reset({0: 'Kevin', 1: 'van', 2: 'Zonneveld'}) + // returns 1: 'Kevin' + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.pointers = $locutus.php.pointers || []; + var pointers = $locutus.php.pointers; + + var indexOf = function indexOf(value) { + for (var i = 0, length = this.length; i < length; i++) { + if (this[i] === value) { + return i; + } + } + return -1; + }; + + if (!pointers.indexOf) { + pointers.indexOf = indexOf; + } + if (pointers.indexOf(arr) === -1) { + pointers.push(arr, 0); + } + var arrpos = pointers.indexOf(arr); + if (Object.prototype.toString.call(arr) !== '[object Array]') { + for (var k in arr) { + if (pointers.indexOf(arr) === -1) { + pointers.push(arr, 0); + } else { + pointers[arrpos + 1] = 0; + } + return arr[k]; + } + // Empty + return false; + } + if (arr.length === 0) { + return false; + } + pointers[arrpos + 1] = 0; + return arr[pointers[arrpos + 1]]; +}; +//# sourceMappingURL=reset.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/reset.js.map b/node_modules/locutus/php/array/reset.js.map new file mode 100644 index 0000000..2919d4f --- /dev/null +++ b/node_modules/locutus/php/array/reset.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/reset.js"],"names":["module","exports","reset","arr","$global","window","global","$locutus","php","pointers","indexOf","value","i","length","push","arrpos","Object","prototype","toString","call","k"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,KAAT,CAAgBC,GAAhB,EAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;AACAF,UAAQG,QAAR,GAAmBH,QAAQG,QAAR,IAAoB,EAAvC;AACA,MAAIA,WAAWH,QAAQG,QAAvB;AACAA,WAASC,GAAT,GAAeD,SAASC,GAAT,IAAgB,EAA/B;AACAD,WAASC,GAAT,CAAaC,QAAb,GAAwBF,SAASC,GAAT,CAAaC,QAAb,IAAyB,EAAjD;AACA,MAAIA,WAAWF,SAASC,GAAT,CAAaC,QAA5B;;AAEA,MAAIC,UAAU,SAAVA,OAAU,CAAUC,KAAV,EAAiB;AAC7B,SAAK,IAAIC,IAAI,CAAR,EAAWC,SAAS,KAAKA,MAA9B,EAAsCD,IAAIC,MAA1C,EAAkDD,GAAlD,EAAuD;AACrD,UAAI,KAAKA,CAAL,MAAYD,KAAhB,EAAuB;AACrB,eAAOC,CAAP;AACD;AACF;AACD,WAAO,CAAC,CAAR;AACD,GAPD;;AASA,MAAI,CAACH,SAASC,OAAd,EAAuB;AACrBD,aAASC,OAAT,GAAmBA,OAAnB;AACD;AACD,MAAID,SAASC,OAAT,CAAiBP,GAAjB,MAA0B,CAAC,CAA/B,EAAkC;AAChCM,aAASK,IAAT,CAAcX,GAAd,EAAmB,CAAnB;AACD;AACD,MAAIY,SAASN,SAASC,OAAT,CAAiBP,GAAjB,CAAb;AACA,MAAIa,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BhB,GAA/B,MAAwC,gBAA5C,EAA8D;AAC5D,SAAK,IAAIiB,CAAT,IAAcjB,GAAd,EAAmB;AACjB,UAAIM,SAASC,OAAT,CAAiBP,GAAjB,MAA0B,CAAC,CAA/B,EAAkC;AAChCM,iBAASK,IAAT,CAAcX,GAAd,EAAmB,CAAnB;AACD,OAFD,MAEO;AACLM,iBAASM,SAAS,CAAlB,IAAuB,CAAvB;AACD;AACD,aAAOZ,IAAIiB,CAAJ,CAAP;AACD;AACD;AACA,WAAO,KAAP;AACD;AACD,MAAIjB,IAAIU,MAAJ,KAAe,CAAnB,EAAsB;AACpB,WAAO,KAAP;AACD;AACDJ,WAASM,SAAS,CAAlB,IAAuB,CAAvB;AACA,SAAOZ,IAAIM,SAASM,SAAS,CAAlB,CAAJ,CAAP;AACD,CAjDD","file":"reset.js","sourcesContent":["module.exports = function reset (arr) {\n // discuss at: http://locutus.io/php/reset/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // bugfixed by: Legaev Andrey\n // revised by: Brett Zamir (http://brett-zamir.me)\n // note 1: Uses global: locutus to store the array pointer\n // example 1: reset({0: 'Kevin', 1: 'van', 2: 'Zonneveld'})\n // returns 1: 'Kevin'\n\n var $global = (typeof window !== 'undefined' ? window : global)\n $global.$locutus = $global.$locutus || {}\n var $locutus = $global.$locutus\n $locutus.php = $locutus.php || {}\n $locutus.php.pointers = $locutus.php.pointers || []\n var pointers = $locutus.php.pointers\n\n var indexOf = function (value) {\n for (var i = 0, length = this.length; i < length; i++) {\n if (this[i] === value) {\n return i\n }\n }\n return -1\n }\n\n if (!pointers.indexOf) {\n pointers.indexOf = indexOf\n }\n if (pointers.indexOf(arr) === -1) {\n pointers.push(arr, 0)\n }\n var arrpos = pointers.indexOf(arr)\n if (Object.prototype.toString.call(arr) !== '[object Array]') {\n for (var k in arr) {\n if (pointers.indexOf(arr) === -1) {\n pointers.push(arr, 0)\n } else {\n pointers[arrpos + 1] = 0\n }\n return arr[k]\n }\n // Empty\n return false\n }\n if (arr.length === 0) {\n return false\n }\n pointers[arrpos + 1] = 0\n return arr[pointers[arrpos + 1]]\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/rsort.js b/node_modules/locutus/php/array/rsort.js new file mode 100644 index 0000000..44f9235 --- /dev/null +++ b/node_modules/locutus/php/array/rsort.js @@ -0,0 +1,113 @@ +'use strict'; + +module.exports = function rsort(inputArr, sortFlags) { + // discuss at: http://locutus.io/php/rsort/ + // original by: Kevin van Zonneveld (http://kvz.io) + // revised by: Brett Zamir (http://brett-zamir.me) + // improved by: Brett Zamir (http://brett-zamir.me) + // note 1: SORT_STRING (as well as natsort and natcasesort) might also be + // note 1: integrated into all of these functions by adapting the code at + // note 1: http://sourcefrog.net/projects/natsort/natcompare.js + // note 1: This function deviates from PHP in returning a copy of the array instead + // note 1: of acting by reference and returning true; this was necessary because + // note 1: IE does not allow deleting and re-adding of properties without caching + // note 1: of property position; you can set the ini of "locutus.sortByReference" to true to + // note 1: get the PHP behavior, but use this only if you are in an environment + // note 1: such as Firefox extensions where for-in iteration order is fixed and true + // note 1: property deletion is supported. Note that we intend to implement the PHP + // note 1: behavior by default if IE ever does allow it; only gives shallow copy since + // note 1: is by reference in PHP anyways + // note 1: Since JS objects' keys are always strings, and (the + // note 1: default) SORT_REGULAR flag distinguishes by key type, + // note 1: if the content is a numeric string, we treat the + // note 1: "original type" as numeric. + // example 1: var $arr = ['Kevin', 'van', 'Zonneveld'] + // example 1: rsort($arr) + // example 1: var $result = $arr + // returns 1: ['van', 'Zonneveld', 'Kevin'] + // example 2: ini_set('locutus.sortByReference', true) + // example 2: var $fruits = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'} + // example 2: rsort($fruits) + // example 2: var $result = $fruits + // returns 2: {0: 'orange', 1: 'lemon', 2: 'banana', 3: 'apple'} + // test: skip-1 + + var i18nlgd = require('../i18n/i18n_loc_get_default'); + var strnatcmp = require('../strings/strnatcmp'); + + var sorter; + var i; + var k; + var sortByReference = false; + var populateArr = {}; + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.locales = $locutus.php.locales || {}; + + switch (sortFlags) { + case 'SORT_STRING': + // compare items as strings + sorter = function sorter(a, b) { + return strnatcmp(b, a); + }; + break; + case 'SORT_LOCALE_STRING': + // compare items as strings, based on the current locale + // (set with i18n_loc_set_default() as of PHP6) + var loc = i18nlgd(); + sorter = $locutus.locales[loc].sorting; + break; + case 'SORT_NUMERIC': + // compare items numerically + sorter = function sorter(a, b) { + return b - a; + }; + break; + case 'SORT_REGULAR': + default: + // compare items normally (don't change types) + sorter = function sorter(b, a) { + var aFloat = parseFloat(a); + var bFloat = parseFloat(b); + var aNumeric = aFloat + '' === a; + var bNumeric = bFloat + '' === b; + if (aNumeric && bNumeric) { + return aFloat > bFloat ? 1 : aFloat < bFloat ? -1 : 0; + } else if (aNumeric && !bNumeric) { + return 1; + } else if (!aNumeric && bNumeric) { + return -1; + } + return a > b ? 1 : a < b ? -1 : 0; + }; + break; + } + + var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'; + sortByReference = iniVal === 'on'; + populateArr = sortByReference ? inputArr : populateArr; + var valArr = []; + + for (k in inputArr) { + // Get key and value arrays + if (inputArr.hasOwnProperty(k)) { + valArr.push(inputArr[k]); + if (sortByReference) { + delete inputArr[k]; + } + } + } + + valArr.sort(sorter); + + for (i = 0; i < valArr.length; i++) { + // Repopulate the old array + populateArr[i] = valArr[i]; + } + + return sortByReference || populateArr; +}; +//# sourceMappingURL=rsort.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/rsort.js.map b/node_modules/locutus/php/array/rsort.js.map new file mode 100644 index 0000000..bea83ef --- /dev/null +++ b/node_modules/locutus/php/array/rsort.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/rsort.js"],"names":["module","exports","rsort","inputArr","sortFlags","i18nlgd","require","strnatcmp","sorter","i","k","sortByReference","populateArr","$global","window","global","$locutus","php","locales","a","b","loc","sorting","aFloat","parseFloat","bFloat","aNumeric","bNumeric","iniVal","undefined","valArr","hasOwnProperty","push","sort","length"],"mappings":"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","file":"rsort.js","sourcesContent":["module.exports = function rsort (inputArr, sortFlags) {\n // discuss at: http://locutus.io/php/rsort/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // revised by: Brett Zamir (http://brett-zamir.me)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // note 1: SORT_STRING (as well as natsort and natcasesort) might also be\n // note 1: integrated into all of these functions by adapting the code at\n // note 1: http://sourcefrog.net/projects/natsort/natcompare.js\n // note 1: This function deviates from PHP in returning a copy of the array instead\n // note 1: of acting by reference and returning true; this was necessary because\n // note 1: IE does not allow deleting and re-adding of properties without caching\n // note 1: of property position; you can set the ini of \"locutus.sortByReference\" to true to\n // note 1: get the PHP behavior, but use this only if you are in an environment\n // note 1: such as Firefox extensions where for-in iteration order is fixed and true\n // note 1: property deletion is supported. Note that we intend to implement the PHP\n // note 1: behavior by default if IE ever does allow it; only gives shallow copy since\n // note 1: is by reference in PHP anyways\n // note 1: Since JS objects' keys are always strings, and (the\n // note 1: default) SORT_REGULAR flag distinguishes by key type,\n // note 1: if the content is a numeric string, we treat the\n // note 1: \"original type\" as numeric.\n // example 1: var $arr = ['Kevin', 'van', 'Zonneveld']\n // example 1: rsort($arr)\n // example 1: var $result = $arr\n // returns 1: ['van', 'Zonneveld', 'Kevin']\n // example 2: ini_set('locutus.sortByReference', true)\n // example 2: var $fruits = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'}\n // example 2: rsort($fruits)\n // example 2: var $result = $fruits\n // returns 2: {0: 'orange', 1: 'lemon', 2: 'banana', 3: 'apple'}\n // test: skip-1\n\n var i18nlgd = require('../i18n/i18n_loc_get_default')\n var strnatcmp = require('../strings/strnatcmp')\n\n var sorter\n var i\n var k\n var sortByReference = false\n var populateArr = {}\n\n var $global = (typeof window !== 'undefined' ? window : global)\n $global.$locutus = $global.$locutus || {}\n var $locutus = $global.$locutus\n $locutus.php = $locutus.php || {}\n $locutus.php.locales = $locutus.php.locales || {}\n\n switch (sortFlags) {\n case 'SORT_STRING':\n // compare items as strings\n sorter = function (a, b) {\n return strnatcmp(b, a)\n }\n break\n case 'SORT_LOCALE_STRING':\n // compare items as strings, based on the current locale\n // (set with i18n_loc_set_default() as of PHP6)\n var loc = i18nlgd()\n sorter = $locutus.locales[loc].sorting\n break\n case 'SORT_NUMERIC':\n // compare items numerically\n sorter = function (a, b) {\n return (b - a)\n }\n break\n case 'SORT_REGULAR':\n default:\n // compare items normally (don't change types)\n sorter = function (b, a) {\n var aFloat = parseFloat(a)\n var bFloat = parseFloat(b)\n var aNumeric = aFloat + '' === a\n var bNumeric = bFloat + '' === b\n if (aNumeric && bNumeric) {\n return aFloat > bFloat ? 1 : aFloat < bFloat ? -1 : 0\n } else if (aNumeric && !bNumeric) {\n return 1\n } else if (!aNumeric && bNumeric) {\n return -1\n }\n return a > b ? 1 : a < b ? -1 : 0\n }\n break\n }\n\n var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'\n sortByReference = iniVal === 'on'\n populateArr = sortByReference ? inputArr : populateArr\n var valArr = []\n\n for (k in inputArr) {\n // Get key and value arrays\n if (inputArr.hasOwnProperty(k)) {\n valArr.push(inputArr[k])\n if (sortByReference) {\n delete inputArr[k]\n }\n }\n }\n\n valArr.sort(sorter)\n\n for (i = 0; i < valArr.length; i++) {\n // Repopulate the old array\n populateArr[i] = valArr[i]\n }\n\n return sortByReference || populateArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/shuffle.js b/node_modules/locutus/php/array/shuffle.js new file mode 100644 index 0000000..0443c5e --- /dev/null +++ b/node_modules/locutus/php/array/shuffle.js @@ -0,0 +1,45 @@ +'use strict'; + +module.exports = function shuffle(inputArr) { + // discuss at: http://locutus.io/php/shuffle/ + // original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) + // revised by: Kevin van Zonneveld (http://kvz.io) + // revised by: Brett Zamir (http://brett-zamir.me) + // improved by: Brett Zamir (http://brett-zamir.me) + // example 1: var $data = {5:'a', 2:'3', 3:'c', 4:5, 'q':5} + // example 1: ini_set('locutus.sortByReference', true) + // example 1: shuffle($data) + // example 1: var $result = $data.q + // returns 1: 5 + + var valArr = []; + var k = ''; + var i = 0; + var sortByReference = false; + var populateArr = []; + + for (k in inputArr) { + // Get key and value arrays + if (inputArr.hasOwnProperty(k)) { + valArr.push(inputArr[k]); + if (sortByReference) { + delete inputArr[k]; + } + } + } + valArr.sort(function () { + return 0.5 - Math.random(); + }); + + var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'; + sortByReference = iniVal === 'on'; + populateArr = sortByReference ? inputArr : populateArr; + + for (i = 0; i < valArr.length; i++) { + // Repopulate the old array + populateArr[i] = valArr[i]; + } + + return sortByReference || populateArr; +}; +//# sourceMappingURL=shuffle.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/shuffle.js.map b/node_modules/locutus/php/array/shuffle.js.map new file mode 100644 index 0000000..bbdaa2e --- /dev/null +++ b/node_modules/locutus/php/array/shuffle.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/shuffle.js"],"names":["module","exports","shuffle","inputArr","valArr","k","i","sortByReference","populateArr","hasOwnProperty","push","sort","Math","random","iniVal","require","undefined","length"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,OAAT,CAAkBC,QAAlB,EAA4B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,kBAAkB,KAAtB;AACA,MAAIC,cAAc,EAAlB;;AAEA,OAAKH,CAAL,IAAUF,QAAV,EAAoB;AAClB;AACA,QAAIA,SAASM,cAAT,CAAwBJ,CAAxB,CAAJ,EAAgC;AAC9BD,aAAOM,IAAP,CAAYP,SAASE,CAAT,CAAZ;AACA,UAAIE,eAAJ,EAAqB;AACnB,eAAOJ,SAASE,CAAT,CAAP;AACD;AACF;AACF;AACDD,SAAOO,IAAP,CAAY,YAAY;AACtB,WAAO,MAAMC,KAAKC,MAAL,EAAb;AACD,GAFD;;AAIA,MAAIC,SAAS,CAAC,OAAOC,OAAP,KAAmB,WAAnB,GAAiCA,QAAQ,iBAAR,EAA2B,yBAA3B,CAAjC,GAAyFC,SAA1F,KAAwG,IAArH;AACAT,oBAAkBO,WAAW,IAA7B;AACAN,gBAAcD,kBAAkBJ,QAAlB,GAA6BK,WAA3C;;AAEA,OAAKF,IAAI,CAAT,EAAYA,IAAIF,OAAOa,MAAvB,EAA+BX,GAA/B,EAAoC;AAClC;AACAE,gBAAYF,CAAZ,IAAiBF,OAAOE,CAAP,CAAjB;AACD;;AAED,SAAOC,mBAAmBC,WAA1B;AACD,CAzCD","file":"shuffle.js","sourcesContent":["module.exports = function shuffle (inputArr) {\n // discuss at: http://locutus.io/php/shuffle/\n // original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)\n // revised by: Kevin van Zonneveld (http://kvz.io)\n // revised by: Brett Zamir (http://brett-zamir.me)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // example 1: var $data = {5:'a', 2:'3', 3:'c', 4:5, 'q':5}\n // example 1: ini_set('locutus.sortByReference', true)\n // example 1: shuffle($data)\n // example 1: var $result = $data.q\n // returns 1: 5\n\n var valArr = []\n var k = ''\n var i = 0\n var sortByReference = false\n var populateArr = []\n\n for (k in inputArr) {\n // Get key and value arrays\n if (inputArr.hasOwnProperty(k)) {\n valArr.push(inputArr[k])\n if (sortByReference) {\n delete inputArr[k]\n }\n }\n }\n valArr.sort(function () {\n return 0.5 - Math.random()\n })\n\n var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'\n sortByReference = iniVal === 'on'\n populateArr = sortByReference ? inputArr : populateArr\n\n for (i = 0; i < valArr.length; i++) {\n // Repopulate the old array\n populateArr[i] = valArr[i]\n }\n\n return sortByReference || populateArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/sizeof.js b/node_modules/locutus/php/array/sizeof.js new file mode 100644 index 0000000..2c54e9c --- /dev/null +++ b/node_modules/locutus/php/array/sizeof.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function sizeof(mixedVar, mode) { + // discuss at: http://locutus.io/php/sizeof/ + // original by: Philip Peterson + // example 1: sizeof([[0,0],[0,-4]], 'COUNT_RECURSIVE') + // returns 1: 6 + // example 2: sizeof({'one' : [1,2,3,4,5]}, 'COUNT_RECURSIVE') + // returns 2: 6 + + var count = require('../array/count'); + + return count(mixedVar, mode); +}; +//# sourceMappingURL=sizeof.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/sizeof.js.map b/node_modules/locutus/php/array/sizeof.js.map new file mode 100644 index 0000000..d27516f --- /dev/null +++ b/node_modules/locutus/php/array/sizeof.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/sizeof.js"],"names":["module","exports","sizeof","mixedVar","mode","count","require"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,MAAT,CAAiBC,QAAjB,EAA2BC,IAA3B,EAAiC;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,QAAQC,QAAQ,gBAAR,CAAZ;;AAEA,SAAOD,MAAMF,QAAN,EAAgBC,IAAhB,CAAP;AACD,CAXD","file":"sizeof.js","sourcesContent":["module.exports = function sizeof (mixedVar, mode) {\n // discuss at: http://locutus.io/php/sizeof/\n // original by: Philip Peterson\n // example 1: sizeof([[0,0],[0,-4]], 'COUNT_RECURSIVE')\n // returns 1: 6\n // example 2: sizeof({'one' : [1,2,3,4,5]}, 'COUNT_RECURSIVE')\n // returns 2: 6\n\n var count = require('../array/count')\n\n return count(mixedVar, mode)\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/sort.js b/node_modules/locutus/php/array/sort.js new file mode 100644 index 0000000..4e09464 --- /dev/null +++ b/node_modules/locutus/php/array/sort.js @@ -0,0 +1,116 @@ +'use strict'; + +module.exports = function sort(inputArr, sortFlags) { + // discuss at: http://locutus.io/php/sort/ + // original by: Kevin van Zonneveld (http://kvz.io) + // revised by: Brett Zamir (http://brett-zamir.me) + // improved by: Brett Zamir (http://brett-zamir.me) + // note 1: SORT_STRING (as well as natsort and natcasesort) might also be + // note 1: integrated into all of these functions by adapting the code at + // note 1: http://sourcefrog.net/projects/natsort/natcompare.js + // note 1: This function deviates from PHP in returning a copy of the array instead + // note 1: of acting by reference and returning true; this was necessary because + // note 1: IE does not allow deleting and re-adding of properties without caching + // note 1: of property position; you can set the ini of "locutus.sortByReference" to true to + // note 1: get the PHP behavior, but use this only if you are in an environment + // note 1: such as Firefox extensions where for-in iteration order is fixed and true + // note 1: property deletion is supported. Note that we intend to implement the PHP + // note 1: behavior by default if IE ever does allow it; only gives shallow copy since + // note 1: is by reference in PHP anyways + // note 1: Since JS objects' keys are always strings, and (the + // note 1: default) SORT_REGULAR flag distinguishes by key type, + // note 1: if the content is a numeric string, we treat the + // note 1: "original type" as numeric. + // example 1: var $arr = ['Kevin', 'van', 'Zonneveld'] + // example 1: sort($arr) + // example 1: var $result = $arr + // returns 1: ['Kevin', 'Zonneveld', 'van'] + // example 2: ini_set('locutus.sortByReference', true) + // example 2: var $fruits = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'} + // example 2: sort($fruits) + // example 2: var $result = $fruits + // returns 2: {0: 'apple', 1: 'banana', 2: 'lemon', 3: 'orange'} + // test: skip-1 + + var i18nlgd = require('../i18n/i18n_loc_get_default'); + + var sorter; + var i; + var k; + var sortByReference = false; + var populateArr = {}; + + var $global = typeof window !== 'undefined' ? window : global; + $global.$locutus = $global.$locutus || {}; + var $locutus = $global.$locutus; + $locutus.php = $locutus.php || {}; + $locutus.php.locales = $locutus.php.locales || {}; + + switch (sortFlags) { + case 'SORT_STRING': + // compare items as strings + // leave sorter undefined, so built-in comparison is used + break; + case 'SORT_LOCALE_STRING': + // compare items as strings, based on the current locale + // (set with i18n_loc_set_default() as of PHP6) + var loc = $locutus.php.locales[i18nlgd()]; + + if (loc && loc.sorting) { + // if sorting exists on locale object, use it + // otherwise let sorter be undefined + // to fallback to built-in behavior + sorter = loc.sorting; + } + break; + case 'SORT_NUMERIC': + // compare items numerically + sorter = function sorter(a, b) { + return a - b; + }; + break; + case 'SORT_REGULAR': + default: + sorter = function sorter(a, b) { + var aFloat = parseFloat(a); + var bFloat = parseFloat(b); + var aNumeric = aFloat + '' === a; + var bNumeric = bFloat + '' === b; + + if (aNumeric && bNumeric) { + return aFloat > bFloat ? 1 : aFloat < bFloat ? -1 : 0; + } else if (aNumeric && !bNumeric) { + return 1; + } else if (!aNumeric && bNumeric) { + return -1; + } + + return a > b ? 1 : a < b ? -1 : 0; + }; + break; + } + + var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'; + sortByReference = iniVal === 'on'; + populateArr = sortByReference ? inputArr : populateArr; + + var valArr = []; + for (k in inputArr) { + // Get key and value arrays + if (inputArr.hasOwnProperty(k)) { + valArr.push(inputArr[k]); + if (sortByReference) { + delete inputArr[k]; + } + } + } + + valArr.sort(sorter); + + for (i = 0; i < valArr.length; i++) { + // Repopulate the old array + populateArr[i] = valArr[i]; + } + return sortByReference || populateArr; +}; +//# sourceMappingURL=sort.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/sort.js.map b/node_modules/locutus/php/array/sort.js.map new file mode 100644 index 0000000..9ac03bc --- /dev/null +++ b/node_modules/locutus/php/array/sort.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/sort.js"],"names":["module","exports","sort","inputArr","sortFlags","i18nlgd","require","sorter","i","k","sortByReference","populateArr","$global","window","global","$locutus","php","locales","loc","sorting","a","b","aFloat","parseFloat","bFloat","aNumeric","bNumeric","iniVal","undefined","valArr","hasOwnProperty","push","length"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,IAAT,CAAeC,QAAf,EAAyBC,SAAzB,EAAoC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,UAAUC,QAAQ,8BAAR,CAAd;;AAEA,MAAIC,MAAJ;AACA,MAAIC,CAAJ;AACA,MAAIC,CAAJ;AACA,MAAIC,kBAAkB,KAAtB;AACA,MAAIC,cAAc,EAAlB;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;AACAF,UAAQG,QAAR,GAAmBH,QAAQG,QAAR,IAAoB,EAAvC;AACA,MAAIA,WAAWH,QAAQG,QAAvB;AACAA,WAASC,GAAT,GAAeD,SAASC,GAAT,IAAgB,EAA/B;AACAD,WAASC,GAAT,CAAaC,OAAb,GAAuBF,SAASC,GAAT,CAAaC,OAAb,IAAwB,EAA/C;;AAEA,UAAQb,SAAR;AACE,SAAK,aAAL;AACE;AACA;AACA;AACF,SAAK,oBAAL;AACE;AACA;AACA,UAAIc,MAAMH,SAASC,GAAT,CAAaC,OAAb,CAAqBZ,SAArB,CAAV;;AAEA,UAAIa,OAAOA,IAAIC,OAAf,EAAwB;AACtB;AACA;AACA;AACAZ,iBAASW,IAAIC,OAAb;AACD;AACD;AACF,SAAK,cAAL;AACE;AACAZ,eAAS,gBAAUa,CAAV,EAAaC,CAAb,EAAgB;AACvB,eAAQD,IAAIC,CAAZ;AACD,OAFD;AAGA;AACF,SAAK,cAAL;AACA;AACEd,eAAS,gBAAUa,CAAV,EAAaC,CAAb,EAAgB;AACvB,YAAIC,SAASC,WAAWH,CAAX,CAAb;AACA,YAAII,SAASD,WAAWF,CAAX,CAAb;AACA,YAAII,WAAWH,SAAS,EAAT,KAAgBF,CAA/B;AACA,YAAIM,WAAWF,SAAS,EAAT,KAAgBH,CAA/B;;AAEA,YAAII,YAAYC,QAAhB,EAA0B;AACxB,iBAAOJ,SAASE,MAAT,GAAkB,CAAlB,GAAsBF,SAASE,MAAT,GAAkB,CAAC,CAAnB,GAAuB,CAApD;AACD,SAFD,MAEO,IAAIC,YAAY,CAACC,QAAjB,EAA2B;AAChC,iBAAO,CAAP;AACD,SAFM,MAEA,IAAI,CAACD,QAAD,IAAaC,QAAjB,EAA2B;AAChC,iBAAO,CAAC,CAAR;AACD;;AAED,eAAON,IAAIC,CAAJ,GAAQ,CAAR,GAAYD,IAAIC,CAAJ,GAAQ,CAAC,CAAT,GAAa,CAAhC;AACD,OAfD;AAgBA;AAzCJ;;AA4CA,MAAIM,SAAS,CAAC,OAAOrB,OAAP,KAAmB,WAAnB,GAAiCA,QAAQ,iBAAR,EAA2B,yBAA3B,CAAjC,GAAyFsB,SAA1F,KAAwG,IAArH;AACAlB,oBAAkBiB,WAAW,IAA7B;AACAhB,gBAAcD,kBAAkBP,QAAlB,GAA6BQ,WAA3C;;AAEA,MAAIkB,SAAS,EAAb;AACA,OAAKpB,CAAL,IAAUN,QAAV,EAAoB;AAClB;AACA,QAAIA,SAAS2B,cAAT,CAAwBrB,CAAxB,CAAJ,EAAgC;AAC9BoB,aAAOE,IAAP,CAAY5B,SAASM,CAAT,CAAZ;AACA,UAAIC,eAAJ,EAAqB;AACnB,eAAOP,SAASM,CAAT,CAAP;AACD;AACF;AACF;;AAEDoB,SAAO3B,IAAP,CAAYK,MAAZ;;AAEA,OAAKC,IAAI,CAAT,EAAYA,IAAIqB,OAAOG,MAAvB,EAA+BxB,GAA/B,EAAoC;AAClC;AACAG,gBAAYH,CAAZ,IAAiBqB,OAAOrB,CAAP,CAAjB;AACD;AACD,SAAOE,mBAAmBC,WAA1B;AACD,CAhHD","file":"sort.js","sourcesContent":["module.exports = function sort (inputArr, sortFlags) {\n // discuss at: http://locutus.io/php/sort/\n // original by: Kevin van Zonneveld (http://kvz.io)\n // revised by: Brett Zamir (http://brett-zamir.me)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // note 1: SORT_STRING (as well as natsort and natcasesort) might also be\n // note 1: integrated into all of these functions by adapting the code at\n // note 1: http://sourcefrog.net/projects/natsort/natcompare.js\n // note 1: This function deviates from PHP in returning a copy of the array instead\n // note 1: of acting by reference and returning true; this was necessary because\n // note 1: IE does not allow deleting and re-adding of properties without caching\n // note 1: of property position; you can set the ini of \"locutus.sortByReference\" to true to\n // note 1: get the PHP behavior, but use this only if you are in an environment\n // note 1: such as Firefox extensions where for-in iteration order is fixed and true\n // note 1: property deletion is supported. Note that we intend to implement the PHP\n // note 1: behavior by default if IE ever does allow it; only gives shallow copy since\n // note 1: is by reference in PHP anyways\n // note 1: Since JS objects' keys are always strings, and (the\n // note 1: default) SORT_REGULAR flag distinguishes by key type,\n // note 1: if the content is a numeric string, we treat the\n // note 1: \"original type\" as numeric.\n // example 1: var $arr = ['Kevin', 'van', 'Zonneveld']\n // example 1: sort($arr)\n // example 1: var $result = $arr\n // returns 1: ['Kevin', 'Zonneveld', 'van']\n // example 2: ini_set('locutus.sortByReference', true)\n // example 2: var $fruits = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'}\n // example 2: sort($fruits)\n // example 2: var $result = $fruits\n // returns 2: {0: 'apple', 1: 'banana', 2: 'lemon', 3: 'orange'}\n // test: skip-1\n\n var i18nlgd = require('../i18n/i18n_loc_get_default')\n\n var sorter\n var i\n var k\n var sortByReference = false\n var populateArr = {}\n\n var $global = (typeof window !== 'undefined' ? window : global)\n $global.$locutus = $global.$locutus || {}\n var $locutus = $global.$locutus\n $locutus.php = $locutus.php || {}\n $locutus.php.locales = $locutus.php.locales || {}\n\n switch (sortFlags) {\n case 'SORT_STRING':\n // compare items as strings\n // leave sorter undefined, so built-in comparison is used\n break\n case 'SORT_LOCALE_STRING':\n // compare items as strings, based on the current locale\n // (set with i18n_loc_set_default() as of PHP6)\n var loc = $locutus.php.locales[i18nlgd()]\n\n if (loc && loc.sorting) {\n // if sorting exists on locale object, use it\n // otherwise let sorter be undefined\n // to fallback to built-in behavior\n sorter = loc.sorting\n }\n break\n case 'SORT_NUMERIC':\n // compare items numerically\n sorter = function (a, b) {\n return (a - b)\n }\n break\n case 'SORT_REGULAR':\n default:\n sorter = function (a, b) {\n var aFloat = parseFloat(a)\n var bFloat = parseFloat(b)\n var aNumeric = aFloat + '' === a\n var bNumeric = bFloat + '' === b\n\n if (aNumeric && bNumeric) {\n return aFloat > bFloat ? 1 : aFloat < bFloat ? -1 : 0\n } else if (aNumeric && !bNumeric) {\n return 1\n } else if (!aNumeric && bNumeric) {\n return -1\n }\n\n return a > b ? 1 : a < b ? -1 : 0\n }\n break\n }\n\n var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'\n sortByReference = iniVal === 'on'\n populateArr = sortByReference ? inputArr : populateArr\n\n var valArr = []\n for (k in inputArr) {\n // Get key and value arrays\n if (inputArr.hasOwnProperty(k)) {\n valArr.push(inputArr[k])\n if (sortByReference) {\n delete inputArr[k]\n }\n }\n }\n\n valArr.sort(sorter)\n\n for (i = 0; i < valArr.length; i++) {\n // Repopulate the old array\n populateArr[i] = valArr[i]\n }\n return sortByReference || populateArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/uasort.js b/node_modules/locutus/php/array/uasort.js new file mode 100644 index 0000000..c3a1c34 --- /dev/null +++ b/node_modules/locutus/php/array/uasort.js @@ -0,0 +1,59 @@ +'use strict'; + +module.exports = function uasort(inputArr, sorter) { + // discuss at: http://locutus.io/php/uasort/ + // original by: Brett Zamir (http://brett-zamir.me) + // improved by: Brett Zamir (http://brett-zamir.me) + // improved by: Theriault (https://github.com/Theriault) + // note 1: This function deviates from PHP in returning a copy of the array instead + // note 1: of acting by reference and returning true; this was necessary because + // note 1: IE does not allow deleting and re-adding of properties without caching + // note 1: of property position; you can set the ini of "locutus.sortByReference" to true to + // note 1: get the PHP behavior, but use this only if you are in an environment + // note 1: such as Firefox extensions where for-in iteration order is fixed and true + // note 1: property deletion is supported. Note that we intend to implement the PHP + // note 1: behavior by default if IE ever does allow it; only gives shallow copy since + // note 1: is by reference in PHP anyways + // example 1: var $sorter = function (a, b) { if (a > b) {return 1;}if (a < b) {return -1;} return 0;} + // example 1: var $fruits = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'} + // example 1: uasort($fruits, $sorter) + // example 1: var $result = $fruits + // returns 1: {c: 'apple', b: 'banana', d: 'lemon', a: 'orange'} + + var valArr = []; + var k = ''; + var i = 0; + var sortByReference = false; + var populateArr = {}; + + if (typeof sorter === 'string') { + sorter = this[sorter]; + } else if (Object.prototype.toString.call(sorter) === '[object Array]') { + sorter = this[sorter[0]][sorter[1]]; + } + + var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'; + sortByReference = iniVal === 'on'; + populateArr = sortByReference ? inputArr : populateArr; + + for (k in inputArr) { + // Get key and value arrays + if (inputArr.hasOwnProperty(k)) { + valArr.push([k, inputArr[k]]); + if (sortByReference) { + delete inputArr[k]; + } + } + } + valArr.sort(function (a, b) { + return sorter(a[1], b[1]); + }); + + for (i = 0; i < valArr.length; i++) { + // Repopulate the old array + populateArr[valArr[i][0]] = valArr[i][1]; + } + + return sortByReference || populateArr; +}; +//# sourceMappingURL=uasort.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/uasort.js.map b/node_modules/locutus/php/array/uasort.js.map new file mode 100644 index 0000000..7cddba7 --- /dev/null +++ b/node_modules/locutus/php/array/uasort.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/uasort.js"],"names":["module","exports","uasort","inputArr","sorter","valArr","k","i","sortByReference","populateArr","Object","prototype","toString","call","iniVal","require","undefined","hasOwnProperty","push","sort","a","b","length"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,MAAT,CAAiBC,QAAjB,EAA2BC,MAA3B,EAAmC;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,kBAAkB,KAAtB;AACA,MAAIC,cAAc,EAAlB;;AAEA,MAAI,OAAOL,MAAP,KAAkB,QAAtB,EAAgC;AAC9BA,aAAS,KAAKA,MAAL,CAAT;AACD,GAFD,MAEO,IAAIM,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BT,MAA/B,MAA2C,gBAA/C,EAAiE;AACtEA,aAAS,KAAKA,OAAO,CAAP,CAAL,EAAgBA,OAAO,CAAP,CAAhB,CAAT;AACD;;AAED,MAAIU,SAAS,CAAC,OAAOC,OAAP,KAAmB,WAAnB,GAAiCA,QAAQ,iBAAR,EAA2B,yBAA3B,CAAjC,GAAyFC,SAA1F,KAAwG,IAArH;AACAR,oBAAkBM,WAAW,IAA7B;AACAL,gBAAcD,kBAAkBL,QAAlB,GAA6BM,WAA3C;;AAEA,OAAKH,CAAL,IAAUH,QAAV,EAAoB;AAClB;AACA,QAAIA,SAASc,cAAT,CAAwBX,CAAxB,CAAJ,EAAgC;AAC9BD,aAAOa,IAAP,CAAY,CAACZ,CAAD,EAAIH,SAASG,CAAT,CAAJ,CAAZ;AACA,UAAIE,eAAJ,EAAqB;AACnB,eAAOL,SAASG,CAAT,CAAP;AACD;AACF;AACF;AACDD,SAAOc,IAAP,CAAY,UAAUC,CAAV,EAAaC,CAAb,EAAgB;AAC1B,WAAOjB,OAAOgB,EAAE,CAAF,CAAP,EAAaC,EAAE,CAAF,CAAb,CAAP;AACD,GAFD;;AAIA,OAAKd,IAAI,CAAT,EAAYA,IAAIF,OAAOiB,MAAvB,EAA+Bf,GAA/B,EAAoC;AAClC;AACAE,gBAAYJ,OAAOE,CAAP,EAAU,CAAV,CAAZ,IAA4BF,OAAOE,CAAP,EAAU,CAAV,CAA5B;AACD;;AAED,SAAOC,mBAAmBC,WAA1B;AACD,CAvDD","file":"uasort.js","sourcesContent":["module.exports = function uasort (inputArr, sorter) {\n // discuss at: http://locutus.io/php/uasort/\n // original by: Brett Zamir (http://brett-zamir.me)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // improved by: Theriault (https://github.com/Theriault)\n // note 1: This function deviates from PHP in returning a copy of the array instead\n // note 1: of acting by reference and returning true; this was necessary because\n // note 1: IE does not allow deleting and re-adding of properties without caching\n // note 1: of property position; you can set the ini of \"locutus.sortByReference\" to true to\n // note 1: get the PHP behavior, but use this only if you are in an environment\n // note 1: such as Firefox extensions where for-in iteration order is fixed and true\n // note 1: property deletion is supported. Note that we intend to implement the PHP\n // note 1: behavior by default if IE ever does allow it; only gives shallow copy since\n // note 1: is by reference in PHP anyways\n // example 1: var $sorter = function (a, b) { if (a > b) {return 1;}if (a < b) {return -1;} return 0;}\n // example 1: var $fruits = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'}\n // example 1: uasort($fruits, $sorter)\n // example 1: var $result = $fruits\n // returns 1: {c: 'apple', b: 'banana', d: 'lemon', a: 'orange'}\n\n var valArr = []\n var k = ''\n var i = 0\n var sortByReference = false\n var populateArr = {}\n\n if (typeof sorter === 'string') {\n sorter = this[sorter]\n } else if (Object.prototype.toString.call(sorter) === '[object Array]') {\n sorter = this[sorter[0]][sorter[1]]\n }\n\n var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'\n sortByReference = iniVal === 'on'\n populateArr = sortByReference ? inputArr : populateArr\n\n for (k in inputArr) {\n // Get key and value arrays\n if (inputArr.hasOwnProperty(k)) {\n valArr.push([k, inputArr[k]])\n if (sortByReference) {\n delete inputArr[k]\n }\n }\n }\n valArr.sort(function (a, b) {\n return sorter(a[1], b[1])\n })\n\n for (i = 0; i < valArr.length; i++) {\n // Repopulate the old array\n populateArr[valArr[i][0]] = valArr[i][1]\n }\n\n return sortByReference || populateArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/uksort.js b/node_modules/locutus/php/array/uksort.js new file mode 100644 index 0000000..6288fb2 --- /dev/null +++ b/node_modules/locutus/php/array/uksort.js @@ -0,0 +1,71 @@ +'use strict'; + +module.exports = function uksort(inputArr, sorter) { + // discuss at: http://locutus.io/php/uksort/ + // original by: Brett Zamir (http://brett-zamir.me) + // improved by: Brett Zamir (http://brett-zamir.me) + // note 1: The examples are correct, this is a new way + // note 1: This function deviates from PHP in returning a copy of the array instead + // note 1: of acting by reference and returning true; this was necessary because + // note 1: IE does not allow deleting and re-adding of properties without caching + // note 1: of property position; you can set the ini of "locutus.sortByReference" to true to + // note 1: get the PHP behavior, but use this only if you are in an environment + // note 1: such as Firefox extensions where for-in iteration order is fixed and true + // note 1: property deletion is supported. Note that we intend to implement the PHP + // note 1: behavior by default if IE ever does allow it; only gives shallow copy since + // note 1: is by reference in PHP anyways + // example 1: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'} + // example 1: uksort($data, function (key1, key2){ return (key1 === key2 ? 0 : (key1 > key2 ? 1 : -1)); }) + // example 1: var $result = $data + // returns 1: {a: 'orange', b: 'banana', c: 'apple', d: 'lemon'} + + var tmpArr = {}; + var keys = []; + var i = 0; + var k = ''; + var sortByReference = false; + var populateArr = {}; + + if (typeof sorter === 'string') { + sorter = this.window[sorter]; + } + + // Make a list of key names + for (k in inputArr) { + if (inputArr.hasOwnProperty(k)) { + keys.push(k); + } + } + + // Sort key names + try { + if (sorter) { + keys.sort(sorter); + } else { + keys.sort(); + } + } catch (e) { + return false; + } + + var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'; + sortByReference = iniVal === 'on'; + populateArr = sortByReference ? inputArr : populateArr; + + // Rebuild array with sorted key names + for (i = 0; i < keys.length; i++) { + k = keys[i]; + tmpArr[k] = inputArr[k]; + if (sortByReference) { + delete inputArr[k]; + } + } + for (i in tmpArr) { + if (tmpArr.hasOwnProperty(i)) { + populateArr[i] = tmpArr[i]; + } + } + + return sortByReference || populateArr; +}; +//# sourceMappingURL=uksort.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/uksort.js.map b/node_modules/locutus/php/array/uksort.js.map new file mode 100644 index 0000000..cf139d8 --- /dev/null +++ b/node_modules/locutus/php/array/uksort.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/uksort.js"],"names":["module","exports","uksort","inputArr","sorter","tmpArr","keys","i","k","sortByReference","populateArr","window","hasOwnProperty","push","sort","e","iniVal","require","undefined","length"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,MAAT,CAAiBC,QAAjB,EAA2BC,MAA3B,EAAmC;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,OAAO,EAAX;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,kBAAkB,KAAtB;AACA,MAAIC,cAAc,EAAlB;;AAEA,MAAI,OAAON,MAAP,KAAkB,QAAtB,EAAgC;AAC9BA,aAAS,KAAKO,MAAL,CAAYP,MAAZ,CAAT;AACD;;AAED;AACA,OAAKI,CAAL,IAAUL,QAAV,EAAoB;AAClB,QAAIA,SAASS,cAAT,CAAwBJ,CAAxB,CAAJ,EAAgC;AAC9BF,WAAKO,IAAL,CAAUL,CAAV;AACD;AACF;;AAED;AACA,MAAI;AACF,QAAIJ,MAAJ,EAAY;AACVE,WAAKQ,IAAL,CAAUV,MAAV;AACD,KAFD,MAEO;AACLE,WAAKQ,IAAL;AACD;AACF,GAND,CAME,OAAOC,CAAP,EAAU;AACV,WAAO,KAAP;AACD;;AAED,MAAIC,SAAS,CAAC,OAAOC,OAAP,KAAmB,WAAnB,GAAiCA,QAAQ,iBAAR,EAA2B,yBAA3B,CAAjC,GAAyFC,SAA1F,KAAwG,IAArH;AACAT,oBAAkBO,WAAW,IAA7B;AACAN,gBAAcD,kBAAkBN,QAAlB,GAA6BO,WAA3C;;AAEA;AACA,OAAKH,IAAI,CAAT,EAAYA,IAAID,KAAKa,MAArB,EAA6BZ,GAA7B,EAAkC;AAChCC,QAAIF,KAAKC,CAAL,CAAJ;AACAF,WAAOG,CAAP,IAAYL,SAASK,CAAT,CAAZ;AACA,QAAIC,eAAJ,EAAqB;AACnB,aAAON,SAASK,CAAT,CAAP;AACD;AACF;AACD,OAAKD,CAAL,IAAUF,MAAV,EAAkB;AAChB,QAAIA,OAAOO,cAAP,CAAsBL,CAAtB,CAAJ,EAA8B;AAC5BG,kBAAYH,CAAZ,IAAiBF,OAAOE,CAAP,CAAjB;AACD;AACF;;AAED,SAAOE,mBAAmBC,WAA1B;AACD,CAnED","file":"uksort.js","sourcesContent":["module.exports = function uksort (inputArr, sorter) {\n // discuss at: http://locutus.io/php/uksort/\n // original by: Brett Zamir (http://brett-zamir.me)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // note 1: The examples are correct, this is a new way\n // note 1: This function deviates from PHP in returning a copy of the array instead\n // note 1: of acting by reference and returning true; this was necessary because\n // note 1: IE does not allow deleting and re-adding of properties without caching\n // note 1: of property position; you can set the ini of \"locutus.sortByReference\" to true to\n // note 1: get the PHP behavior, but use this only if you are in an environment\n // note 1: such as Firefox extensions where for-in iteration order is fixed and true\n // note 1: property deletion is supported. Note that we intend to implement the PHP\n // note 1: behavior by default if IE ever does allow it; only gives shallow copy since\n // note 1: is by reference in PHP anyways\n // example 1: var $data = {d: 'lemon', a: 'orange', b: 'banana', c: 'apple'}\n // example 1: uksort($data, function (key1, key2){ return (key1 === key2 ? 0 : (key1 > key2 ? 1 : -1)); })\n // example 1: var $result = $data\n // returns 1: {a: 'orange', b: 'banana', c: 'apple', d: 'lemon'}\n\n var tmpArr = {}\n var keys = []\n var i = 0\n var k = ''\n var sortByReference = false\n var populateArr = {}\n\n if (typeof sorter === 'string') {\n sorter = this.window[sorter]\n }\n\n // Make a list of key names\n for (k in inputArr) {\n if (inputArr.hasOwnProperty(k)) {\n keys.push(k)\n }\n }\n\n // Sort key names\n try {\n if (sorter) {\n keys.sort(sorter)\n } else {\n keys.sort()\n }\n } catch (e) {\n return false\n }\n\n var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'\n sortByReference = iniVal === 'on'\n populateArr = sortByReference ? inputArr : populateArr\n\n // Rebuild array with sorted key names\n for (i = 0; i < keys.length; i++) {\n k = keys[i]\n tmpArr[k] = inputArr[k]\n if (sortByReference) {\n delete inputArr[k]\n }\n }\n for (i in tmpArr) {\n if (tmpArr.hasOwnProperty(i)) {\n populateArr[i] = tmpArr[i]\n }\n }\n\n return sortByReference || populateArr\n}\n"]}
\ No newline at end of file diff --git a/node_modules/locutus/php/array/usort.js b/node_modules/locutus/php/array/usort.js new file mode 100644 index 0000000..d9666f6 --- /dev/null +++ b/node_modules/locutus/php/array/usort.js @@ -0,0 +1,58 @@ +'use strict'; + +module.exports = function usort(inputArr, sorter) { + // discuss at: http://locutus.io/php/usort/ + // original by: Brett Zamir (http://brett-zamir.me) + // improved by: Brett Zamir (http://brett-zamir.me) + // note 1: This function deviates from PHP in returning a copy of the array instead + // note 1: of acting by reference and returning true; this was necessary because + // note 1: IE does not allow deleting and re-adding of properties without caching + // note 1: of property position; you can set the ini of "locutus.sortByReference" to true to + // note 1: get the PHP behavior, but use this only if you are in an environment + // note 1: such as Firefox extensions where for-in iteration order is fixed and true + // note 1: property deletion is supported. Note that we intend to implement the PHP + // note 1: behavior by default if IE ever does allow it; only gives shallow copy since + // note 1: is by reference in PHP anyways + // example 1: var $stuff = {d: '3', a: '1', b: '11', c: '4'} + // example 1: usort($stuff, function (a, b) { return (a - b) }) + // example 1: var $result = $stuff + // returns 1: {0: '1', 1: '3', 2: '4', 3: '11'} + + var valArr = []; + var k = ''; + var i = 0; + var sortByReference = false; + var populateArr = {}; + + if (typeof sorter === 'string') { + sorter = this[sorter]; + } else if (Object.prototype.toString.call(sorter) === '[object Array]') { + sorter = this[sorter[0]][sorter[1]]; + } + + var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'; + sortByReference = iniVal === 'on'; + populateArr = sortByReference ? inputArr : populateArr; + + for (k in inputArr) { + // Get key and value arrays + if (inputArr.hasOwnProperty(k)) { + valArr.push(inputArr[k]); + if (sortByReference) { + delete inputArr[k]; + } + } + } + try { + valArr.sort(sorter); + } catch (e) { + return false; + } + for (i = 0; i < valArr.length; i++) { + // Repopulate the old array + populateArr[i] = valArr[i]; + } + + return sortByReference || populateArr; +}; +//# sourceMappingURL=usort.js.map
\ No newline at end of file diff --git a/node_modules/locutus/php/array/usort.js.map b/node_modules/locutus/php/array/usort.js.map new file mode 100644 index 0000000..3513c4f --- /dev/null +++ b/node_modules/locutus/php/array/usort.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/php/array/usort.js"],"names":["module","exports","usort","inputArr","sorter","valArr","k","i","sortByReference","populateArr","Object","prototype","toString","call","iniVal","require","undefined","hasOwnProperty","push","sort","e","length"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,KAAT,CAAgBC,QAAhB,EAA0BC,MAA1B,EAAkC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,SAAS,EAAb;AACA,MAAIC,IAAI,EAAR;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,kBAAkB,KAAtB;AACA,MAAIC,cAAc,EAAlB;;AAEA,MAAI,OAAOL,MAAP,KAAkB,QAAtB,EAAgC;AAC9BA,aAAS,KAAKA,MAAL,CAAT;AACD,GAFD,MAEO,IAAIM,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BT,MAA/B,MAA2C,gBAA/C,EAAiE;AACtEA,aAAS,KAAKA,OAAO,CAAP,CAAL,EAAgBA,OAAO,CAAP,CAAhB,CAAT;AACD;;AAED,MAAIU,SAAS,CAAC,OAAOC,OAAP,KAAmB,WAAnB,GAAiCA,QAAQ,iBAAR,EAA2B,yBAA3B,CAAjC,GAAyFC,SAA1F,KAAwG,IAArH;AACAR,oBAAkBM,WAAW,IAA7B;AACAL,gBAAcD,kBAAkBL,QAAlB,GAA6BM,WAA3C;;AAEA,OAAKH,CAAL,IAAUH,QAAV,EAAoB;AAClB;AACA,QAAIA,SAASc,cAAT,CAAwBX,CAAxB,CAAJ,EAAgC;AAC9BD,aAAOa,IAAP,CAAYf,SAASG,CAAT,CAAZ;AACA,UAAIE,eAAJ,EAAqB;AACnB,eAAOL,SAASG,CAAT,CAAP;AACD;AACF;AACF;AACD,MAAI;AACFD,WAAOc,IAAP,CAAYf,MAAZ;AACD,GAFD,CAEE,OAAOgB,CAAP,EAAU;AACV,WAAO,KAAP;AACD;AACD,OAAKb,IAAI,CAAT,EAAYA,IAAIF,OAAOgB,MAAvB,EAA+Bd,GAA/B,EAAoC;AAClC;AACAE,gBAAYF,CAAZ,IAAiBF,OAAOE,CAAP,CAAjB;AACD;;AAED,SAAOC,mBAAmBC,WAA1B;AACD,CAtDD","file":"usort.js","sourcesContent":["module.exports = function usort (inputArr, sorter) {\n // discuss at: http://locutus.io/php/usort/\n // original by: Brett Zamir (http://brett-zamir.me)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // note 1: This function deviates from PHP in returning a copy of the array instead\n // note 1: of acting by reference and returning true; this was necessary because\n // note 1: IE does not allow deleting and re-adding of properties without caching\n // note 1: of property position; you can set the ini of \"locutus.sortByReference\" to true to\n // note 1: get the PHP behavior, but use this only if you are in an environment\n // note 1: such as Firefox extensions where for-in iteration order is fixed and true\n // note 1: property deletion is supported. Note that we intend to implement the PHP\n // note 1: behavior by default if IE ever does allow it; only gives shallow copy since\n // note 1: is by reference in PHP anyways\n // example 1: var $stuff = {d: '3', a: '1', b: '11', c: '4'}\n // example 1: usort($stuff, function (a, b) { return (a - b) })\n // example 1: var $result = $stuff\n // returns 1: {0: '1', 1: '3', 2: '4', 3: '11'}\n\n var valArr = []\n var k = ''\n var i = 0\n var sortByReference = false\n var populateArr = {}\n\n if (typeof sorter === 'string') {\n sorter = this[sorter]\n } else if (Object.prototype.toString.call(sorter) === '[object Array]') {\n sorter = this[sorter[0]][sorter[1]]\n }\n\n var iniVal = (typeof require !== 'undefined' ? require('../info/ini_get')('locutus.sortByReference') : undefined) || 'on'\n sortByReference = iniVal === 'on'\n populateArr = sortByReference ? inputArr : populateArr\n\n for (k in inputArr) {\n // Get key and value arrays\n if (inputArr.hasOwnProperty(k)) {\n valArr.push(inputArr[k])\n if (sortByReference) {\n delete inputArr[k]\n }\n }\n }\n try {\n valArr.sort(sorter)\n } catch (e) {\n return false\n }\n for (i = 0; i < valArr.length; i++) {\n // Repopulate the old array\n populateArr[i] = valArr[i]\n }\n\n return sortByReference || populateArr\n}\n"]}
\ No newline at end of file |