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