Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/wbhob/key-value
- Owner: wbhob
- License: mit
- Created: 2017-12-28T15:24:32.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-28T16:13:07.000Z (about 7 years ago)
- Last Synced: 2024-12-01T13:48:57.981Z (2 months ago)
- Language: TypeScript
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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);
```