postcss-values-parser
Advanced tools
Comparing version
@@ -10,3 +10,3 @@ 'use strict'; | ||
this.type = 'comment'; | ||
this.inline = opts.inline || false; | ||
this.inline = Object(opts).inline || false; | ||
} | ||
@@ -13,0 +13,0 @@ |
@@ -64,6 +64,6 @@ 'use strict'; | ||
// allow users to pass a constructor, or node type string; eg. Word. | ||
type = type.name && type.prototype ? type.name : type; | ||
const isTypeCallable = typeof type === 'function'; | ||
return this.walk((node, index) => { | ||
if (node.type === type) { | ||
if (isTypeCallable && node instanceof type || !isTypeCallable && node.type === type) { | ||
return callback.call(this, node, index); | ||
@@ -70,0 +70,0 @@ } |
@@ -26,9 +26,7 @@ 'use strict'; | ||
parser.colon = function (opts) { | ||
opts.value = opts.value || ':'; | ||
return new Colon(opts); | ||
return new Colon(Object.assign({ value: ':' }, opts)); | ||
}; | ||
parser.comma = function (opts) { | ||
opts.value = opts.value || ','; | ||
return new Comma(opts); | ||
return new Comma(Object.assign({ value: ',' }, opts)); | ||
}; | ||
@@ -53,9 +51,7 @@ | ||
parser.paren = function (opts) { | ||
opts.value = opts.value || '('; | ||
return new Paren(opts); | ||
return new Paren(Object.assign({ value: '(' }, opts)); | ||
}; | ||
parser.string = function (opts) { | ||
opts.quote = opts.quote || '\''; | ||
return new Str(opts); | ||
return new Str(Object.assign({ quote: '\'' }, opts)); | ||
}; | ||
@@ -62,0 +58,0 @@ |
@@ -204,6 +204,6 @@ 'use strict'; | ||
if (opts.index) { | ||
if (Object(opts).index) { | ||
pos = this.positionInside(opts.index); | ||
} | ||
else if (opts.word) { | ||
else if (Object(opts).word) { | ||
let index = this.toString().indexOf(opts.word); | ||
@@ -210,0 +210,0 @@ if (index !== -1) pos = this.positionInside(index); |
@@ -10,3 +10,3 @@ 'use strict'; | ||
this.type = 'number'; | ||
this.unit = opts.unit || ''; | ||
this.unit = Object(opts).unit || ''; | ||
} | ||
@@ -13,0 +13,0 @@ |
{ | ||
"name": "postcss-values-parser", | ||
"version": "1.5.0", | ||
"version": "2.0.0", | ||
"description": "A CSS property value parser for use with PostCSS", | ||
@@ -14,3 +14,3 @@ "main": "lib/index.js", | ||
"engines": { | ||
"node": ">=4" | ||
"node": ">=6.14.4" | ||
}, | ||
@@ -40,8 +40,8 @@ "scripts": { | ||
"chai-shallow-deep-equal": "^1.4.0", | ||
"eslint": "^4.17.0", | ||
"eslint": "^5.6.0", | ||
"gulp": "^3.9.1", | ||
"gulp-eslint": "^4.0.2", | ||
"gulp-mocha": "^5.0.0", | ||
"gulp-eslint": "^5.0.0", | ||
"gulp-mocha": "^6.0.0", | ||
"markdown-toc": "^1.2.0" | ||
} | ||
} |
59455
0.14%1414
-0.28%