@aesthetic/utils
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -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 }; |
@@ -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 |
@@ -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; |
export declare type StringKey<T> = T extends string ? T : string; | ||
export declare type LiteralUnion<T extends string> = T | (string & {}); | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"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" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
14873
33
264