UNPKG

fishbird

Version:

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

23 lines 801 B
import { map } from './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 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; export { props, props_default }; //# sourceMappingURL=chunk-I436AB5I.js.map