mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-26 02:15:15 +00:00
1 line
5.6 KiB
JSON
1 line
5.6 KiB
JSON
{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.cssValue = exports.parseLengthAndUnit = void 0;\nvar cssUnit = {\n cm: true,\n mm: true,\n in: true,\n px: true,\n pt: true,\n pc: true,\n em: true,\n ex: true,\n ch: true,\n rem: true,\n vw: true,\n vh: true,\n vmin: true,\n vmax: true,\n \"%\": true\n};\n/**\n * If size is a number, append px to the value as default unit.\n * If size is a string, validate against list of valid units.\n * If unit is valid, return size as is.\n * If unit is invalid, console warn issue, replace with px as the unit.\n *\n * @param {(number | string)} size\n * @return {LengthObject} LengthObject\n */\n\nfunction parseLengthAndUnit(size) {\n if (typeof size === \"number\") {\n return {\n value: size,\n unit: \"px\"\n };\n }\n\n var value;\n var valueString = (size.match(/^[0-9.]*/) || \"\").toString();\n\n if (valueString.includes(\".\")) {\n value = parseFloat(valueString);\n } else {\n value = parseInt(valueString, 10);\n }\n\n var unit = (size.match(/[^0-9]*$/) || \"\").toString();\n\n if (cssUnit[unit]) {\n return {\n value: value,\n unit: unit\n };\n }\n\n console.warn(\"React Spinners: \" + size + \" is not a valid css value. Defaulting to \" + value + \"px.\");\n return {\n value: value,\n unit: \"px\"\n };\n}\n\nexports.parseLengthAndUnit = parseLengthAndUnit;\n/**\n * Take value as an input and return valid css value\n *\n * @param {(number | string)} value\n * @return {string} valid css value\n */\n\nfunction cssValue(value) {\n var lengthWithunit = parseLengthAndUnit(value);\n return \"\" + lengthWithunit.value + lengthWithunit.unit;\n}\n\nexports.cssValue = cssValue;","map":{"version":3,"sources":["/app/node_modules/react-spinners/helpers/unitConverter.js"],"names":["Object","defineProperty","exports","value","cssValue","parseLengthAndUnit","cssUnit","cm","mm","in","px","pt","pc","em","ex","ch","rem","vw","vh","vmin","vmax","size","unit","valueString","match","toString","includes","parseFloat","parseInt","console","warn","lengthW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AhB;AACH;;AACD,MAAID,IAAI,GAAG,CAACD,IAAI,CAACG,KAAL,CAAW,UAAX,KAA0B,EAA3B,EAA+BC,QAA/B,EAAX;;AACA,MAAInB,OAAO,CAACgB,IAAD,CAAX,EAAmB;AACf,WAAO;AACHnB,MAAAA,KAAK,EAAEA,KADJ;AAEHmB,MAAAA,IAAI,EAAEA;AAFH,KAAP;AAIH;;AACDO,EAAAA,OAAO,CAACC,IAAR,CAAa,qBAAqBT,IAArB,GAA4B,2CAA5B,GAA0ElB,KAA1E,GAAkF,KAA/F;AACA,SAAO;AACHA,IAAAA,KAAK,EAAEA,KADJ;AAEHmB,IAAAA,IAAI,EAAE;AAFH,GAAP;AAIH;;AACDpB,OAAO,CAACG,kBAAR,GAA6BA,kBAA7B;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASD,QAAT,CAAkBD,KAAlB,EAAyB;AACrB,MAAI4B,cAAc,GAAG1B,kBAAkB,CAACF,KAAD,CAAvC;AACA,SAAO,KAAK4B,cAAc,CAAC5B,KAApB,GAA4B4B,cAAc,CAACT,IAAlD;AACH;;AACDpB,OAAO,CAACE,QAAR,GAAmBA,QAAnB","sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cssValue = exports.parseLengthAndUnit = void 0;\nvar cssUnit = {\n cm: true,\n mm: true,\n in: true,\n px: true,\n pt: true,\n pc: true,\n em: true,\n ex: true,\n ch: true,\n rem: true,\n vw: true,\n vh: true,\n vmin: true,\n vmax: true,\n \"%\": true\n};\n/**\n * If size is a number, append px to the value as default unit.\n * If size is a string, validate against list of valid units.\n * If unit is valid, return size as is.\n * If unit is invalid, console warn issue, replace with px as the unit.\n *\n * @param {(number | string)} size\n * @return {LengthObject} LengthObject\n */\nfunction parseLengthAndUnit(size) {\n if (typeof size === \"number\") {\n return {\n value: size,\n unit: \"px\"\n };\n }\n var value;\n var valueString = (size.match(/^[0-9.]*/) || \"\").toString();\n if (valueString.includes(\".\")) {\n value = parseFloat(valueString);\n }\n else {\n value = parseInt(valueString, 10);\n }\n var unit = (size.match(/[^0-9]*$/) || \"\").toString();\n if (cssUnit[unit]) {\n return {\n value: value,\n unit: unit\n };\n }\n console.warn(\"React Spinners: \" + size + \" is not a valid css value. Defaulting to \" + value + \"px.\");\n return {\n value: value,\n unit: \"px\"\n };\n}\nexports.parseLengthAndUnit = parseLengthAndUnit;\n/**\n * Take value as an input and return valid css value\n *\n * @param {(number | string)} value\n * @return {string} valid css value\n */\nfunction cssValue(value) {\n var lengthWithunit = parseLengthAndUnit(value);\n return \"\" + lengthWithunit.value + lengthWithunit.unit;\n}\nexports.cssValue = cssValue;\n"]},"metadata":{},"sourceType":"script"} |