Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wbhob/key-value

A utility for creating a key-value map from an object.
https://github.com/wbhob/key-value

Last synced: 8 days ago
JSON representation

A utility for creating a key-value map from an object.

Awesome Lists containing this project

README

        

# key-value
A simple utility for mapping an object to an array. This is particularly useful for iterators, which can not simply be passed an object.

## Example
```ts
import keyValue from 'key-value';

const object = {
foo: 'bar'
};

const map = keyValue(object);
/*
[{
key: 'foo',
value: 'bar'
}]
*/
```

## Usage
### TypeScript/ES6
```ts
import keyValue from 'key-value';

keyValue(yourObject);
```

### ES5
```ts
var keyValue = require('key-value').default;

keyValue(yourObject);
```