MCPcopy
hub / github.com/webpack/webpack / numericValue

Method numericValue

lib/css/syntax.js:1357–1364  ·  view source on GitHub ↗

* Parsed numeric value (number / percentage / dimension tokens). Derived from * `value` on access — the `%` is dropped for percentages and the unit for * dimensions (split with `_consumeANumber`, recomputed here so nothing is * stored per token). * @returns {number} the parsed numeric value

()

Source from the content-addressed store, hash-verified

1355 * @returns {number} the parsed numeric value
1356 */
1357 get numericValue() {
1358 const v = this.value;
1359 if (this.type === T_DIMENSION) {
1360 return Number(v.slice(0, _consumeANumber(v, 0)));
1361 }
1362 if (this.type === T_PERCENTAGE) return Number(v.slice(0, -1));
1363 return Number(v);
1364 }
1365
1366 /**
1367 * Spec type flag. For number / dimension tokens it's "integer" / "number"

Callers

nothing calls this directly

Calls 2

_consumeANumberFunction · 0.85
sliceMethod · 0.80

Tested by

no test coverage detected