summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/var/is_numeric.js.map
blob: 57a8c24e7241235e3ff55d2be52cad37ec93d5b3 (plain) (blame)
1
{"version":3,"sources":["../../../src/php/var/is_numeric.js"],"names":["module","exports","is_numeric","mixedVar","whitespace","join","indexOf","slice","isNaN"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,UAAT,CAAqBC,QAArB,EAA+B;AAAE;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,aAAa,CACf,GADe,EAEf,IAFe,EAGf,IAHe,EAIf,IAJe,EAKf,IALe,EAMf,MANe,EAOf,MAPe,EAQf,QARe,EASf,QATe,EAUf,QAVe,EAWf,QAXe,EAYf,QAZe,EAaf,QAbe,EAcf,QAde,EAef,QAfe,EAgBf,QAhBe,EAiBf,QAjBe,EAkBf,QAlBe,EAmBf,QAnBe,EAoBf,QApBe,EAqBf,QArBe,EAsBf,QAtBe,EAuBfC,IAvBe,CAuBV,EAvBU,CAAjB;;AAyBA;AACA,SAAO,CAAC,OAAOF,QAAP,KAAoB,QAApB,IACL,OAAOA,QAAP,KAAoB,QAApB,IACDC,WAAWE,OAAX,CAAmBH,SAASI,KAAT,CAAe,CAAC,CAAhB,CAAnB,MAA2C,CAAC,CAFvC,KAGLJ,aAAa,EAHR,IAIL,CAACK,MAAML,QAAN,CAJH;AAKD,CArDD","file":"is_numeric.js","sourcesContent":["module.exports = function is_numeric (mixedVar) { // eslint-disable-line camelcase\n  //  discuss at: http://locutus.io/php/is_numeric/\n  // original by: Kevin van Zonneveld (http://kvz.io)\n  // improved by: David\n  // improved by: taith\n  // bugfixed by: Tim de Koning\n  // bugfixed by: WebDevHobo (http://webdevhobo.blogspot.com/)\n  // bugfixed by: Brett Zamir (http://brett-zamir.me)\n  // bugfixed by: Denis Chenu (http://shnoulle.net)\n  //   example 1: is_numeric(186.31)\n  //   returns 1: true\n  //   example 2: is_numeric('Kevin van Zonneveld')\n  //   returns 2: false\n  //   example 3: is_numeric(' +186.31e2')\n  //   returns 3: true\n  //   example 4: is_numeric('')\n  //   returns 4: false\n  //   example 5: is_numeric([])\n  //   returns 5: false\n  //   example 6: is_numeric('1 ')\n  //   returns 6: false\n\n  var whitespace = [\n    ' ',\n    '\\n',\n    '\\r',\n    '\\t',\n    '\\f',\n    '\\x0b',\n    '\\xa0',\n    '\\u2000',\n    '\\u2001',\n    '\\u2002',\n    '\\u2003',\n    '\\u2004',\n    '\\u2005',\n    '\\u2006',\n    '\\u2007',\n    '\\u2008',\n    '\\u2009',\n    '\\u200a',\n    '\\u200b',\n    '\\u2028',\n    '\\u2029',\n    '\\u3000'\n  ].join('')\n\n  // @todo: Break this up using many single conditions with early returns\n  return (typeof mixedVar === 'number' ||\n    (typeof mixedVar === 'string' &&\n    whitespace.indexOf(mixedVar.slice(-1)) === -1)) &&\n    mixedVar !== '' &&\n    !isNaN(mixedVar)\n}\n"]}