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

postcss-unit-unit

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-unit-unit - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

21

index.d.ts

@@ -1,2 +0,21 @@

declare function px2rpx({ }: any)
// 任意样式单位转换工具
declare function px2rpx({
unitToConvert: string,
viewportWidth: number,
unitPrecision: number,
propList: any,
viewportUnit: string,
fontViewportUnit: string,
fullViewportWidth: number,
selectorBlackList: array,
minPixelValue: number,
mediaQuery: any,
replace: boolean,
exclude: any,
include: any,
landscape: boolean,
landscapeUnit: string,
landscapeWidth: number
}: object)
export = px2rpx

10

index.js

@@ -1,4 +0,4 @@

let objectAssign = require("object-assign");
let getUnitRegexp = require("./pixel-unit-regexp");
let { createPropListMatcher } = require("./prop-list-matcher");
const getUnitRegexp = require("./pixel-unit-regexp");
const { createPropListMatcher } = require("./prop-list-matcher")
const { AtRule } = require("postcss");

@@ -22,3 +22,3 @@ function px2rpx(options) {

};
let opts = objectAssign({}, defaults, options);
let opts = Object.assign({}, defaults, options);
let pxRegex = getUnitRegexp(opts.unitToConvert);

@@ -28,3 +28,3 @@ let satisfyPropList = createPropListMatcher(opts.propList);

return {
postcssPlugin: "postcss-px-to-viewport",
postcssPlugin: "postcss-unit-unit",
Once(root) {

@@ -31,0 +31,0 @@ root.walkRules((rule) => {

@@ -5,3 +5,3 @@ {

"description": "A CSS post-processor that converts px to viewport units (vw, vh, rpx, rem, vmin, vmax).",
"version": "1.0.4",
"version": "1.0.5",
"license": "MIT",

@@ -8,0 +8,0 @@ "author": {

@@ -1,6 +0,3 @@

module.exports = (unit) => {
return new RegExp(
"\"[^\"]+\"|'[^']+'|url\\([^\\)]+\\)|(\\d*\\.?\\d+)" + unit,
"g"
);
};
module.exports = (unit)=> {
return new RegExp("\"[^\"]+\"|'[^']+'|url\\([^\\)]+\\)|(\\d*\\.?\\d+)" + unit,"g");
}
const filterPropList = {
exact: (list) => list.filter((m) => m.match(/^[^\*\!]+$/)),
contain: (list) =>
list
.filter((m) => m.match(/^\*.+\*$/))
.map((m) => m.substr(1, m.length - 2)),
endWith: (list) =>
list.filter((m) => m.match(/^\*[^\*]+$/)).map((m) => m.substr(1)),
startWith: (list) =>
list
.filter((m) => m.match(/^[^\*\!]+\*$/))
.map((m) => m.substr(0, m.length - 1)),
notExact: (list) =>
list.filter((m) => m.match(/^\![^\*].*$/)).map((m) => m.substr(1)),
notContain: (list) =>
list
.filter((m) => m.match(/^\!\*.+\*$/))
.map((m) => m.substr(2, m.length - 3)),
notEndWith: (list) =>
list.filter((m) => m.match(/^\!\*[^\*]+$/)).map((m) => m.substr(2)),
notStartWith: (list) =>
list
.filter((m) => m.match(/^\![^\*]+\*$/))
.map((m) => m.substr(1, m.length - 2)),
contain: (list) => list.filter((m) => m.match(/^\*.+\*$/)).map((m) => m.substr(1, m.length - 2)),
endWith: (list) => list.filter((m) => m.match(/^\*[^\*]+$/)).map((m) => m.substr(1)),
startWith: (list) => list.filter((m) => m.match(/^[^\*\!]+\*$/)).map((m) => m.substr(0, m.length - 1)),
notExact: (list) => list.filter((m) => m.match(/^\![^\*].*$/)).map((m) => m.substr(1)),
notContain: (list) => list.filter((m) => m.match(/^\!\*.+\*$/)).map((m) => m.substr(2, m.length - 3)),
notEndWith: (list) => list.filter((m) => m.match(/^\!\*[^\*]+$/)).map((m) => m.substr(2)),
notStartWith: (list) => list.filter((m) => m.match(/^\![^\*]+\*$/)).map((m) => m.substr(1, m.length - 2)),
};

@@ -47,5 +32,3 @@

lists.startWith.some((m) => prop.indexOf(m) === 0) ||
lists.endWith.some(
(m) => prop.indexOf(m) === prop.length - m.length
)) &&
lists.endWith.some((m) => prop.indexOf(m) === prop.length - m.length)) &&
!(

@@ -52,0 +35,0 @@ lists.notExact.indexOf(prop) > -1 ||

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