Socket
Socket
Sign inDemoInstall

weex-styler

Package Overview
Dependencies
1
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.4 to 0.1.5

23

lib/validator.js

@@ -366,7 +366,22 @@ var util = require('./util')

var TRANSITION_INTERVAL_VALIDATOR = function TRANSITION_INTERVAL_VALIDATOR(v) {
v = (v || '0s').toString()
var match
v = (v || 0).toString()
var match, num, ret
if (match = v.match(/^[0-9]*\.?[0-9]+(ms|s)$/)) {
return {value: v}
if (match = v.match(/^[0-9]*\.?[0-9]+(ms|s)?$/)) {
num = parseFloat(match[0])
if (!match[1]) {
ret = {value: parseInt(num)}
}
else {
if (match[1] === 's') {
num *= 1000
}
ret = {
value: parseInt(num),
reason: function reason(k, v, result) {
return 'NOTE: property value `' + v + '` is autofixed to `' + result + '`'
}
}
}
return ret
}

@@ -373,0 +388,0 @@

2

package.json
{
"name": "weex-styler",
"version": "0.1.4",
"version": "0.1.5",
"description": "Weex <style> transformer",

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

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

expect(data).is.an.object
expect(data.jsonStyle).eql({'@TRANSITION': {foo: {property: 'marginTop', duration: '300ms', delay: '0.2s', timingFunction: 'ease-in'}}})
expect(data.log).eql([])
expect(data.jsonStyle).eql({'@TRANSITION': {foo: {property: 'marginTop', duration: 300, delay: 200, timingFunction: 'ease-in'}}})
expect(data.log).eql([
{line: 1, column: 40, reason: 'NOTE: property value `300ms` is autofixed to `300`'},
{line: 1, column: 68, reason: 'NOTE: property value `0.2s` is autofixed to `200`'}
])
done()

@@ -94,4 +97,4 @@ })

'@TRANSITION': {
foo: {property: 'marginTop', duration: '300ms', delay: '0.2s', timingFunction: 'ease-in'},
bar: {property: 'marginTop', duration: '300ms', delay: '0.2s', timingFunction: 'ease-in'}
foo: {property: 'marginTop', duration: 300, delay: 200, timingFunction: 'ease-in'},
bar: {property: 'marginTop', duration: 300, delay: 200, timingFunction: 'ease-in'}
},

@@ -101,3 +104,6 @@ foo: {fontSize: 20, color: '#ff5000', height: 30},

})
expect(data.log).eql([])
expect(data.log).eql([
{line: 3, column: 75, reason: 'NOTE: property value `300ms` is autofixed to `300`'},
{line: 3, column: 103, reason: 'NOTE: property value `0.2s` is autofixed to `200`'}
])
done()

@@ -104,0 +110,0 @@ })

@@ -295,9 +295,12 @@ var chai = require('chai')

foo: {
transitionDuration: '200ms',
transitionDelay: '0.5s'
transitionDuration: 200,
transitionDelay: 500
},
bar: {}
bar: {
transitionDuration: 200
}
})
expect(data.log).eql([
{reason: 'ERROR: property value `200` is not supported for `transition-duration` (only number of seconds and milliseconds is valid)'},
{reason: 'NOTE: property value `200ms` is autofixed to `200`'},
{reason: 'NOTE: property value `0.5s` is autofixed to `500`'},
{reason: 'ERROR: property value `abc` is not supported for `transition-delay` (only number of seconds and milliseconds is valid)'}

@@ -304,0 +307,0 @@ ])

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc