Socket
Socket
Sign inDemoInstall

postcss-discard-empty

Package Overview
Dependencies
4
Maintainers
8
Versions
42
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-empty",
"version": "5.0.3",
"version": "5.1.0",
"description": "Discard empty rules and values 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';
const plugin = 'postcss-discard-empty';
/**
* @param {import('postcss').Root} css
* @param {import('postcss').Result} result
* @return {void}
*/
function discardAndReport(css, result) {
/**
* @param {import('postcss').AnyNode} node
* @return {void}
*/
function discardEmpty(node) {
const { type, nodes: sub, params } = node;
const { type } = node;
/** @type {(import('postcss').ChildNode | import('postcss').ChildProps)[] | undefined} */
const sub = /** @type {any} */ (node).nodes;
if (sub) {
node.each(discardEmpty);
/** @type {import('postcss').Container} */ (node).each(discardEmpty);
}

@@ -16,3 +25,6 @@

(sub && !sub.length) ||
(type === 'atrule' && ((!sub && !params) || (!params && !sub.length)))
(type === 'atrule' &&
((!sub && !node.params) ||
(!node.params &&
!(/** @type {import('postcss').ChildNode[]}*/ (sub).length))))
) {

@@ -32,2 +44,6 @@ node.remove();

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

@@ -34,0 +50,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