class-styles
Advanced tools
Comparing version 1.0.0-rc.2 to 1.0.0-rc.3
# Changelog | ||
## v1.0.0-rc.3 | ||
Now can be bound to an object or an array of objects (but not window or global) | ||
## v1.0.0-rc.2 | ||
@@ -4,0 +8,0 @@ |
14
index.js
@@ -15,6 +15,9 @@ /*! | ||
function classStyles () { | ||
var styles = []; | ||
var styles = [], | ||
stylesArray = Array.isArray(this) ? this : [this] | ||
if (!Array.isArray(this)) | ||
throw new Error('classStyles must be bound to an array of style objects') | ||
if ((typeof window !== 'undefined' && this === window) | ||
|| (typeof global !== 'undefined' && this === global)) { | ||
throw new Error('classStyles must be bound to an object, or an array of objects') | ||
} | ||
@@ -37,3 +40,4 @@ for (var i = 0; i < arguments.length; i++) { | ||
// styles is now an array of strings (for lookups) and objects (for folding) | ||
// styles is now an array of strings (for lookups then folding) and objects | ||
// (for folding) | ||
@@ -44,3 +48,3 @@ return styles.reduce( | ||
: objectAssign(result, | ||
this.reduce((keyResult, boundStyle) => objectAssign(keyResult, boundStyle[style]), {}) | ||
stylesArray.reduce((keyResult, boundStyle) => objectAssign(keyResult, boundStyle[style]), {}) | ||
) | ||
@@ -47,0 +51,0 @@ ), {}) |
{ | ||
"name": "class-styles", | ||
"version": "1.0.0-rc.2", | ||
"version": "1.0.0-rc.3", | ||
"description": "A simple utility for folding style objects like css classes", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4818
51