Son CV dans un terminal web en Javascript! https://terminal-cv.gregandev.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terminal-cv/node_modules/filesize/lib/filesize.min.js.map

1 line
8.7 KiB

1 year ago
{"version":3,"file":"filesize.min.js","sources":["../src/filesize.js"],"sourcesContent":["const b = /^(b|B)$/,\n\tsymbol = {\n\t\tiec: {\n\t\t\tbits: [\"b\", \"Kib\", \"Mib\", \"Gib\", \"Tib\", \"Pib\", \"Eib\", \"Zib\", \"Yib\"],\n\t\t\tbytes: [\"B\", \"KiB\", \"MiB\", \"GiB\", \"TiB\", \"PiB\", \"EiB\", \"ZiB\", \"YiB\"]\n\t\t},\n\t\tjedec: {\n\t\t\tbits: [\"b\", \"Kb\", \"Mb\", \"Gb\", \"Tb\", \"Pb\", \"Eb\", \"Zb\", \"Yb\"],\n\t\t\tbytes: [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"]\n\t\t}\n\t},\n\tfullform = {\n\t\tiec: [\"\", \"kibi\", \"mebi\", \"gibi\", \"tebi\", \"pebi\", \"exbi\", \"zebi\", \"yobi\"],\n\t\tjedec: [\"\", \"kilo\", \"mega\", \"giga\", \"tera\", \"peta\", \"exa\", \"zetta\", \"yotta\"]\n\t},\n\troundingFuncs = {\n\t\tfloor: Math.floor,\n\t\tceil: Math.ceil\n\t};\n\n/**\n * filesize\n *\n * @method filesize\n * @param {Mixed} arg String, Int or Float to transform\n * @param {Object} descriptor [Optional] Flags\n * @return {String} Readable file size String\n */\nfunction filesize (arg, descriptor = {}) {\n\tlet result = [],\n\t\tval = 0,\n\t\te, base, bits, ceil, full, fullforms, locale, localeOptions, neg, num, output, pad, round, u, unix, separator, spacer, standard, symbols, roundingFunc, precision;\n\n\tif (isNaN(arg)) {\n\t\tthrow new TypeError(\"Invalid number\");\n\t}\n\n\tbits = descriptor.bits === true;\n\tunix = descriptor.unix === true;\n\tpad = descriptor.pad === true;\n\tbase = descriptor.base || 2;\n\tround = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2;\n\tlocale = descriptor.locale !== void 0 ? descriptor.locale : \"\";\n\tlocaleOptions = descriptor.localeOptions || {};\n\tseparator = descriptor.separator !== void 0 ? descriptor.separator : \"\";\n\tspacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? \"\" : \" \";\n\tsymbols = descriptor.symbols || {};\n\tstandard = base === 2 ? descriptor.standard || \"jedec\" : \"jedec\";\n\toutput = descriptor.output || \"string\";\n\tfull = descriptor.fullform === true;\n\tfullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];\n\te = descriptor.exponent !== void 0 ? descriptor.exponent : -1;\n\troundingFunc = roundingFuncs[descriptor.roundingMethod] || Math.round;\n\tnum = Number(arg);\n\tneg = num < 0;\n\tceil = base > 2 ? 1000 : 1024;\n\tprecision = isNaN(descriptor.precision) === false ? parseInt(descriptor.precision, 10) : 0;\n\n\t// Flipping a negative number to determine the size\n\tif (neg) {\n\t\tnum = -num;\n\t}\n\n\t// Determining the exponent\n\tif (e === -1 || isNaN(e)) {\n\t\te = Math.floor(Math.log(num) / Math.log(ceil));\n\n\t\tif (e < 0) {\n\t\t\te = 0;\n\t\t}\n\t}\n\n\t// Exceeding supported length, time to reduce & multiply\n\tif (e > 8) {\n\t\tif (precision > 0) {\n\t\t\tprecision += 8 - e;\n\t\t}\n\n\t\te = 8;\n\t}\n\n\tif (output === \"exponent\") {\n\t\treturn e;\n\t}\n\n\t// Zero is now a special case because bytes divide by 1\n\tif (num === 0) {\n\t\tresult[0] = 0;\n\t\tu = result[1] = unix ? \"\" : symbol[standard][bits ? \"bits\" : \"bytes\"][e];\n\t} else {\n\t\tval = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));\n\n\t\tif (bits) {\n\t\t\tval = val * 8;\n\n\t\t\tif (val >= ceil && e < 8) {\n\t\t\t\tval = val / ceil;\n\t\t\t\te++;\n\t\t\t}\n\t\t}\n\n\t\tconst p = Math.pow(10, e > 0 ? round : 0);\n\t\tresult[0] = roundingFunc(val * p) / p;\n\n\t\tif (result[0] === ceil && e < 8 && descriptor.exponent === void 0) {\n\t\t\tresult[0] = 1;\n\t\t\te++;\n\t\t}\n\n\t\tu = result[1] = base === 10 && e === 1 ? bits ? \"kb\" : \"kB\" : symbol[standard][bits ? \"bits\" : \"bytes\"][e];\n\n\t\tif (unix) {\n\t\t\tresult[1] = standard === \"jedec\" ? result[1].charAt(0) : e > 0 ? result[1].replace(/B$/, \"\") : result[1];\n\n\t\t\tif (b.test(result[1])) {\n\t\t\t\tresult[0] = Math.floor(result[0]);\n\t\t\t\tresult[1] = \"\";\n\t\t\t}\n\t\t}\n\t}\n\n\t// Decorating a 'diff'\n\tif (neg) {\n\t\tresult[0] = -result[0];\n\t}\n\n\t// Setting optional precision\n\tif (precision > 0) {\n\t\tresult[0] = result[0].toPrecis