typedash
Version:
modern, type-safe collection of utility functions
24 lines (22 loc) • 694 B
JavaScript
const require_objectFromEntries = require('./objectFromEntries-CFhk9KlT.cjs');
//#region src/functions/toObject/toObject.ts
/**
* Converts an array of strings to an object with the same values as keys and values.
* @param array The array to convert to an object.
* @returns An object with the same values as keys and values.
* @example
* ```ts
* toObject(['a', 'b']) // { a: 'a', b: 'b' }
* ```
*/
function toObject(array) {
return require_objectFromEntries.objectFromEntries(array.map((value) => [value, value]));
}
//#endregion
Object.defineProperty(exports, 'toObject', {
enumerable: true,
get: function () {
return toObject;
}
});
//# sourceMappingURL=toObject-B6ADFSCh.cjs.map