# itobj

> Iterate Object

Latest version **0.1.0** (published 2020-09-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install itobj
pnpm add itobj
yarn add itobj
bun add itobj
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2020-09-18 |
| First published | 2020-09-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=12.13.0 |
| Dependencies | 0 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 81 |
| Maintainers | fosimus, psxcode, deepsweet |
| Keywords | iterable, iterator, object |

## Links

- npm: https://www.npmjs.com/package/itobj
- Repository: https://github.com/nextools/metarepo
- Homepage: https://github.com/nextools/metarepo#readme
- Issues: https://github.com/nextools/metarepo/issues
- npm.io page: https://npm.io/package/itobj

## Recent versions

- 0.1.0 (latest) — 2020-09-18
- 0.0.0 — 2020-09-17

## README

# itobj ![npm](https://flat.badgen.net/npm/v/itobj)

Iterate Object.

⚠️ Ignores any keys but strings in types and skips Symbols and stringifies the rest of the keys in runtime just like Object methods do.

## Install

```sh
$ yarn add itobj
```

## Usage

```ts
type TStringKey<T> = keyof T & string

const iterateObjectKeys: <T extends {}>(obj: T) => Iterable<TStringKey<T>>
const iterateObjectValues: <T extends {}>(obj: T) => Iterable<T[TStringKey<T>]>
const iterateObjectEntries: <T extends {}>(obj: T) => Iterable<[TStringKey<T>, T[TStringKey<T>]]>
```

```ts
import { iterateObjectKeys, iterateObjectValues, iterateObjectEntries } from 'itobj'

const obj = { a: 1, b: 2, c: 3 }

for (const key of iterateObjectKeys(obj)) {
  console.log(key)
}
// 'a'
// 'b'
// 'c'

for (const value of iterateObjectValues(obj)) {
  console.log(value)
}
// 1
// 2
// 3

for (const entry of iterateObjectEntries(obj)) {
  console.log(entry)
}
// ['a', 1]
// ['b', 2]
// ['c', 3]
```

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