Socket
Socket
Sign inDemoInstall

postcss-discard-duplicates

Package Overview
Dependencies
4
Maintainers
8
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.3 to 5.1.0

types/index.d.ts

6

package.json
{
"name": "postcss-discard-duplicates",
"version": "5.0.3",
"version": "5.1.0",
"description": "Discard duplicate rules in your CSS files with PostCSS.",
"main": "src/index.js",
"types": "types/index.d.ts",
"files": [
"src",
"LICENSE-MIT"
"LICENSE-MIT",
"types"
],

@@ -10,0 +12,0 @@ "keywords": [

'use strict';
/**
* @param {string | undefined} value
* @return {string | undefined}
*/
function trimValue(value) {

@@ -6,2 +10,6 @@ return value ? value.trim() : value;

/**
* @param {{nodes: import('postcss').Node[]}} node
* @return {boolean}
*/
function empty(node) {

@@ -11,3 +19,10 @@ return !node.nodes.filter((child) => child.type !== 'comment').length;

function equals(a, b) {
/**
* @param {import('postcss').AnyNode} nodeA
* @param {import('postcss').AnyNode} nodeB
* @return {boolean}
*/
function equals(nodeA, nodeB) {
const a = /** @type {any} */ (nodeA);
const b = /** @type {any} */ (nodeB);
if (a.type !== b.type) {

@@ -72,2 +87,7 @@ return false;

/**
* @param {import('postcss').Rule} last
* @param {import('postcss').AnyNode[]} nodes
* @return {void}
*/
function dedupeRule(last, nodes) {

@@ -91,2 +111,7 @@ let index = nodes.indexOf(last) - 1;

/**
* @param {import('postcss').AtRule | import('postcss').Declaration} last
* @param {import('postcss').AnyNode[]} nodes
* @return {void}
*/
function dedupeNode(last, nodes) {

@@ -103,4 +128,11 @@ let index = nodes.includes(last) ? nodes.indexOf(last) - 1 : nodes.length - 1;

/**
* @param {import('postcss').AnyNode} root
* @return {void}
*/
function dedupe(root) {
const { nodes } = root;
const { nodes } =
/** @type {import('postcss').Container<import('postcss').ChildNode>} */ (
root
);

@@ -126,2 +158,6 @@ if (!nodes) {

/**
* @type {import('postcss').PluginCreator<void>}
* @return {import('postcss').Plugin}
*/
function pluginCreator() {

@@ -128,0 +164,0 @@ return {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc