
Security News
CISA Kills Off RSS Feeds for KEVs and Cyber Alerts
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
@imgcook/dsl-css-processor
Advanced tools
import Processor, { weex, web } from '<Package Name>';
// 定义处理规则,具体规则格式请参见下文。
// 也可以直接使用预定义的 `weex` 和 `web`。
let processor = new Processor({
units: ['px', 'pt'],
properties: {
width: {
initial: null,
syntax: ''
},
// ...
}
});
// processor.getPropertyData(key)
// 获取规则数据。以下两种参数等价。
processor.getPropertyData('padding-left')
processor.getPropertyData('paddingLeft')
// processor.isValidStyle(key, value = null)
// 检验属性在当前规则下是否合法。如果 `value` 不为 `null` 且属性为枚举类型,将同时检验参数合法性。
processor.isValidStyle('position') // true
processor.isValidStyle('non-exist') // false
processor.isValidStyle('position', 'absolute') // true
processor.isValidStyle('position', 'random') // false
// processor.isInitialValue(key, value)
// 检验属性在当前规则下是否为初始值。如规则中初始值为 `'0'`,则尝试去除 `value` 中的单位并比较。
processor.isInitialValue('margin-left', '0') // true
processor.isInitialValue('margin-left', '0%') // true
processor.isInitialValue('margin-left', '0px') // true
// processor.filter(style)
// 传入属性的键值对,返回在当前规则下合法且不为初始值的子集。
processor.filter({ /* ...*/ })
规则分为 units
和 properties
两部分。
units
units
格式为 Array<string>
,只有包含在其中的属性和 %
被视为合法单位,并在与 '0'
的比较中尝试移除。
properties
properties
格式如下:
{
[key: string]: {
initial: string,
syntax: Array<string> | string
}
}
key
:属性名initial
:属性默认值。若为 null
,则此属性无默认值syntax
: 属性值格式,数组表示可选其中的任意一种格式。注:目前只支持字面量判断,不支持类型和表达式。当此项为数组时,属性值为数组中任一值时为合法,否则为非法。FAQs
## 使用说明
The npm package @imgcook/dsl-css-processor receives a total of 427 weekly downloads. As such, @imgcook/dsl-css-processor popularity was classified as not popular.
We found that @imgcook/dsl-css-processor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.