All Projects → kelreel → tree-json-generator

kelreel / tree-json-generator

Licence: other
Simple JavaScript Tree Generator library

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to tree-json-generator

mongodb-tree-structure
Implementing Tree Structure in MongoDB
Stars: ✭ 14 (+7.69%)
Mutual labels:  tree, tree-structure
mock-data
Mock data in PostgreSQL/Greenplum databases
Stars: ✭ 115 (+784.62%)
Mutual labels:  mock-data, fake-data
vue-virtualised
Blazing fast scrolling and updating for any amount of list and hierarchical data.
Stars: ✭ 18 (+38.46%)
Mutual labels:  tree, tree-structure
Graphview
Flutter GraphView is used to display data in graph structures. It can display Tree layout, Directed and Layered graph. Useful for Family Tree, Hierarchy View.
Stars: ✭ 152 (+1069.23%)
Mutual labels:  tree, tree-structure
prune
A tree library for Java 8 with functional sensibilities.
Stars: ✭ 22 (+69.23%)
Mutual labels:  tree, tree-structure
Relation Classification Using Bidirectional Lstm Tree
TensorFlow Implementation of the paper "End-to-End Relation Extraction using LSTMs on Sequences and Tree Structures" and "Classifying Relations via Long Short Term Memory Networks along Shortest Dependency Paths" for classifying relations
Stars: ✭ 167 (+1184.62%)
Mutual labels:  tree, tree-structure
react-tree
Hierarchical tree component for React in Typescript
Stars: ✭ 174 (+1238.46%)
Mutual labels:  tree, tree-structure
Abp.generaltree
For Abp vNext
Stars: ✭ 106 (+715.38%)
Mutual labels:  tree, tree-structure
stefano-tree
Framework agnostic Nested Set (MPTT) implementation for PHP
Stars: ✭ 24 (+84.62%)
Mutual labels:  tree, tree-structure
treetime
TreeTime is a data organisation, management and analysis tool. A tree is a hierarchical structure that arranges information in units and sub-units. TreeTime uses linked trees (one data item can be part of different distinct trees) to store and organise any general purpose data.
Stars: ✭ 26 (+100%)
Mutual labels:  tree, tree-structure
Array To Tree
Convert a plain array of nodes (with pointers to parent nodes) to a nested data structure
Stars: ✭ 141 (+984.62%)
Mutual labels:  tree, tree-structure
fakerfactory
伪造数据的API服务
Stars: ✭ 53 (+307.69%)
Mutual labels:  mock-data, fake-data
Containers
This library provides various containers. Each container has utility functions to manipulate the data it holds. This is an abstraction as to not have to manually manage and reallocate memory.
Stars: ✭ 125 (+861.54%)
Mutual labels:  tree, tree-structure
ng-treetable
A treetable module for angular 5
Stars: ✭ 32 (+146.15%)
Mutual labels:  tree, tree-structure
Bplustree
A minimal but extreme fast B+ tree indexing structure demo for billions of key-value storage
Stars: ✭ 1,598 (+12192.31%)
Mutual labels:  tree, tree-structure
performant-array-to-tree
Converts an array of items with ids and parent ids to a nested tree in a performant O(n) way. Runs in browsers and Node.js.
Stars: ✭ 193 (+1384.62%)
Mutual labels:  tree, tree-structure
Ki
Go language (golang) full strength tree structures (ki in Japanese)
Stars: ✭ 61 (+369.23%)
Mutual labels:  tree, tree-structure
Buckets Js
A complete, fully tested and documented data structure library written in pure JavaScript.
Stars: ✭ 1,128 (+8576.92%)
Mutual labels:  tree, tree-structure
TreeRep
Learning Tree structures and Tree metrics
Stars: ✭ 18 (+38.46%)
Mutual labels:  tree, tree-structure
miz
🎯 Generate fake data, Just like a person.
Stars: ✭ 24 (+84.62%)
Mutual labels:  mock-data, fake-data


Tree JSON Generator

version

More than 150 000 nodes per second!
Simple library for generating JSON trees
No external dependency, highly customizable

DEMO

Installation

You can install it using yarn or npm

npm install tree-json-generator
# or
yarn add tree-json-generator

Usage

NodeJS:

const TreeGen = require("tree-json-generator");

WebPack:

import * as TreeGen from "tree-json-generator";

Use generate(config) for generating tree

const config = {
  node: { // Node fields, required
    id: "@id()", // Pipes
    parent: "@parent()",
    level: "@level()",
    name: "@randomName()", 
    age: "@randomInteger(14,99)",
    email: "@randomEmail()",
    registered: "@randomBoolean(0.79)",
    child: "@child()" // Child field pointer (not required, if children are not needed)
  },
  rootNodesNumber: 7, // Number of root nodes
  childNodesNumber: [2, 5], // Number of children nodes (from 2 to 5)
  hasChildRate: 0.4, // Probability of children
  maxLevel: 3 // Max nesting
}

let tree = TreeGen.generate(config);

Pipes

This allows you to generate fields values for the nodes.

Warning: custom user functions only assign the same value to all nodes

Remember: Pipes are strings

Prebuilded pipes:

"@id()"

Random node ID

"@child()"

Child field pointer

"@parent()"

Field with parent node ID. (For this field, a field with an "@id" pipe before required.

"@level()"

Node level

"@randomName()"

Random name

"@randomFruit()"

Random fruit

"@randomEmail()"

Random E-Mail

"@randomInteger(min, max)"

Random Integer from range

"@randomBoolean(value = 0.5)"

Random Boolean (value - coefficient)

Config API

node: {}

Required. Contains node fields with pipes.

rootNodesNumber:

Not required. Number (5) or array range ([1, 40]). Default is 1.

childNodesNumber:

Not required. Number (9) or array range ([1, 15]). Default is 1.

maxLevel:

Not required. Max node level. Number (3). Default is 3.

hasChildRate:

Not required. The probability that the node has children. From 0 to 1. Default is 1.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].