Added a module to tokenize strings of format number_suffix, e.g. 100px

This commit is contained in:
euvl
2017-07-12 16:45:43 +01:00
parent 981a0c8fdb
commit be0297fc84
2 changed files with 77 additions and 2 deletions

View File

@@ -96,7 +96,8 @@
default: 600,
validator (value) {
if (typeof value === 'string') {
return value.charAt(value.length-1) === '%' && !isNaN(parseFloat(value))
return value.charAt(value.length-1) === '%'
&& !isNaN(parseFloat(value))
}
if (typeof value === 'number') {
@@ -109,7 +110,8 @@
default: 300,
validator (value) {
if (typeof value === 'string') {
return value === 'auto' || (value.charAt(value.length-1) === '%' && !isNaN(parseFloat(value)))
return (value.charAt(value.length-1) === '%'
&& !isNaN(parseFloat(value)))
}
if (typeof value === 'number') {