styled-tools
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -8,2 +8,4 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _get2 = require('lodash/get'); | ||
@@ -34,3 +36,8 @@ | ||
*/ | ||
const get = exports.get = (path, defaultValue) => (props = {}) => (0, _get3.default)(props, path, defaultValue); | ||
var get = exports.get = function get(path, defaultValue) { | ||
return function () { | ||
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
return (0, _get3.default)(props, path, defaultValue); | ||
}; | ||
}; | ||
@@ -51,14 +58,20 @@ /** | ||
*/ | ||
const ifProp = exports.ifProp = (needle, pass, fail) => (props = {}) => { | ||
let result; | ||
if (Array.isArray(needle)) { | ||
result = !(0, _at2.default)(props, needle).filter(value => !value).length; | ||
} else if (typeof needle === 'object') { | ||
const needleKeys = Object.keys(needle); | ||
const needleValues = (0, _values2.default)(needle); | ||
result = !(0, _difference2.default)((0, _at2.default)(props, needleKeys), needleValues).length; | ||
} else { | ||
result = (0, _get3.default)(props, needle); | ||
} | ||
return result ? pass : fail; | ||
var ifProp = exports.ifProp = function ifProp(needle, pass, fail) { | ||
return function () { | ||
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var result = void 0; | ||
if (Array.isArray(needle)) { | ||
result = !(0, _at2.default)(props, needle).filter(function (value) { | ||
return !value; | ||
}).length; | ||
} else if ((typeof needle === 'undefined' ? 'undefined' : _typeof(needle)) === 'object') { | ||
var needleKeys = Object.keys(needle); | ||
var needleValues = (0, _values2.default)(needle); | ||
result = !(0, _difference2.default)((0, _at2.default)(props, needleKeys), needleValues).length; | ||
} else { | ||
result = (0, _get3.default)(props, needle); | ||
} | ||
return result ? pass : fail; | ||
}; | ||
}; |
{ | ||
"name": "styled-tools", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Utilities for styled-components", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
8351
60