Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

style-value-types

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

style-value-types - npm Package Compare versions

Comparing version 3.0.4 to 3.0.5

LICENSE.md

6

CHANGELOG.md

@@ -5,2 +5,8 @@ # Changelog

## [3.0.5] 2018-08-14
### Fixed
- Preventing `complex` from matching `number`.
## [3.0.4] 2018-08-13

@@ -7,0 +13,0 @@

2

dist/style-value-types.es.js

@@ -182,3 +182,3 @@ /*! *****************************************************************************

test: function (v) {
if (typeof v !== 'string')
if (typeof v !== 'string' || !isNaN(v))
return false;

@@ -185,0 +185,0 @@ var numValues = 0;

@@ -188,3 +188,3 @@ (function (global, factory) {

test: function (v) {
if (typeof v !== 'string')
if (typeof v !== 'string' || !isNaN(v))
return false;

@@ -191,0 +191,0 @@ var numValues = 0;

@@ -1,1 +0,1 @@

!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(r.valueTypes={})}(this,function(r){"use strict";var t=function(){return(t=Object.assign||function(r){for(var t,n=1,e=arguments.length;n<e;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=t[a]);return r}).apply(this,arguments)},n=function(r,t){return function(n){return Math.max(Math.min(n,t),r)}},e=function(r){return function(t){return"string"==typeof t&&0===t.indexOf(r)}},a={test:function(r){return"number"==typeof r},parse:parseFloat,transform:function(r){return r}},s=t({},a,{transform:n(0,1)}),u=t({},a,{default:1}),o=function(r){var t,n=(t=r,function(r){return"string"==typeof r&&-1!==r.indexOf(t)});return{test:function(r){return"string"==typeof r&&n(r)&&1===r.split(" ").length},parse:parseFloat,transform:function(t){return""+t+r}}},f=o("deg"),i=o("%"),p=o("px"),c=o("vh"),l=o("vw"),h=n(0,255),g=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,d=function(r){return void 0!==r.red},m=function(r){return void 0!==r.hue},v=function(r){var t=r.length;return function(n){if("string"!=typeof n)return n;for(var e,a={},s=function(r){return"string"==typeof r?r.split(/,\s*/):[r]}((e=n).substring(e.indexOf("(")+1,e.lastIndexOf(")"))),u=0;u<t;u++)a[r[u]]=void 0!==s[u]?parseFloat(s[u]):1;return a}},b=t({},a,{transform:function(r){return Math.round(h(r))}}),y=e("rgb"),x={test:function(r){return"string"==typeof r?y(r):d(r)},parse:v(["red","green","blue","alpha"]),transform:function(r){var t=r.red,n=r.green,e=r.blue,a=r.alpha;return function(r){var t=r.red,n=r.green,e=r.blue,a=r.alpha;return"rgba("+t+", "+n+", "+e+", "+(void 0===a?1:a)+")"}({red:b.transform(t),green:b.transform(n),blue:b.transform(e),alpha:a})}},O=e("hsl"),$={test:function(r){return"string"==typeof r?O(r):m(r)},parse:v(["hue","saturation","lightness","alpha"]),transform:function(r){var t=r.hue,n=r.saturation,e=r.lightness,a=r.alpha;return function(r){var t=r.hue,n=r.saturation,e=r.lightness,a=r.alpha;return"hsla("+t+", "+n+", "+e+", "+(void 0===a?1:a)+")"}({hue:Math.round(t),saturation:i.transform(n),lightness:i.transform(e),alpha:a})}},M=t({},x,{test:e("#"),parse:function(r){var t="",n="",e="";return r.length>4?(t=r.substr(1,2),n=r.substr(3,2),e=r.substr(5,2)):(t=r.substr(1,1),n=r.substr(2,1),e=r.substr(3,1),t+=t,n+=n,e+=e),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(e,16),alpha:1}}}),j={test:function(r){return"string"==typeof r&&g.test(r)||x.test(r)||$.test(r)||M.test(r)},parse:function(r){return x.test(r)?x.parse(r):$.test(r)?$.parse(r):M.test(r)?M.parse(r):r},transform:function(r){return d(r)?x.transform(r):m(r)?$.transform(r):r}},I=/(-)?(\d[\d\.]*)/g,w=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,F={test:function(r){if("string"!=typeof r)return!1;var t=0,n=r.match(I),e=r.match(w);return n&&(t+=n.length),e&&(t+=e.length),t>0},parse:function(r){var t=r,n=[],e=t.match(w);e&&(t=t.replace(w,"${c}"),n.push.apply(n,e.map(j.parse)));var s=t.match(I);return s&&n.push.apply(n,s.map(a.parse)),n},createTransformer:function(r){var t=r,n=0,e=r.match(w),a=e?e.length:0;if(e)for(var s=0;s<a;s++)t=t.replace(e[s],"${c}"),n++;var u=t.match(I),o=u?u.length:0;if(u)for(s=0;s<o;s++)t=t.replace(u[s],"${n}"),n++;return function(r){for(var e=t,s=0;s<n;s++)e=e.replace(s<a?"${c}":"${n}",s<a?j.transform(r[s]):r[s]);return e}}};r.number=a,r.scale=u,r.alpha=s,r.degrees=f,r.percent=i,r.px=p,r.vw=l,r.vh=c,r.rgba=x,r.rgbUnit=b,r.hex=M,r.hsla=$,r.color=j,r.complex=F,Object.defineProperty(r,"__esModule",{value:!0})});
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(r.valueTypes={})}(this,function(r){"use strict";var t=function(){return(t=Object.assign||function(r){for(var t,n=1,e=arguments.length;n<e;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=t[a]);return r}).apply(this,arguments)},n=function(r,t){return function(n){return Math.max(Math.min(n,t),r)}},e=function(r){return function(t){return"string"==typeof t&&0===t.indexOf(r)}},a={test:function(r){return"number"==typeof r},parse:parseFloat,transform:function(r){return r}},s=t({},a,{transform:n(0,1)}),u=t({},a,{default:1}),o=function(r){var t,n=(t=r,function(r){return"string"==typeof r&&-1!==r.indexOf(t)});return{test:function(r){return"string"==typeof r&&n(r)&&1===r.split(" ").length},parse:parseFloat,transform:function(t){return""+t+r}}},f=o("deg"),i=o("%"),p=o("px"),c=o("vh"),l=o("vw"),h=n(0,255),g=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,d=function(r){return void 0!==r.red},m=function(r){return void 0!==r.hue},v=function(r){var t=r.length;return function(n){if("string"!=typeof n)return n;for(var e,a={},s=function(r){return"string"==typeof r?r.split(/,\s*/):[r]}((e=n).substring(e.indexOf("(")+1,e.lastIndexOf(")"))),u=0;u<t;u++)a[r[u]]=void 0!==s[u]?parseFloat(s[u]):1;return a}},b=t({},a,{transform:function(r){return Math.round(h(r))}}),y=e("rgb"),x={test:function(r){return"string"==typeof r?y(r):d(r)},parse:v(["red","green","blue","alpha"]),transform:function(r){var t=r.red,n=r.green,e=r.blue,a=r.alpha;return function(r){var t=r.red,n=r.green,e=r.blue,a=r.alpha;return"rgba("+t+", "+n+", "+e+", "+(void 0===a?1:a)+")"}({red:b.transform(t),green:b.transform(n),blue:b.transform(e),alpha:a})}},O=e("hsl"),$={test:function(r){return"string"==typeof r?O(r):m(r)},parse:v(["hue","saturation","lightness","alpha"]),transform:function(r){var t=r.hue,n=r.saturation,e=r.lightness,a=r.alpha;return function(r){var t=r.hue,n=r.saturation,e=r.lightness,a=r.alpha;return"hsla("+t+", "+n+", "+e+", "+(void 0===a?1:a)+")"}({hue:Math.round(t),saturation:i.transform(n),lightness:i.transform(e),alpha:a})}},M=t({},x,{test:e("#"),parse:function(r){var t="",n="",e="";return r.length>4?(t=r.substr(1,2),n=r.substr(3,2),e=r.substr(5,2)):(t=r.substr(1,1),n=r.substr(2,1),e=r.substr(3,1),t+=t,n+=n,e+=e),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(e,16),alpha:1}}}),j={test:function(r){return"string"==typeof r&&g.test(r)||x.test(r)||$.test(r)||M.test(r)},parse:function(r){return x.test(r)?x.parse(r):$.test(r)?$.parse(r):M.test(r)?M.parse(r):r},transform:function(r){return d(r)?x.transform(r):m(r)?$.transform(r):r}},I=/(-)?(\d[\d\.]*)/g,w=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,F={test:function(r){if("string"!=typeof r||!isNaN(r))return!1;var t=0,n=r.match(I),e=r.match(w);return n&&(t+=n.length),e&&(t+=e.length),t>0},parse:function(r){var t=r,n=[],e=t.match(w);e&&(t=t.replace(w,"${c}"),n.push.apply(n,e.map(j.parse)));var s=t.match(I);return s&&n.push.apply(n,s.map(a.parse)),n},createTransformer:function(r){var t=r,n=0,e=r.match(w),a=e?e.length:0;if(e)for(var s=0;s<a;s++)t=t.replace(e[s],"${c}"),n++;var u=t.match(I),o=u?u.length:0;if(u)for(s=0;s<o;s++)t=t.replace(u[s],"${n}"),n++;return function(r){for(var e=t,s=0;s<n;s++)e=e.replace(s<a?"${c}":"${n}",s<a?j.transform(r[s]):r[s]);return e}}};r.number=a,r.scale=u,r.alpha=s,r.degrees=f,r.percent=i,r.px=p,r.vw=l,r.vh=c,r.rgba=x,r.rgbUnit=b,r.hex=M,r.hsla=$,r.color=j,r.complex=F,Object.defineProperty(r,"__esModule",{value:!0})});

@@ -186,3 +186,3 @@ 'use strict';

test: function (v) {
if (typeof v !== 'string')
if (typeof v !== 'string' || !isNaN(v))
return false;

@@ -189,0 +189,0 @@ var numValues = 0;

{
"name": "style-value-types",
"version": "3.0.4",
"version": "3.0.5",
"description": "Parsers, transformers and tests for special value types, eg: %, hex codes etc.",

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

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