# arr-to-obj

> convert arrays to objects (arr to obj)

Latest version **0.0.3** (published 2017-03-23) · 0 weekly downloads

## Install

```sh
npm install arr-to-obj
pnpm add arr-to-obj
yarn add arr-to-obj
bun add arr-to-obj
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2017-03-23 |
| First published | 2017-03-19 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 30 |
| Author | James |
| Maintainers | aretecode |
| Keywords | utils, array, object, array-to-object, arr-to-obj, fliphub, flipbox |

## Links

- npm: https://www.npmjs.com/package/arr-to-obj
- Repository: https://github.com/fliphub/fliphub
- Homepage: https://github.com/fliphub/fliphub#readme
- Issues: https://github.com/fliphub/fliphub/issues
- npm.io page: https://npm.io/package/arr-to-obj

## Dependencies (1)

- [izz](https://npm.io/package/izz.md) *

## Recent versions

- 0.0.3 (latest) — 2017-03-23
- 0.0.1 — 2017-03-19

## README

# array to object (arr to obj)
### convert arrays to objects

## default
#### (also can be used as valAsKeyAndVal)

```js
const arrToObj = require('arr-to-obj')
const obj = arrToObj(['eh', 'canada'])
// {eh: eh, canada: canada}
```

## valAsKey
```js
const {valAsKey} = require('arr-to-obj')
const obj = valAsKey(['eh', 'canada'], 'woot')
// {eh: 'woot', canada: 'woot'}
```

## valAsVal
```js
// @example:
// var array = ['eh', 'canada']
// valAsVal(array)
const {valAsVal} = require('arr-to-obj')
const obj = valAsVal(['eh', 'canada'])
// {'1': 'eh', '2': 'canada'}
```

## custom
```js
const arrToObj = require('arr-to-obj')
const arr = ['eh', 'canada']

// does the same as #valAsKey
// {eh: 'woot', canada: 'woot'}
const obj = arrToObj(array, {
  valFn: () => undefined,
  keyFn: ({i, val}) => typeof fn === 'function' ? fn(val, i) : (fn || i),
})
```

### resources
- https://www.npmjs.com/package/array-to-object (outdated, not customizable)

---
_Source: https://npm.io/package/arr-to-obj · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
