Sha256: 33a4e4989bf08cd926886b31dd8bd0fcbd2a27fb89220775de6be51d26db9cd1

Contents?: true

Size: 502 Bytes

Versions: 24

Compression:

Stored size: 502 Bytes

Contents

'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);
};

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
trusty-cms-6.3.1 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-5.0.7 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-5.0.6 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-5.0.5 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-5.0.4 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-5.0.3 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-5.0.2 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-5.0.1 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-4.3.5 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-5.0.0 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-4.3.4 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-4.3.3 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-4.3.2 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-4.3.1 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-4.3 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-4.2.3 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-4.2.2 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-4.2.1 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-4.2 node_modules/stylelint/lib/utils/declarationValueIndex.js
trusty-cms-4.1.9 node_modules/stylelint/lib/utils/declarationValueIndex.js