Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
weex-styler
Advanced tools
<style>
Transformer<style>
element to JSON formatparse(code, done)
validate(json, done)
validateItem(name, value)
util.hyphenedToCamelCase(value)
util.camelCaseToHyphened(value)
/**
* Parse `<style>` code to a JSON Object and log errors & warnings
*
* @param {string} code
* @param {function} done
*/
function parse(code, done) {}
/**
* Validate a JSON Object and log errors & warnings
*
* @param {object} json
* @param {function} done
*/
function validate(json, done) {}
/**
* Result callback
*
* data
* - jsonStyle{}: `classname.propname.value`-like object
* - log[{line, column, reason}]
*
* @param {Error} err
* @param {object} data
*/
function done(err, data) {}
/**
* Validate a single name-value pair
*
* @param {string} name camel cased
* @param {string} value
* @return {object}
* - value
* - log{reason}
*/
function validateItem(name, value) {}
#xxx
-> warning: #xxxxxx
transparent
-> error: not supported100px
-> warning: 100
var styler = require('weex-styler')
var code = 'html {color: #000000;} .foo {color: red; -webkit-transform: rotate(90deg); width: 200px;}'
styler.parse(code, function (err, data) {
// syntax error
// format: {line, column, reason, ...}
err
// result
// {foo: {color: '#ff0000', webkitTransform: 'rotate(90deg)', width: 200}}
data.jsonStyle
// format: {line, column, reason}
// - Error: Selector `html` is not supported. Weex only support single-classname selector
// - Warning: prop value `red` is autofixed to `#ff0000`
// - Warning: prop name `-webkit-transform` is not supported
// - Warning: prop value `200px` is autofixed to `200`
data.log[]
})
var jsonStyle = {
foo: {
color: 'red',
webkitTransform: 'rotate(90deg)',
width: '200px'
}
}
styler.validate(json, function (err, data) {
// syntax error
err
// result
// {foo: {color: '#ff0000', webkitTransform: 'rotate(90deg)', width: 200}}
data.jsonStyle
// format: {reason}
// - Warning: prop value `red` is autofixed to `#ff0000`
// - Warning: prop name `-webkit-transform` is not supported
// - Warning: prop value `200px` is autofixed to `200`
data.log[]
})
FAQs
Weex <style> transformer
The npm package weex-styler receives a total of 10,430 weekly downloads. As such, weex-styler popularity was classified as popular.
We found that weex-styler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.