hash-to-collection

1.0.2 • Public • Published

hash-to-collection

npm travis standard

convert a hash to a collection

Install

yarn add hash-to-collection

API

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

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 first.

License

ISC

Package Sidebar

Install

npm i hash-to-collection

Weekly Downloads

1

Version

1.0.2

License

ISC

Last publish

Collaborators

  • bentatum