css parsing helpers
$ npm install css-list
[Deprecated] Use postcss-value-parser instead
css parsing helpers
If separators
is not specified, it will default to
[' ', '\n', '\t', ',', '/']
.
list.each('"50%" 50%/100% calc(100% + 20%)', [' ', '/'], function (value, type) {
// "50%" quote
// 50% null
// 100% null
// calc(100% + 20%) func
});
list.map('"50%" 50%/100% calc(100% + 20%)', [' ', '/'], function (value, type, prevValue, prevType) {
if(type === 'func' || type === 'quote') {
return type;
}
});
// quote 50%/100% func
// space
list.split('10px 20px 5px 15px')', ['\n', '\t', ' '])
// ['10px', '20px', '5px', '15px']
// comma
list.split('10px, 20px, 5px, ')', [','], true)
// ['10px', '20px', '5px', '']
© 2010 - cnpmjs.org x YWFE | Home | YWFE