record-map
v0.1.1
Published
Returns a Map implementation over a plain object
Downloads
4
Maintainers
Keywords
Readme
Returns a Map implementation over a plain object! This is useful if you have a project that can receive a Map or a Record, but you want to access it's properties seamless
How to Install
npm i record-map
How to use it
Just pass the Record/plain object or Map to recordMap:
const result = recordMap(myMapOrPlainObject);
result will be an instance of Map!
But why not just use new Map(Object.entries(plainObject))?
The following command also converts a plain object do Map:
const result = new Map(Object.entries(plainObject))
But the advantage of recordMap is that no overload with a loop through plainObject properties is made. Making this conversion much more efficient!
License
Licensed under MIT.