MCPcopy
hub / github.com/webpack/webpack / _ifThreeCodePointsWouldStartANumber

Function _ifThreeCodePointsWouldStartANumber

lib/css/syntax.js:452–463  ·  view source on GitHub ↗
(input, pos, f, s, t)

Source from the content-addressed store, hash-verified

450 * @returns {boolean} true, if the three code points start a number
451 */
452const _ifThreeCodePointsWouldStartANumber = (input, pos, f, s, t) => {
453 const first = f || input.charCodeAt(pos - 1);
454 const second = s || input.charCodeAt(pos);
455 const third = t || input.charCodeAt(pos + 1);
456 if (first === CC_PLUS_SIGN || first === CC_HYPHEN_MINUS) {
457 if (_isDigit(second)) return true;
458 return second === CC_FULL_STOP && _isDigit(third);
459 }
460 if (first === CC_FULL_STOP) return _isDigit(second);
461 /* istanbul ignore next -- @preserve: spec-general; every caller passes `pos` just past a +/-/. so `first` is never a bare digit here */
462 return _isDigit(first);
463};
464
465/**
466 * Consume an ident sequence (no validation of the first code points).

Callers 3

consumeHyphenMinusFunction · 0.85
consumeFullStopFunction · 0.85
consumePlusSignFunction · 0.85

Calls 1

_isDigitFunction · 0.85

Tested by

no test coverage detected