postcss-values-parser
Advanced tools
Comparing version
@@ -448,7 +448,7 @@ # API Documentation | ||
* `container.walkComments` | ||
* `container.walkFunctions` | ||
* `container.walkNumbers` | ||
* `container.walkFunctionNodes` | ||
* `container.walkNumberNodes` | ||
* `container.walkOperators` | ||
* `container.walkParenthesis` | ||
* `container.walkStrings` | ||
* `container.walkStringNodes` | ||
* `container.walkWords` | ||
@@ -455,0 +455,0 @@ |
@@ -385,3 +385,3 @@ 'use strict'; | ||
word = this.currToken[1], | ||
rNumber = /^[\+\-]?((\d+(\.\d*)?)|(\.\d+))/, | ||
rNumber = /^[\+\-]?((\d+(\.\d*)?)|(\.\d+))([eE][\+\-]?\d+)?/, | ||
@@ -388,0 +388,0 @@ // treat css-like groupings differently so they can be inspected, |
@@ -11,2 +11,3 @@ 'use strict'; | ||
const slash = '/'.charCodeAt(0); | ||
const period = '.'.charCodeAt(0); | ||
const comma = ','.charCodeAt(0); | ||
@@ -24,2 +25,6 @@ const colon = ':'.charCodeAt(0); | ||
const at = '@'.charCodeAt(0); | ||
const lowerE = 'e'.charCodeAt(0); | ||
const upperE = 'E'.charCodeAt(0); | ||
const digit0 = '0'.charCodeAt(0); | ||
const digit9 = '9'.charCodeAt(0); | ||
const atEnd = /[ \n\t\r\{\(\)'"\\;,/]/g; | ||
@@ -304,3 +309,3 @@ const wordEnd = /[ \n\t\r\(\)\{\}\*:;@!&'"\+\|~>,\[\]\\]|\/(?=\*)/g; | ||
// those get treated differently | ||
if (code >= 48 && code <= 57) { | ||
if (code >= digit0 && code <= digit9) { | ||
regex = wordEndNum; | ||
@@ -319,2 +324,25 @@ } | ||
// Exponential number notation with minus or plus: 1e-10, 1e+10 | ||
if (regex === wordEndNum || code === period) { | ||
let ncode = css.charCodeAt(next), | ||
ncode1 = css.charCodeAt(next + 1), | ||
ncode2 = css.charCodeAt(next + 2); | ||
if ( | ||
(ncode === lowerE || ncode === upperE) && | ||
(ncode1 === minus || ncode1 === plus) && | ||
(ncode2 >= digit0 && ncode2 <= digit9) | ||
) { | ||
wordEndNum.lastIndex = next + 2; | ||
wordEndNum.test(css); | ||
if (wordEndNum.lastIndex === 0) { | ||
next = css.length - 1; | ||
} | ||
else { | ||
next = wordEndNum.lastIndex - 2; | ||
} | ||
} | ||
} | ||
tokens.push(['word', css.slice(pos, next + 1), | ||
@@ -321,0 +349,0 @@ line, pos - offset, |
{ | ||
"name": "postcss-values-parser", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "A CSS property value parser for use with PostCSS", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -1,2 +0,2 @@ | ||
# postcss-values-parser [](https://travis-ci.org/lesshint/postcss-values-parser) | ||
# postcss-values-parser [](https://travis-ci.org/shellscape/postcss-values-parser) | ||
@@ -3,0 +3,0 @@ <img align="right" width="95" height="95" |
54317
1.85%1340
1.9%