This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/stylelint/lib/utils/declarationValueIndex.js
2020-11-01 22:46:04 +00:00

27 lines
502 B
JavaScript

'use strict';
const _ = require('lodash');
/**
* Get the index of a declaration's value
*
* @param {import('postcss').Declaration} decl
*
* @returns {number}
*/
module.exports = function (decl) {
return [
_.get(decl, 'raws.prop.prefix'),
_.get(decl, 'raws.prop.raw', decl.prop),
_.get(decl, 'raws.prop.suffix'),
_.get(decl, 'raws.between', ':'),
_.get(decl, 'raws.value.prefix'),
].reduce((count, str) => {
if (str) {
return count + str.length;
}
return count;
}, 0);
};