Jaid/array-to-object-keys

Repository files navigation

LicenseSponsor array-to-object-keys
Build statusCommits since v1.3.7Last commitIssues
Latest version on npmDependentsDownloads

Converts an array to an object where the keys are the array entries and the values are customizable in a function.

array-to-object-keys on npm

npm install --save array-to-object-keys@^1.3.7

array-to-object-keys on Yarn

yarn add array-to-object-keys@^1.3.7

@jaid/array-to-object-keys on GitHub Packages
(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 [email protected]: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 [email protected] (.com/jaid)

About

Converts an array to an object where the keys are the array entries and the values are customizable in a function.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

 
 
 

Contributors 6