Socket
Socket
Sign inDemoInstall

weex-styler

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

weex-styler - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

lib/shorthand-parser.js

23

index.js

@@ -6,2 +6,3 @@ 'use strict'

var validateItem = require('./lib/validator').validate
var shorthandParser = require('./lib/shorthand-parser')

@@ -62,20 +63,3 @@ // padding & margin shorthand parsing

if (rule.declarations && rule.declarations.length) {
// transition shorthand parsing
var CHUNK_REGEXP = /^(\S*)?\s*(\d*\.?\d+(?:ms|s)?)?\s*(\S*)?\s*(\d*\.?\d+(?:ms|s)?)?$/
for (var i = 0; i < rule.declarations.length; i++) {
var declaration = rule.declarations[i]
if (declaration.property === 'transition') {
var match = declaration.value.match(CHUNK_REGEXP)
/* istanbul ignore else */
if (match) {
rule.declarations.splice(i, 1)
match[4] && rule.declarations.push(i, 0, {type: 'declaration', property: 'transition-delay', value: match[4], position: declaration.position})
match[3] && rule.declarations.push(i, 0, {type: 'declaration', property: 'transition-timing-function', value: match[3], position: declaration.position})
match[2] && rule.declarations.push(i, 0, {type: 'declaration', property: 'transition-duration', value: match[2], position: declaration.position})
match[1] && rule.declarations.push(i, 0, {type: 'declaration', property: 'transition-property', value: match[1], position: declaration.position})
break
}
}
}
rule.declarations = shorthandParser(rule.declarations)
// padding & margin shorthand parsing

@@ -130,5 +114,4 @@ convertLengthShorthand(rule, 'padding')

Object.keys(ruleResult).forEach(function (prop) {
// handle transition
if (prop.indexOf('transition') === 0) {
if (prop.indexOf('transition') === 0 && prop !== 'transition') {
var realProp = prop.replace('transition', '')

@@ -135,0 +118,0 @@ realProp = realProp[0].toLowerCase() + realProp.slice(1)

@@ -5,3 +5,3 @@ /**

* - -abc-def -> AbcDef
*
*
* @param {string} value

@@ -20,3 +20,3 @@ * @return {string}

* - AbcDef -> -abc-def
*
*
* @param {string} value

@@ -27,4 +27,7 @@ * @return {string}

return value.replace(/([A-Z])/g, function(s, m) {
return '-' + m.toLowerCase()
if (typeof m === 'string') {
return '-' + m.toLowerCase()
}
return m
})
}

@@ -177,2 +177,6 @@ var util = require('./util')

var ANYTHING_VALIDATOR = function ANYTHING_VALIDATOR(v) {
return { value: v }
}
/**

@@ -560,3 +564,4 @@ * the values below is valid

opacity: NUMBER_VALIDATOR,
backgroundColor: COLOR_VALIDATOR
backgroundColor: COLOR_VALIDATOR,
backgroundImage: ANYTHING_VALIDATOR
},

@@ -568,5 +573,7 @@ text: {

fontStyle: genEnumValidator(['normal', 'italic']),
fontFamily: ANYTHING_VALIDATOR,
fontWeight: genEnumValidator(['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900']),
textDecoration: genEnumValidator(['none', 'underline', 'line-through']),
textAlign: genEnumValidator(['left', 'center', 'right'])
textAlign: genEnumValidator(['left', 'center', 'right']),
lineHeight: LENGTH_VALIDATOR
},

@@ -573,0 +580,0 @@ transition: {

{
"name": "weex-styler",
"version": "0.2.2",
"version": "0.2.3",
"description": "Weex <style> transformer",

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

@@ -173,4 +173,4 @@ var chai = require('chai')

expect(data.log).eql([
{line: 1, column: 22, reason: 'NOTE: property value `1s` is autofixed to `1000`'},
{line: 1, column: 22, reason: 'NOTE: property value `500ms` is autofixed to `500`'}
{line: 1, column: 22, reason: 'NOTE: property value `500ms` is autofixed to `500`'},
{line: 1, column: 22, reason: 'NOTE: property value `1s` is autofixed to `1000`'}
])

@@ -177,0 +177,0 @@ done()

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