typedash
Version:
modern, type-safe collection of utility functions
19 lines (17 loc) • 573 B
JavaScript
import { t as objectFromEntries } from "./objectFromEntries-9X94Rk5A.js";
//#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 objectFromEntries(array.map((value) => [value, value]));
}
//#endregion
export { toObject as t };
//# sourceMappingURL=toObject-Bqxnif-w.js.map