summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/var/boolval.js.map
blob: 28538551d328693753bb33a1baae16bc6e18885e (plain) (blame)
1
{"version":3,"sources":["../../../src/php/var/boolval.js"],"names":["module","exports","boolval","mixedVar","Array","isArray","length","undefined"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,OAAT,CAAkBC,QAAlB,EAA4B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIA,aAAa,KAAjB,EAAwB;AACtB,WAAO,KAAP;AACD;;AAED,MAAIA,aAAa,CAAb,IAAkBA,aAAa,GAAnC,EAAwC;AACtC,WAAO,KAAP;AACD;;AAED,MAAIA,aAAa,EAAb,IAAmBA,aAAa,GAApC,EAAyC;AACvC,WAAO,KAAP;AACD;;AAED,MAAIC,MAAMC,OAAN,CAAcF,QAAd,KAA2BA,SAASG,MAAT,KAAoB,CAAnD,EAAsD;AACpD,WAAO,KAAP;AACD;;AAED,MAAIH,aAAa,IAAb,IAAqBA,aAAaI,SAAtC,EAAiD;AAC/C,WAAO,KAAP;AACD;;AAED,SAAO,IAAP;AACD,CA9CD","file":"boolval.js","sourcesContent":["module.exports = function boolval (mixedVar) {\n  // original by: Will Rowe\n  //   example 1: boolval(true)\n  //   returns 1: true\n  //   example 2: boolval(false)\n  //   returns 2: false\n  //   example 3: boolval(0)\n  //   returns 3: false\n  //   example 4: boolval(0.0)\n  //   returns 4: false\n  //   example 5: boolval('')\n  //   returns 5: false\n  //   example 6: boolval('0')\n  //   returns 6: false\n  //   example 7: boolval([])\n  //   returns 7: false\n  //   example 8: boolval('')\n  //   returns 8: false\n  //   example 9: boolval(null)\n  //   returns 9: false\n  //   example 10: boolval(undefined)\n  //   returns 10: false\n  //   example 11: boolval('true')\n  //   returns 11: true\n\n  if (mixedVar === false) {\n    return false\n  }\n\n  if (mixedVar === 0 || mixedVar === 0.0) {\n    return false\n  }\n\n  if (mixedVar === '' || mixedVar === '0') {\n    return false\n  }\n\n  if (Array.isArray(mixedVar) && mixedVar.length === 0) {\n    return false\n  }\n\n  if (mixedVar === null || mixedVar === undefined) {\n    return false\n  }\n\n  return true\n}\n"]}