array-to-archy
v1.1.0
Published
Convert an array to object structure representation which can be used to archy.
Downloads
17
Readme
Table of Contents
Installation
This module is distributed via npm which is bundled with node and
should be installed as one of your project's devDependencies:
npm install --save-dev array-to-archyUsage
const arrayToArchy = require("array-to-archy")
const _array = [
1,
2,
[3, 4, ["city", "country", ["abc", "xyz"]]],
5,
["foo", "bar"],
"baz",
6
]
arrayToArchy(_array, 'X')Output
{
"label": "X",
"nodes": [
"1",
"2",
{
"label": "X",
"nodes": [
"3",
"4",
{
"label": "X",
"nodes": [
"city",
"country",
{
"label": "X",
"nodes": [
"abc",
"xyz"
]
}
]
}
]
},
"5",
{
"label": "X",
"nodes": [
"foo",
"bar"
]
},
" baz",
"6"
]
}API
arrayToArchy(data [, label])
Returns a object.
label
Type: string
Default: --
| Joydip Roy (rjoydip)💻 📖 🚇 ⚠️ | | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
Contributions of any kind welcome!
