summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/array/array_intersect_key.js.map
blob: 364525465facb96ccf994575999dabdd9bf1af53 (plain) (blame)
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"]}