UNPKG

fishbird

Version:

Fishbird is a simple, lightweight, and fast Promise utility library

25 lines 873 B
'use strict'; var chunkRCO7SQLF_js = require('./chunk-RCO7SQLF.js'); async function props(obj, fn, options) { const isMap = obj instanceof Map; if (!Array.isArray(obj) && !isMap && typeof obj !== "object") { throw new TypeError(`input must be object, array or map, but got ${typeof obj}`); } const keys = isMap ? Array.from(obj.keys()) : Object.keys(obj); const rawValues = isMap ? Array.from(obj.values()) : Object.values(obj); const values = await chunkRCO7SQLF_js.map(rawValues, fn, options); const results = isMap ? new Map() : {}; keys.forEach((key, index) => { if (results instanceof Map) { results.set(key, values[index]); } else { results[key] = values[index]; } }); return results; } var props_default = props; exports.props = props; exports.props_default = props_default; //# sourceMappingURL=chunk-I436AB5I.js.map