Comparing version
@@ -7,8 +7,8 @@ 'use strict'; | ||
exports.styleq = void 0; | ||
const cache = new WeakMap(); | ||
const compiledKey = '$$css'; | ||
var cache = new WeakMap(); | ||
var compiledKey = '$$css'; | ||
function createStyleq(options) { | ||
let disableCache; | ||
let disableMix; | ||
let transform; | ||
var disableCache; | ||
var disableMix; | ||
var transform; | ||
if (options != null) { | ||
@@ -20,13 +20,13 @@ disableCache = options.disableCache === true; | ||
return function styleq() { | ||
const definedProperties = []; | ||
let className = ''; | ||
let inlineStyle = null; | ||
let debugString = ''; | ||
let nextCache = disableCache ? null : cache; | ||
const styles = new Array(arguments.length); | ||
for (let i = 0; i < arguments.length; i++) { | ||
var definedProperties = []; | ||
var className = ''; | ||
var inlineStyle = null; | ||
var debugString = ''; | ||
var nextCache = disableCache ? null : cache; | ||
var styles = new Array(arguments.length); | ||
for (var i = 0; i < arguments.length; i++) { | ||
styles[i] = arguments[i]; | ||
} | ||
while (styles.length > 0) { | ||
const possibleStyle = styles.pop(); | ||
var possibleStyle = styles.pop(); | ||
if (possibleStyle == null || possibleStyle === false) { | ||
@@ -36,12 +36,12 @@ continue; | ||
if (Array.isArray(possibleStyle)) { | ||
for (let i = 0; i < possibleStyle.length; i++) { | ||
styles.push(possibleStyle[i]); | ||
for (var _i = 0; _i < possibleStyle.length; _i++) { | ||
styles.push(possibleStyle[_i]); | ||
} | ||
continue; | ||
} | ||
const style = transform != null ? transform(possibleStyle) : possibleStyle; | ||
var style = transform != null ? transform(possibleStyle) : possibleStyle; | ||
if (style.$$css != null) { | ||
let classNameChunk = ''; | ||
var classNameChunk = ''; | ||
if (nextCache != null && nextCache.has(style)) { | ||
const cacheEntry = nextCache.get(style); | ||
var cacheEntry = nextCache.get(style); | ||
if (cacheEntry != null) { | ||
@@ -54,7 +54,7 @@ classNameChunk = cacheEntry[0]; | ||
} else { | ||
const definedPropertiesChunk = []; | ||
for (const prop in style) { | ||
const value = style[prop]; | ||
var definedPropertiesChunk = []; | ||
for (var prop in style) { | ||
var value = style[prop]; | ||
if (prop === compiledKey) { | ||
const compiledKeyValue = style[prop]; | ||
var compiledKeyValue = style[prop]; | ||
if (compiledKeyValue !== true) { | ||
@@ -76,7 +76,7 @@ debugString = debugString ? compiledKeyValue + '; ' + debugString : compiledKeyValue; | ||
} else { | ||
console.error(`styleq: ${prop} typeof ${String(value)} is not "string" or "null".`); | ||
console.error("styleq: ".concat(prop, " typeof ").concat(String(value), " is not \"string\" or \"null\".")); | ||
} | ||
} | ||
if (nextCache != null) { | ||
const weakMap = new WeakMap(); | ||
var weakMap = new WeakMap(); | ||
nextCache.set(style, [classNameChunk, definedPropertiesChunk, debugString, weakMap]); | ||
@@ -96,8 +96,8 @@ nextCache = weakMap; | ||
} else { | ||
let subStyle = null; | ||
for (const prop in style) { | ||
const value = style[prop]; | ||
if (value !== undefined) { | ||
if (!definedProperties.includes(prop)) { | ||
if (value != null) { | ||
var subStyle = null; | ||
for (var _prop in style) { | ||
var _value = style[_prop]; | ||
if (_value !== undefined) { | ||
if (!definedProperties.includes(_prop)) { | ||
if (_value != null) { | ||
if (inlineStyle == null) { | ||
@@ -109,5 +109,5 @@ inlineStyle = {}; | ||
} | ||
subStyle[prop] = value; | ||
subStyle[_prop] = _value; | ||
} | ||
definedProperties.push(prop); | ||
definedProperties.push(_prop); | ||
nextCache = null; | ||
@@ -123,7 +123,7 @@ } | ||
} | ||
const styleProps = [className, inlineStyle, debugString]; | ||
var styleProps = [className, inlineStyle, debugString]; | ||
return styleProps; | ||
}; | ||
} | ||
const styleq = exports.styleq = createStyleq(); | ||
var styleq = exports.styleq = createStyleq(); | ||
styleq.factory = createStyleq; |
{ | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"name": "styleq", | ||
@@ -4,0 +4,0 @@ "main": "styleq.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26398
0.02%0
-100%