import { identity } from "../../function/identity.mjs";
import { range } from "../../math/range.mjs";
import { isArrayLike } from "../predicate/isArrayLike.mjs";
import { iteratee } from "../util/iteratee.mjs";
//#region src/compat/array/map.ts
function map(collection, _iteratee = identity) {
	if (!collection) return [];
	const keys = isArrayLike(collection) ? range(0, collection.length) : Object.keys(collection);
	const iteratee$1 = iteratee(_iteratee);
	const result = new Array(keys.length);
	for (let i = 0; i < keys.length; i++) {
		const key = keys[i];
		const value = collection[key];
		result[i] = iteratee$1(value, key, collection);
	}
	return result;
}
//#endregion
export { map };
