Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-ordered-values

Package Overview
Dependencies
Maintainers
7
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-ordered-values - npm Package Compare versions

Comparing version 7.0.0 to 7.0.1

2

package.json
{
"name": "postcss-ordered-values",
"version": "7.0.0",
"version": "7.0.1",
"description": "Ensure values are ordered consistently in your CSS.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -6,6 +6,7 @@ 'use strict';

const getValue = require('../lib/getValue');
const mathFunctions = require('../lib/mathfunctions.js');
// animation: [ none | <keyframes-name> ] || <time> || <single-timing-function> || <time> || <single-animation-iteration-count> || <single-animation-direction> || <single-animation-fill-mode> || <single-animation-play-state>
const functions = new Set(['steps', 'cubic-bezier', 'frames']);
const keywords = new Set([
const timingFunctions = new Set(['steps', 'cubic-bezier', 'frames']);
const timingKeywords = new Set([
'ease',

@@ -32,7 +33,31 @@ 'ease-in',

* @param {string} value
* @param {string} type
* @param {import('postcss-value-parser').Node} node
* @return {false | import('postcss-value-parser').Dimension}
*/
function unitFromNode(value, node) {
if (node.type !== 'function') {
return unit(value);
}
if (mathFunctions.has(value)) {
// If it is a math function, it checks the unit of the parameter and returns it.
for (const param of node.nodes) {
const paramUnit = unitFromNode(param.value.toLowerCase(), param);
if (paramUnit && paramUnit.unit && paramUnit.unit !== '%') {
return paramUnit;
}
}
}
return false;
}
/**
* @param {string} value
* @param {import('postcss-value-parser').Node} node
* @return {boolean}
*/
const isTimingFunction = (value, type) => {
return (type === 'function' && functions.has(value)) || keywords.has(value);
const isTimingFunction = (value, { type }) => {
return (
(type === 'function' && timingFunctions.has(value)) ||
timingKeywords.has(value)
);
};

@@ -62,6 +87,7 @@ /**

* @param {string} value
* @param {import('postcss-value-parser').Node} node
* @return {boolean}
*/
const isTime = (value) => {
const quantity = unit(value);
const isTime = (value, node) => {
const quantity = unitFromNode(value, node);

@@ -72,6 +98,7 @@ return quantity && timeUnits.has(quantity.unit);

* @param {string} value
* @param {import('postcss-value-parser').Node} node
* @return {boolean}
*/
const isIterationCount = (value) => {
const quantity = unit(value);
const isIterationCount = (value, node) => {
const quantity = unitFromNode(value, node);

@@ -120,3 +147,3 @@ return value === 'infinite' || (quantity && !quantity.unit);

const hasMatch = stateConditions.some(({ property, delegate }) => {
if (delegate(value, type) && !state[property].length) {
if (delegate(value, node) && !state[property].length) {
state[property] = [node, addSpace()];

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc