{"version":3,"sources":["../../../src/php/math/is_nan.js"],"names":["module","exports","is_nan","val","warningType","isNaN","Object","prototype","toString","call","match","Error"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,MAAT,CAAiBC,GAAjB,EAAsB;AAAE;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,cAAc,EAAlB;;AAEA,MAAI,OAAOD,GAAP,KAAe,QAAf,IAA2BE,MAAMF,GAAN,CAA/B,EAA2C;AACzC,WAAO,IAAP;AACD;;AAED;AACA,MAAI,QAAOA,GAAP,yCAAOA,GAAP,OAAe,QAAnB,EAA6B;AAC3BC,kBAAeE,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BN,GAA/B,MAAwC,gBAAxC,GAA2D,OAA3D,GAAqE,QAApF;AACD,GAFD,MAEO,IAAI,OAAOA,GAAP,KAAe,QAAf,IAA2B,CAACA,IAAIO,KAAJ,CAAU,UAAV,CAAhC,EAAuD;AAC5D;AACAN,kBAAc,QAAd;AACD;AACD,MAAIA,WAAJ,EAAiB;AACf,UAAM,IAAIO,KAAJ,CAAU,yDAAyDP,WAAzD,GAAuE,QAAjF,CAAN;AACD;;AAED,SAAO,KAAP;AACD,CA3BD","file":"is_nan.js","sourcesContent":["module.exports = function is_nan (val) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/is_nan/\n // original by: Onno Marsman (https://twitter.com/onnomarsman)\n // input by: Robin\n // example 1: is_nan(NaN)\n // returns 1: true\n // example 2: is_nan(0)\n // returns 2: false\n\n var warningType = ''\n\n if (typeof val === 'number' && isNaN(val)) {\n return true\n }\n\n // Some errors for maximum PHP compatibility\n if (typeof val === 'object') {\n warningType = (Object.prototype.toString.call(val) === '[object Array]' ? 'array' : 'object')\n } else if (typeof val === 'string' && !val.match(/^[+-]?\\d/)) {\n // simulate PHP's behaviour: '-9a' doesn't give a warning, but 'a9' does.\n warningType = 'string'\n }\n if (warningType) {\n throw new Error('Warning: is_nan() expects parameter 1 to be double, ' + warningType + ' given')\n }\n\n return false\n}\n"]}