lib/numeric-value.js
function eatNumber(stream) {
	const start = stream.pos;
	const negative = stream.eat(DASH);
	const afterNegative = stream.pos;

	stream.eatWhile(isNumber);
	
	const prevPos = stream.pos;
	if (stream.eat(DOT) && !stream.eatWhile(isNumber)) {
		// Number followed by a dot, but then no number
		stream.pos = prevPos;
	}

	// Edge case: consumed dash only: not a number, bail-out
	if (stream.pos === afterNegative) {
		stream.pos = start;
	}

	return stream.pos !== start;
}
function eatNumber(stream) {
	const start = stream.pos;
	const negative = stream.eat(DASH);
	const afterNegative = stream.pos;

	stream.eatWhile(isNumber);
	
	const prevPos = stream.pos;
	if (stream.eat(DOT) && !stream.eatWhile(isNumber)) {
		// Number followed by a dot, but then no number
		stream.pos = prevPos;
	}

	// Edge case: consumed dash only: not a number, bail-out
	if (stream.pos === afterNegative) {
		stream.pos = start;
	}

	return stream.pos !== start;
}
function eatNumber ( stream ) { const start = stream . pos ; const negative = stream . eat ( DASH ) ; const afterNegative = stream . pos ; stream . eatWhile ( isNumber ) ; const prevPos = stream . pos ; if ( stream . eat ( DOT ) && ! stream . eatWhile ( isNumber ) ) { // Number followed by a dot, but then no number stream . pos = prevPos ; } // Edge case: consumed dash only: not a number, bail-out if ( stream . pos === afterNegative ) { stream . pos = start ; } return stream . pos !== start ; }
Eats number value from given stream
@param  {StreamReader} stream
@return {Boolean} Returns `true` if number was consumed
Eats number value from given stream