Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Jaid/array-to-object-keys

Open more actions menu

Repository files navigation

array-to-object-keys

License Sponsor array-to-object-keys
Build status Commits since v1.3.7 Last commit Issues
Latest version on npm Dependents Downloads

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

Installation

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

Example

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",
}

Development

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

License

MIT License
Copyright © 2020, Jaid jaid.jsx@gmail.com (github.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

Stars

Watchers

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.