Converts an array to an object where the keys are the array entries and the values are customizable in a function.
npm install --save array-to-object-keys@^1.3.7
yarn add array-to-object-keys@^1.3.7
(if configured properly)
npm install --save @jaid/array-to-object-keys@^1.3.7
import arrayToObjectKeys from "array-to-object-keys"
const array = ["a", "b"]
const result = arrayToObjectKeys(array, (key, index) => {
return `#${index} - ${key}`
})
Variable result
will be:
{
a: "#0 - a",
b: "#1 - b",
}
Setting up:
git clone git@github.com:jaid/array-to-object-keys.git
cd array-to-object-keys
npm install
Testing:
npm run test:dev
Testing in production environment:
npm run test
MIT License
Copyright © 2020, Jaid jaid.jsx@gmail.com (github.com/jaid)