array-to-object-helper
Install with yarn add array-to-object-helper
or npm i array-to-object-helper
.
Ever had a situation when conversion from array to object looked way too verbose?
Promise
With this utility you can turn in into less verbose version:
const AtoO = ; Promise
Or even less verbose:
const to = ; Promise
This basically looks like a syntax sugar. Maybe one day js will have something similar built in.
This is also valid:
Promise;Promise;
api
- AtoO(keysArray)(valuesArray): Object
- AtoO(valuesArray, keysArray): Object
- AtoO throws nice error if keysArray.length !== valuesArray.length or when length is 0
- AtoO.to`objectShapeFormat`(valuesArray): Object
- AtoO.to validates objectShapeFormat and throws nice error if format is not valid