Sha256: 4444bc4ef82ca93c157a07a31597e2fb9b180e1b30f998f5c9df4fdb48923651

Contents?: true

Size: 783 Bytes

Versions: 24

Compression:

Stored size: 783 Bytes

Contents

const getOrderData = require('./getOrderData');
const getComments = require('./getComments');

module.exports = function processMostNodes(node, index, order, processedNodes) {
	if (node.type === 'comment') {
		return processedNodes;
	}

	const nodeOrderData = getOrderData(order, node);

	node.position = nodeOrderData && nodeOrderData.position ? nodeOrderData.position : Infinity;
	node.initialIndex = index;

	// If comment on separate line before node, use node's indexes for comment
	const commentsBefore = getComments.beforeNode([], node.prev(), node);

	// If comment on same line with the node and node, use node's indexes for comment
	const commentsAfter = getComments.afterNode([], node.next(), node);

	return processedNodes.concat(commentsBefore, node, commentsAfter);
};

Version data entries

24 entries across 24 versions & 1 rubygems

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