StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
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.
1 line
21 KiB
1 line
21 KiB
4 years ago
|
{"version":3,"file":"accounting.es6.js","sources":["../lib/settings.js","../lib/unformat.js","../lib/internal/checkPrecision.js","../lib/toFixed.js","../node_modules/object-assign/index.js","../lib/internal/stripInsignificantZeros.js","../lib/formatNumber.js","../node_modules/is-string/index.js","../lib/internal/checkCurrencyFormat.js","../lib/formatMoney.js","../lib/formatColumn.js"],"sourcesContent":["/**\n * The library's settings configuration object.\n *\n * Contains default parameters for currency and number formatting\n */\nconst settings = {\n symbol: '$', // default currency symbol is '$'\n format: '%s%v', // controls output: %s = symbol, %v = value (can be object, see docs)\n decimal: '.', // decimal point separator\n thousand: ',', // thousands separator\n precision: 2, // decimal places\n grouping: 3, // digit grouping (not implemented yet)\n stripZeros: false, // strip insignificant zeros from decimal part\n fallback: 0 // value returned on unformat() failure\n};\n\nexport default settings;\n","import settings from './settings';\n\n/**\n * Takes a string/array of strings, removes all formatting/cruft and returns the raw float value\n * Alias: `accounting.parse(string)`\n *\n * Decimal must be included in the regular expression to match floats (defaults to\n * accounting.settings.decimal), so if the number uses a non-standard decimal\n * separator, provide it as the second argument.\n *\n * Also matches bracketed negatives (eg. '$ (1.99)' => -1.99)\n *\n * Doesn't throw any errors (`NaN`s become 0) but this may change in future\n *\n * ```js\n * accounting.unformat(\"£ 12,345,678.90 GBP\"); // 12345678.9\n * ```\n *\n * @method unformat\n * @for accounting\n * @param {String|Array<String>} value The string or array of strings containing the number/s to parse.\n * @param {Number} decimal Number of decimal digits of the resultant number\n * @return {Float} The parsed number\n */\nfunction unformat(value, decimal = settings.decimal, fallback = settings.fallback) {\n // Recursively unformat arrays:\n if (Array.isArray(value)) {\n return value.map((val) => unformat(val, decimal, fallback));\n }\n\n // Return the value as-is if it's already a number:\n if (typeof value === 'number') return value;\n\n // Build regex to strip out everything except digits, decimal point and minus sign:\n const regex = new RegExp('[^0-9-(-)-' + decimal + ']', ['g']);\n const unformattedValueString =\n ('' + value)\n .replace(regex, '') // strip out any cruft\n .replace(decimal, '.') // make sure decimal point is standard\n .replace(/\\(([-]*\\d*[^)]?\\d+)\\)/g, '-$1') // replace bracketed values with negatives\n .replace(/\\((.*)\\)/, ''); // remove any brackets that do not have numeric value\n\n /**\n * Handling -ve number and bracket, eg.\n * (-100) = 100, -(100) = 100, --100 = 100\n */\n const negative = (unformattedValueString.match(/-/g) || 2).length % 2,\n absUnformatted = parseFloat(unformattedValueString.replace(/-/g, '')),\n unformatted = absUnformatted * ((negative) ? -1 : 1);\n\n // This will fail silently which may cause trouble, let's wait and see:\n return !isNaN(unformatted) ? unformatted : fallback;\n}\n\nexport default unformat;\n","/**\n * Check and normalise the value of precision (must be positive integer)\n */\nfunction _checkPrecision(val, base) {\n val = Math.round(Math.abs(val));\n return isNaN(val) ? base : val;\n}\n\nexport default _checkPrecision;\n","import _checkPrecision from './internal/checkPrecision';\nimport settings from './settings';\n\n/**\n * Implementation of toFixed() that treats floats more like decimals\n *\n * Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present\n * problems for accounting- and finance-related software.\n *\n * ```js\n * (0.615).toFixed(2); // \"0.61\" (native toFixed has rounding issues)\n * accounting.toFixed(0.615, 2); // \"0.62\"\n * ```\n *\n * @method toFixed\n * @for accounting\n * @param {Float}
|