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