internet5 / Smart Array To Tree
Licence: mit
Convert large amounts of data array to tree fastly
Stars: ✭ 91
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Smart Array To Tree
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 (+37.36%)
Mutual labels: tree, array, list
Mlib
Library of generic and type safe containers in pure C language (C99 or C11) for a wide collection of container (comparable to the C++ STL).
Stars: ✭ 321 (+252.75%)
Mutual labels: tree, array, list
Algorithms
✨ a bunch of algorithms in a bunch of languages ✨
Stars: ✭ 55 (-39.56%)
Mutual labels: tree, array
Datastructure
常用数据结构及其算法的Java实现,包括但不仅限于链表、栈,队列,树,堆,图等经典数据结构及其他经典基础算法(如排序等)...
Stars: ✭ 419 (+360.44%)
Mutual labels: tree, list
Data-Structure-Algorithm-Programs
This Repo consists of Data structures and Algorithms
Stars: ✭ 464 (+409.89%)
Mutual labels: tree, array
avl array
High performance templated AVL tree using a fixed size array. Extensive test suite passing.
Stars: ✭ 33 (-63.74%)
Mutual labels: tree, array
ienumerable
Deep immutable, Lightweight Enumerable with superpowers
Stars: ✭ 63 (-30.77%)
Mutual labels: list, array
Data Structures
Common data structures and algorithms implemented in JavaScript
Stars: ✭ 139 (+52.75%)
Mutual labels: tree, array
Learningmasteringalgorithms C
Mastering Algorithms with C 《算法精解:C语言描述》源码及Xcode工程、Linux工程
Stars: ✭ 615 (+575.82%)
Mutual labels: tree, list
Android interviews
🚀Everything you need to know to find a android job. 算法 / 面试题 / Android 知识点 🔥🔥🔥 总结不易,你的 star 是我最大的动力!
Stars: ✭ 510 (+460.44%)
Mutual labels: array, list
Cracking The Coding Interview
Solutions for Cracking the Coding Interview - 6th Edition
Stars: ✭ 35 (-61.54%)
Mutual labels: tree, array
Computer Science In Javascript
Computer science reimplemented in JavaScript
Stars: ✭ 2,590 (+2746.15%)
Mutual labels: tree, list
kirby3-bolt
Kirby 3 Plugin for a fast Page lookup even in big content trees
Stars: ✭ 24 (-73.63%)
Mutual labels: fast, tree
Algo Tree
Algo-Tree is a collection of Algorithms and data structures which are fundamentals to efficient code and good software design. Creating and designing excellent algorithms is required for being an exemplary programmer. It contains solutions in various languages such as C++, Python and Java.
Stars: ✭ 166 (+82.42%)
Mutual labels: tree, array
Eix
eix can access Gentoo portage ebuild information and description very quickly (using a local cache). It can also be used to access information on installed packages, local settings, and local and external overlays, and informs about changes in the tree
Stars: ✭ 126 (+38.46%)
Mutual labels: tree, fast
Algodeck
An Open-Source Collection of 200+ Algorithmic Flash Cards to Help you Preparing your Algorithm & Data Structure Interview 💯
Stars: ✭ 4,441 (+4780.22%)
Mutual labels: tree, array
Geeksforgeeks Dsa 2
This repository contains all the assignments and practice questions solved during the Data Structures and Algorithms course in C++ taught by the Geeks For Geeks team.
Stars: ✭ 53 (-41.76%)
Mutual labels: tree, array
English | 简体中文
smart-array-to-tree
Convert large amounts of data array to nested data structure fastly!
Use the test data that array length 46086, just take about 0.1 second.
Installation && Usage
In Node.js:
$ npm i smart-arraytotree --save
var smartArrayToTree = require('../index.js');
var fetch = require('node-fetch');
//get test data length 46086
fetch('https://raw.githubusercontent.com/internet5/smart-array-to-tree/master/example/data.json').then(function(response) {
return response.json();
}).then(function(data) {
//start time
console.log(new Date());
//transform
let tree = smartArrayToTree(data, { id:'regionId', pid:'parentId', firstPid:null });
//end time
console.log(new Date());
}).catch(function(e) {
console.log(e);
});
/*console*/
//2017-11-21T09:51:37.930Z
//2017-11-21T09:51:37.979Z
In a browser:
<script src="smartArrayToTree.js"></script>
<script src="http://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
<script src="smartArrayToTree.js"></script>
<script>
window.onload = function () {
$.getJSON("https://raw.githubusercontent.com/internet5/smart-array-to-tree/master/example/data.json", function (data) {
console.log(new Date());
var tree = smartArrayToTree(data, { id: 'regionId', pid: 'parentId', firstPid: null });
console.log(new Date());
console.log(tree)
});
}
</script>
API
smartArrayToTree(data, [options])
Parameters
-
Array
data
: An array of data -
Object
options
: An object containing the following fields:-
id
(String): An unique node identifier. Default: 'id' -
pid
(String): A name of a property where a link to a parent node could be found. Default: 'pid' -
children
(String): The child node name that you want. Default: 'children' -firstPid
(String): The parent id of top level node . Default: null
-
Return
- Array: Result of transformation
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].