@aesthetic/utils
Advanced tools
| export default function objectCreate<K extends string | number, V = unknown>(keys: K[], callback: (key: K) => V): Record<K, V>; | ||
| //# sourceMappingURL=objectCreate.d.ts.map |
| {"version":3,"file":"objectCreate.d.ts","sourceRoot":"","sources":["../src/objectCreate.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO,EACzE,IAAI,EAAE,CAAC,EAAE,EACT,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GACtB,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAQd"} |
+9
-1
@@ -109,2 +109,10 @@ import hash from 'string-hash'; | ||
| function objectCreate(keys, callback) { | ||
| var object = {}; | ||
| arrayLoop(keys, function (key) { | ||
| object[key] = callback(key); | ||
| }); | ||
| return object; | ||
| } | ||
| function objectReduce(object, callback, initialValue) { | ||
@@ -128,2 +136,2 @@ if (initialValue === void 0) { | ||
| export { arrayLoop, arrayReduce, deepClone, deepMerge, generateHash, hyphenate, isObject, isSSR, objectLoop, objectReduce, toArray }; | ||
| export { arrayLoop, arrayReduce, deepClone, deepMerge, generateHash, hyphenate, isObject, isSSR, objectCreate, objectLoop, objectReduce, toArray }; |
+3
-1
@@ -13,6 +13,8 @@ /** | ||
| import isSSR from './isSSR'; | ||
| import objectCreate from './objectCreate'; | ||
| import objectLoop from './objectLoop'; | ||
| import objectReduce from './objectReduce'; | ||
| import toArray from './toArray'; | ||
| export { arrayLoop, arrayReduce, deepClone, deepMerge, generateHash, hyphenate, isObject, isSSR, objectLoop, objectReduce, toArray, }; | ||
| export * from './types'; | ||
| export { arrayLoop, arrayReduce, deepClone, deepMerge, generateHash, hyphenate, isObject, isSSR, objectCreate, objectLoop, objectReduce, toArray, }; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src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,EACR,KAAK,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,OAAO,GACR,CAAC"} |
+14
-3
@@ -5,6 +5,8 @@ 'use strict'; | ||
| function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
| var hash = require('string-hash'); | ||
| var hash = _interopDefault(require('string-hash')); | ||
| function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
| var hash__default = /*#__PURE__*/_interopDefaultLegacy(hash); | ||
| function arrayLoop(array, callback) { | ||
@@ -79,3 +81,3 @@ var length = array.length; | ||
| if (!cache[value]) { | ||
| cache[value] = hash(value).toString(36); | ||
| cache[value] = hash__default['default'](value).toString(36); | ||
| } | ||
@@ -117,2 +119,10 @@ | ||
| function objectCreate(keys, callback) { | ||
| var object = {}; | ||
| arrayLoop(keys, function (key) { | ||
| object[key] = callback(key); | ||
| }); | ||
| return object; | ||
| } | ||
| function objectReduce(object, callback, initialValue) { | ||
@@ -144,4 +154,5 @@ if (initialValue === void 0) { | ||
| exports.isSSR = isSSR; | ||
| exports.objectCreate = objectCreate; | ||
| exports.objectLoop = objectLoop; | ||
| exports.objectReduce = objectReduce; | ||
| exports.toArray = toArray; |
+1
-0
| export declare type StringKey<T> = T extends string ? T : string; | ||
| export declare type LiteralUnion<T extends string> = T | (string & {}); | ||
| //# sourceMappingURL=types.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC"} | ||
| {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC;AAEzD,oBAAY,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC"} |
+2
-2
| { | ||
| "name": "@aesthetic/utils", | ||
| "version": "0.2.1", | ||
| "version": "0.3.0", | ||
| "description": "Utility functions for Aesthetic.", | ||
@@ -26,3 +26,3 @@ "keywords": [ | ||
| }, | ||
| "gitHead": "2a33160c4f7aa3eb1fcf6e78f8b2c4b8a8144e01" | ||
| "gitHead": "4ad762397a9e6b7d3cc2b83d8fc7b3d1172a197b" | ||
| } |
14873
8.79%33
6.45%264
8.2%