# @brunoluiz/extended-obj

> Objects and Enums with extended methods

Latest version **2.0.0** (published 2019-03-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @brunoluiz/extended-obj
pnpm add @brunoluiz/extended-obj
yarn add @brunoluiz/extended-obj
bun add @brunoluiz/extended-obj
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-03-25 |
| First published | 2019-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Bruno Luiz da Silva |
| Maintainers | brunoluiz |
| Keywords | structure, object, enum |

## Links

- npm: https://www.npmjs.com/package/@brunoluiz/extended-obj
- Repository: https://github.com/brunoluiz/extended-obj
- Issues: https://github.com/brunoluiz/extended-obj/issues
- npm.io page: https://npm.io/package/@brunoluiz/extended-obj

## Recent versions

- 2.0.0 (latest) — 2019-03-25
- 1.0.4 — 2019-03-24
- 1.0.3 — 2019-03-24
- 1.0.0 — 2019-03-24

## README

# @brunoluiz/extended-obj

Extended objects for JavaScript

## KeyValue

Create a key-value map with extra methods, such as

- `getByValue(v: string)`: returns value's key
- `keys(): string`: returns object keys
- `values(): string | number`: returns object values
- `toJSON(): string number`: returns object as a JSON (same as JSON.stringify())

```js
const { KeyValue } = require('@brunoluiz/extended-obj')
const o = KeyValue({ FOO: 'BAR' })

console.log(o.FOO) // BAR (normal object behaviour)
console.log(o.getByValue('BAR')) // FOO (returns value key)
console.log(o.values()) // ['BAR']
console.log(o.keys()) // ['FOO']
```

## Enum

Create an enum with the same extras added on `KeyValue`

```js
const { Enum } = require('@brunoluiz/extended-obj')
const e = Enum(['FOO', 'BAR'])

console.log(e.FOO) // 1
console.log(e.getByValue(1)) // 'FOO'
```

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