Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

31
node_modules/es-toolkit/dist/object/mapValues.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
//#region src/object/mapValues.ts
/**
* Creates a new object with the same keys as the given object, but with values generated
* by running each own enumerable property of the object through the iteratee function.
*
* @template T - The type of the object.
* @template K - The type of the keys in the object.
* @template V - The type of the new values generated by the iteratee function.
*
* @param {T} object - The object to iterate over.
* @param {(value: T[K], key: K, object: T) => V} getNewValue - The function invoked per own enumerable property.
* @returns {Record<K, V>} - Returns the new mapped object.
*
* @example
* // Example usage:
* const obj = { a: 1, b: 2 };
* const result = mapValues(obj, (value) => value * 2);
* console.log(result); // { a: 2, b: 4 }
*/
function mapValues(object, getNewValue) {
const result = {};
const keys = Object.keys(object);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const value = object[key];
result[key] = getNewValue(value, key, object);
}
return result;
}
//#endregion
exports.mapValues = mapValues;