array-of-trees

0.2.4 • Public • Published

Functions

initializeTreeArray

initializeTreeArray(items : array,
                    <keyField> : string,
                    <parentKeyField> : string,
                    <nameForChildrenIfWillBeReferenced> : string? default "children",
                    <nameForParentIfWillBeReferenced> : string? default null);

Returns an array such that:

[
  ...,
  {
    ...One of those items which does not have any parent.
    <nameForChildrenIfWillBeReferenced>: Array of items which have such keyField value is equal to parentKeyField value of this item.
    <nameForParentIfWillBeReferenced>: Reference to the parent item which this item belong to children array.
  }
  ...,
]

Örnek Çalışma

Örnek Çalışma

Dependencies (0)

    Dev Dependencies (9)

    Package Sidebar

    Install

    npm i array-of-trees

    Weekly Downloads

    1

    Version

    0.2.4

    License

    MIT

    Unpacked Size

    4.55 kB

    Total Files

    5

    Last publish

    Collaborators

    • emreyilmazin