# @gusbueno/js-utils

> Javascript utilities that you can use in your day-to-day.

Latest version **1.2.0** (published 2019-06-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gusbueno/js-utils
pnpm add @gusbueno/js-utils
yarn add @gusbueno/js-utils
bun add @gusbueno/js-utils
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2019-06-14 |
| First published | 2018-08-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Gustavo Bueno |
| Maintainers | gusbueno |
| Keywords | javascript, utils, utilities, toolkit, algorithm |

## Links

- npm: https://www.npmjs.com/package/@gusbueno/js-utils
- Repository: https://github.com/gusbueno/js-utils
- Homepage: https://github.com/gusbueno/js-utils#readme
- Issues: https://github.com/gusbueno/js-utils/issues
- npm.io page: https://npm.io/package/@gusbueno/js-utils

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2019-06-14
- 1.1.2 — 2019-06-12
- 1.1.1 — 2019-06-07
- 1.0.4 — 2018-08-23
- 1.0.3 — 2018-08-23
- 1.0.0 — 2018-08-23

## README

[![CircleCI](https://circleci.com/gh/gusbueno/js-utils/tree/master.svg?style=svg)](https://circleci.com/gh/gusbueno/js-utils/tree/master)
[![npm version](https://badge.fury.io/js/%40gusbueno%2Fjs-utils.svg)](https://badge.fury.io/js/%40gusbueno%2Fjs-utils)
[![dependencies](https://david-dm.org/gusbueno/js-utils.svg)](https://david-dm.org/gusbueno/js-utils)

# js-utils
Javascript utilities that you can use in your day-to-day development

#### arrayToObject
This function will help you to convert an array of objects to one object(key/value).

Example:
```js
import { arrayToObject } from '@gusbueno/js-utils'

const data = [
  {
    name: 'BTC',
    value: 6000
  }, {
    name: 'XRP',
    value: 0.34
  }
]

const objectData = arrayToObject(data, 'name')

/* RESULT
{
  BTC: {
    name: 'BTC',
    value: 6000
  },
  XRP: {
    name: 'XRP',
    value: 0.34
  }
}
 */
```

#### to
This function will help you to handle errors from **async/await** operator.

Example:
```js
import axios from 'axios'
import { to } from '@gusbueno/js-utils'

const getUsers = async () => {
  const [err, data] = await to(axios.get('http://host.com/api/users'))
  if (err) { // which means that err has value
    return 'An error ocurred on getUsers request'
  }
  // if err has no value then data has value
  return data
}
```

---
_Source: https://npm.io/package/@gusbueno/js-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
