aesthetic-utils
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -7,3 +7,9 @@ 'use strict'; | ||
exports.default = createStyleElement; | ||
function createStyleElement(id) { | ||
/** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
function createStyleElement(id /*: string*/) /*: HTMLElement*/ { | ||
var style = document.createElement('style'); | ||
@@ -13,2 +19,3 @@ style.type = 'text/css'; | ||
// $FlowIssue We know the document exists | ||
document.head.appendChild(style); | ||
@@ -15,0 +22,0 @@ |
@@ -44,2 +44,6 @@ 'use strict'; | ||
exports.isPrimitive = _isPrimitive2.default; | ||
exports.toArray = _toArray2.default; | ||
exports.toArray = _toArray2.default; /** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ |
@@ -7,4 +7,12 @@ 'use strict'; | ||
exports.default = injectAtRules; | ||
/** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
function injectAtRules(properties, atName, rules) { | ||
/*:: import type { AtRuleMap, CSSStyle } from '../types';*/ | ||
function injectAtRules(properties /*: CSSStyle*/, atName /*: string*/, rules /*: AtRuleMap*/) { | ||
// Font faces don't have IDs in their declaration, | ||
// so we need to handle this differently. | ||
if (atName === '@font-face') { | ||
@@ -18,4 +26,6 @@ var fonts = Object.keys(rules).map(function (key) { | ||
} | ||
// All other at-rules work the same. | ||
} else { | ||
Object.keys(rules).forEach(function (key) { | ||
Object.keys(rules).forEach(function (key /*: string*/) { | ||
properties[atName + ' ' + key] = rules[key]; | ||
@@ -22,0 +32,0 @@ }); |
@@ -7,5 +7,11 @@ 'use strict'; | ||
exports.default = injectFallbacks; | ||
/** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
function injectFallbacks(properties, fallbacks) { | ||
Object.keys(fallbacks).forEach(function (propName) { | ||
/*:: import type { CSSStyle } from '../types';*/ | ||
function injectFallbacks(properties /*: CSSStyle*/, fallbacks /*: CSSStyle*/) { | ||
Object.keys(fallbacks).forEach(function (propName /*: string*/) { | ||
var prop = properties[propName]; | ||
@@ -12,0 +18,0 @@ var fallback = fallbacks[propName]; |
@@ -7,5 +7,11 @@ 'use strict'; | ||
exports.default = injectRuleByLookup; | ||
/** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
function injectRuleByLookup(properties, propName, lookup) { | ||
var flatten = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
/*:: import type { AtRuleMap, AtRuleCache, CSSStyle } from '../types';*/ | ||
function injectRuleByLookup(properties /*: CSSStyle*/, propName /*: string*/, lookup /*: AtRuleMap | AtRuleCache*/) { | ||
var flatten /*: boolean*/ = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
@@ -18,3 +24,3 @@ var value = properties[propName]; | ||
value = value.split(',').map(function (name) { | ||
value = value.split(',').map(function (name /*: string*/) { | ||
name = name.trim(); | ||
@@ -21,0 +27,0 @@ var found = lookup[name]; |
@@ -10,4 +10,10 @@ 'use strict'; | ||
exports.default = isObject; | ||
function isObject(value) { | ||
/** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
function isObject /*:: <T>*/(value /*: T*/) /*: boolean*/ { | ||
return value !== null && !Array.isArray(value) && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object'; | ||
} |
@@ -10,3 +10,9 @@ 'use strict'; | ||
exports.default = isPrimitive; | ||
function isPrimitive(value) { | ||
/** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
function isPrimitive /*:: <T>*/(value /*: T*/) /*: boolean*/ { | ||
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value); | ||
@@ -13,0 +19,0 @@ |
{ | ||
"name": "aesthetic-utils", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Utility functions for Aesthetic.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -7,4 +7,10 @@ "use strict"; | ||
exports.default = toArray; | ||
function toArray(value) { | ||
/** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
function toArray /*:: <T>*/(value /*: T | T[]*/) /*: T[]*/ { | ||
return Array.isArray(value) ? value : [value]; | ||
} |
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
6915
118
164