Socket
Socket
Sign inDemoInstall

postcss-merge-longhand

Package Overview
Dependencies
15
Maintainers
7
Versions
63
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.1.4 to 5.1.5

5

package.json
{
"name": "postcss-merge-longhand",
"version": "5.1.4",
"version": "5.1.5",
"description": "Merge longhand properties into shorthand with PostCSS.",

@@ -42,4 +42,3 @@ "main": "src/index.js",

"postcss": "^8.2.15"
},
"readme": "# [postcss][postcss]-merge-longhand\n\n> Merge longhand properties into shorthand with PostCSS.\n\n## Install\n\nWith [npm](https://npmjs.org/package/postcss-merge-longhand) do:\n\n```\nnpm install postcss-merge-longhand --save\n```\n\n## Example\n\nMerge longhand properties into shorthand; works with `margin`, `padding` &\n`border`. For more examples see the [tests](src/__tests__/index.js).\n\n### Input\n\n```css\nh1 {\n margin-top: 10px;\n margin-right: 20px;\n margin-bottom: 10px;\n margin-left: 20px;\n}\n```\n\n### Output\n\n```css\nh1 {\n margin: 10px 20px;\n}\n```\n\n## Usage\n\nSee the [PostCSS documentation](https://github.com/postcss/postcss#usage) for\nexamples for your environment.\n\n## Contributors\n\nSee [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).\n\n## License\n\nMIT © [Ben Briggs](http://beneb.info)\n\n[postcss]: https://github.com/postcss/postcss\n"
}
}

53

src/lib/decl/borders.js

@@ -14,3 +14,2 @@ 'use strict';

const canMerge = require('../canMerge.js');
const remove = require('../remove.js');
const trbl = require('../trbl.js');

@@ -25,2 +24,4 @@ const isCustomProp = require('../isCustomProp.js');

const defaults = ['medium', 'none', 'currentcolor'];
const colorMightRequireFallback =
/(hsla|rgba|color|hwb|lab|lch|oklab|oklch)\(/i;

@@ -278,5 +279,6 @@ /**

);
for (const node of rules) {
node.remove();
}
rules.forEach(remove);
return true;

@@ -307,3 +309,5 @@ }

rules.forEach(remove);
for (const node of rules) {
node.remove();
}

@@ -357,3 +361,5 @@ return true;

rules.forEach(remove);
for (const node of rules) {
node.remove();
}

@@ -408,3 +414,5 @@ return true;

}
rules.forEach(remove);
for (const node of rules) {
node.remove();
}

@@ -422,3 +430,3 @@ return true;

.filter((node) => node.prop.toLowerCase() !== properties[2])
.forEach(remove);
.forEach((node) => node.remove());

@@ -472,3 +480,5 @@ return true;

rules.forEach(remove);
for (const node of rules) {
node.remove();
}

@@ -523,3 +533,5 @@ return true;

rules.forEach(remove);
for (const node of rules) {
node.remove();
}

@@ -684,3 +696,5 @@ return true;

decls = decls.filter((node) => !rules.includes(node));
rules.forEach(remove);
for (const node of rules) {
node.remove();
}
}

@@ -752,3 +766,5 @@ });

) {
longhands.forEach(remove);
for (const node of longhands) {
node.remove();
}

@@ -815,3 +831,5 @@ insertCloned(

lesser.forEach(remove);
for (const node of lesser) {
node.remove();
}
decls = decls.filter((node) => !lesser.includes(node));

@@ -831,5 +849,7 @@

if (duplicates.length) {
if (/hsla\(|rgba\(/i.test(getColorValue(lastNode))) {
if (colorMightRequireFallback.test(getColorValue(lastNode))) {
const preserve = duplicates
.filter((node) => !/hsla\(|rgba\(/i.test(getColorValue(node)))
.filter(
(node) => !colorMightRequireFallback.test(getColorValue(node))
)
.pop();

@@ -839,4 +859,5 @@

}
duplicates.forEach(remove);
for (const node of duplicates) {
node.remove();
}
}

@@ -843,0 +864,0 @@

@@ -10,3 +10,2 @@ 'use strict';

const mergeValues = require('../mergeValues.js');
const remove = require('../remove.js');
const trbl = require('../trbl.js');

@@ -40,3 +39,5 @@ const isCustomProp = require('../isCustomProp.js');

lesser.forEach(remove);
for (const node of lesser) {
node.remove();
}
decls = decls.filter((node) => !lesser.includes(node));

@@ -55,3 +56,5 @@

duplicates.forEach(remove);
for (const node of duplicates) {
node.remove();
}
decls = decls.filter(

@@ -103,3 +106,5 @@ (node) => node !== lastNode && !duplicates.includes(node)

);
rules.forEach(remove);
for (const node of rules) {
node.remove();
}

@@ -106,0 +111,0 @@ return true;

@@ -10,3 +10,2 @@ 'use strict';

const insertCloned = require('../insertCloned.js');
const remove = require('../remove.js');
const isCustomProp = require('../isCustomProp.js');

@@ -108,3 +107,5 @@ const canExplode = require('../canExplode.js');

lesser.forEach(remove);
for (const node of lesser) {
node.remove();
}
decls = decls.filter((node) => !lesser.includes(node));

@@ -123,3 +124,5 @@

duplicates.forEach(remove);
for (const node of duplicates) {
node.remove();
}
decls = decls.filter(

@@ -147,3 +150,5 @@ (node) => node !== lastNode && !duplicates.includes(node)

rules.forEach(remove);
for (const node of rules) {
node.remove();
}

@@ -150,0 +155,0 @@ return true;

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