https://github.com/bentatum/hash-to-collection
easily convert a hash to a collection
https://github.com/bentatum/hash-to-collection
conversion hash hash-map list object
Last synced: about 1 year ago
JSON representation
easily convert a hash to a collection
- Host: GitHub
- URL: https://github.com/bentatum/hash-to-collection
- Owner: bentatum
- License: isc
- Created: 2017-08-23T02:49:30.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-18T19:20:38.000Z (over 8 years ago)
- Last Synced: 2024-04-29T05:42:49.162Z (about 2 years ago)
- Topics: conversion, hash, hash-map, list, object
- Language: JavaScript
- Size: 27.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# hash-to-collection
[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![standard][standard-image]][standard-url]
[npm-image]: https://img.shields.io/npm/v/hash-to-collection.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/hash-to-collection
[travis-image]: https://img.shields.io/travis/bentatum/hash-to-collection.svg?style=flat-square
[travis-url]: https://travis-ci.org/bentatum/hash-to-collection
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/standard
convert a hash to a collection
## Install
```
yarn add hash-to-collection
```
## API
```js
hashToCollection(hash, [keyName])
```
### Arguments
collection (Array): the collection to convert
keyName (string): the key name your hash keys will be stored as (default: 'key')
## Usage
```js
import hashToCollection from 'hash-to-collection'
const hash = {
123: { ... },
abc: { ... }
}
const collection = hashToCollection(collection, 'uid')
/*
[{ uid: 123, ... }, { uid: 'abc', ... }]
*/
```
## Contributing
Contributions welcome! Please read the [contributing guidelines](CONTRIBUTING.md) first.
## License
[ISC](LICENSE.md)