@aesthetic/utils
Advanced tools
Comparing version 0.6.2 to 0.6.3
@@ -1,2 +0,2 @@ | ||
export default function objectCreate<K extends string | number, V = unknown>(keys: K[], callback: (key: K) => V): Record<K, V>; | ||
export default function objectCreate<K extends number | string, V = unknown>(keys: K[], callback: (key: K) => V): Record<K, V>; | ||
//# sourceMappingURL=objectCreate.d.ts.map |
@@ -1,2 +0,5 @@ | ||
import hash from 'string-hash'; | ||
// Generated with Packemon: https://packemon.dev | ||
// Platform: browser, Support: stable, Format: esm | ||
import hash from 'string-hash'; // https://jsperf.com/compare-while-loop-vs-for-loop/30 | ||
// https://jsperf.com/for-in-object-key/3 | ||
@@ -58,2 +61,6 @@ function arrayLoop(array, callback, reverse) { | ||
function isObject(value) { | ||
return value !== null && !Array.isArray(value) && typeof value === 'object'; | ||
} | ||
function objectLoop(object, callback) { | ||
@@ -70,6 +77,4 @@ var keys = Object.keys(object); | ||
} | ||
/* eslint-disable no-param-reassign, no-use-before-define, @typescript-eslint/no-use-before-define */ | ||
function isObject(value) { | ||
return value !== null && !Array.isArray(value) && typeof value === 'object'; | ||
} | ||
@@ -109,10 +114,11 @@ function merge(base, next) { | ||
var cache = {}; | ||
var cache$2 = {}; | ||
function generateHash(value) { | ||
if (!cache[value]) { | ||
cache[value] = hash(value).toString(36); | ||
if (!cache$2[value]) { | ||
// eslint-disable-next-line no-magic-numbers | ||
cache$2[value] = hash(value).toString(36); | ||
} | ||
return cache[value]; | ||
return cache$2[value]; | ||
} | ||
@@ -128,3 +134,5 @@ | ||
function isPrefixed(value) { | ||
return value.slice(0, 2) === 'ms' || value.slice(0, 3) === 'moz' || value.slice(0, 6) === 'webkit'; | ||
return (// eslint-disable-next-line no-magic-numbers | ||
value.slice(0, 2) === 'ms' || value.slice(0, 3) === 'moz' || value.slice(0, 6) === 'webkit' | ||
); | ||
} | ||
@@ -146,3 +154,3 @@ | ||
var cache$2 = null; | ||
var cache = null; | ||
@@ -154,7 +162,7 @@ function isDOM() { | ||
if (cache$2 === null) { | ||
cache$2 = typeof window !== 'undefined' && typeof document !== 'undefined'; | ||
if (cache === null) { | ||
cache = typeof window !== 'undefined' && typeof document !== 'undefined'; | ||
} | ||
return cache$2; | ||
return cache; | ||
} | ||
@@ -161,0 +169,0 @@ |
@@ -0,1 +1,3 @@ | ||
// Generated with Packemon: https://packemon.dev | ||
// Platform: browser, Support: stable, Format: lib | ||
'use strict'; | ||
@@ -15,4 +17,6 @@ | ||
var hash__default = _interopDefaultLegacy(hash); | ||
var hash__default = /*#__PURE__*/_interopDefaultLegacy(hash); // https://jsperf.com/compare-while-loop-vs-for-loop/30 | ||
// https://jsperf.com/for-in-object-key/3 | ||
function arrayLoop(array, callback, reverse) { | ||
@@ -73,2 +77,6 @@ if (reverse === void 0) { | ||
function isObject(value) { | ||
return value !== null && !Array.isArray(value) && typeof value === 'object'; | ||
} | ||
function objectLoop(object, callback) { | ||
@@ -85,6 +93,4 @@ var keys = Object.keys(object); | ||
} | ||
/* eslint-disable no-param-reassign, no-use-before-define, @typescript-eslint/no-use-before-define */ | ||
function isObject(value) { | ||
return value !== null && !Array.isArray(value) && typeof value === 'object'; | ||
} | ||
@@ -124,10 +130,11 @@ function merge(base, next) { | ||
var cache = {}; | ||
var cache$2 = {}; | ||
function generateHash(value) { | ||
if (!cache[value]) { | ||
cache[value] = hash__default['default'](value).toString(36); | ||
if (!cache$2[value]) { | ||
// eslint-disable-next-line no-magic-numbers | ||
cache$2[value] = hash__default['default'](value).toString(36); | ||
} | ||
return cache[value]; | ||
return cache$2[value]; | ||
} | ||
@@ -143,3 +150,5 @@ | ||
function isPrefixed(value) { | ||
return value.slice(0, 2) === 'ms' || value.slice(0, 3) === 'moz' || value.slice(0, 6) === 'webkit'; | ||
return (// eslint-disable-next-line no-magic-numbers | ||
value.slice(0, 2) === 'ms' || value.slice(0, 3) === 'moz' || value.slice(0, 6) === 'webkit' | ||
); | ||
} | ||
@@ -161,3 +170,3 @@ | ||
var cache$2 = null; | ||
var cache = null; | ||
@@ -169,7 +178,7 @@ function isDOM() { | ||
if (cache$2 === null) { | ||
cache$2 = typeof window !== 'undefined' && typeof document !== 'undefined'; | ||
if (cache === null) { | ||
cache = typeof window !== 'undefined' && typeof document !== 'undefined'; | ||
} | ||
return cache$2; | ||
return cache; | ||
} | ||
@@ -176,0 +185,0 @@ |
{ | ||
"name": "@aesthetic/utils", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"description": "Utility functions for Aesthetic.", | ||
@@ -20,2 +20,8 @@ "keywords": [ | ||
"types": "./dts/index.d.ts", | ||
"files": [ | ||
"dts/**/*.d.ts", | ||
"esm/**/*.{js,map}", | ||
"lib/**/*.{js,map}", | ||
"src/**/*.{ts,tsx,json}" | ||
], | ||
"sideEffects": false, | ||
@@ -35,3 +41,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "c3c3a681b593b40a5e17f2e7ec5592c6ba69a538" | ||
"gitHead": "616c1843c4d1b900b8f954f300173ea0bd770862" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
31602
628