object-deep-from-entries
Make an object or collection from entries deeply.
![Code Coverage](https://codecov.io/github/octet-stream/object-deep-from-entries/coverage.svg?branch=master)
Installation
You can install this package from Yarn:
yarn add object-deep-from-entries
Or NPM:
npm install object-deep-from-entries
API
objectDeepFromEntries(entries) -> {object | object[] | any[]}
- {Array<[string | number | Array<string | number>, any]>} – An array of
tuples with paths and values. Path might be a string,
number or an array of those to types. Value may have any type.
Usage
import objectDeepFromEntries from "object-deep-from-entries"
const flat = [
[
"name", "John Doe"
],
[
"age", 25
],
[
"gender", "Male"
]
]
objectDeepFromEntries(flat)
const deep = [
[
"name", "John Doe"
],
[
["skills", 0], "Node.js"
],
[
["skills", 1], "JavaScript"
],
[
["skills", 2], "Preact"
]
]
objectDeepFromEntries(deep)