fela-plugin-theme-value
Advanced tools
Comparing version 11.4.0 to 11.5.0-rc.0
import isPlainObject from 'isobject'; | ||
import arrayReduce from 'fast-loops/lib/arrayReduce'; | ||
function getValue(object, key) { | ||
var value = key.split('.').reduce(function (value, key) { | ||
if (isPlainObject(value) && value[key]) { | ||
return value[key]; | ||
function getThemeValue(object, key) { | ||
var value = arrayReduce(key.split('.'), function (value, index) { | ||
if (isPlainObject(value) && value[index]) { | ||
return value[index]; | ||
} | ||
@@ -23,3 +24,3 @@ | ||
if (typeof value === 'string' && mapping[property]) { | ||
style[property] = getValue(mapping[property](theme), value); | ||
style[property] = getThemeValue(mapping[property](theme), value); | ||
} else if (isPlainObject(value)) { | ||
@@ -26,0 +27,0 @@ style[property] = resolveThemeValues(style[property], theme, mapping); |
@@ -12,8 +12,12 @@ 'use strict'; | ||
var _arrayReduce = require('fast-loops/lib/arrayReduce'); | ||
var _arrayReduce2 = _interopRequireDefault(_arrayReduce); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function getValue(object, key) { | ||
var value = key.split('.').reduce(function (value, key) { | ||
if ((0, _isobject2.default)(value) && value[key]) { | ||
return value[key]; | ||
function getThemeValue(object, key) { | ||
var value = (0, _arrayReduce2.default)(key.split('.'), function (value, index) { | ||
if ((0, _isobject2.default)(value) && value[index]) { | ||
return value[index]; | ||
} | ||
@@ -27,3 +31,2 @@ | ||
function resolveThemeValues(style) { | ||
@@ -37,3 +40,3 @@ var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
if (typeof value === 'string' && mapping[property]) { | ||
style[property] = getValue(mapping[property](theme), value); | ||
style[property] = getThemeValue(mapping[property](theme), value); | ||
} else if ((0, _isobject2.default)(value)) { | ||
@@ -40,0 +43,0 @@ style[property] = resolveThemeValues(style[property], theme, mapping); |
{ | ||
"name": "fela-plugin-theme-value", | ||
"version": "11.4.0", | ||
"version": "11.5.0-rc.0", | ||
"description": "Fela plugin to resolve values from a theme", | ||
@@ -20,3 +20,3 @@ "main": "lib/index.js", | ||
"theme", | ||
"themed-ui", | ||
"theme-ui", | ||
"mixin", | ||
@@ -28,3 +28,3 @@ "cssinjs" | ||
"dependencies": { | ||
"css-in-js-utils": "^3.0.0", | ||
"fast-loops": "^1.1.3", | ||
"isobject": "^3.0.1" | ||
@@ -35,3 +35,3 @@ }, | ||
}, | ||
"gitHead": "94e23ad2fda221aea52ccb939d90f81eb400b5fb" | ||
"gitHead": "6d457d39e69e1471bddaea8591c50745f95070d9" | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
6979
66
2
+ Addedfast-loops@^1.1.3
- Removedcss-in-js-utils@^3.0.0