Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

thorizer

🏠
Working from home
View GitHub Profile
View async.eashSeries.js
var async = require('async');
var arr = [1,2,3,4];
async.eachSeries(arr,function(item, cb){
setTimeout(function() {
console.log('#1: ', item);
return cb();
}, Math.random()*2000);
}, function(err){
@thorizer
thorizer / node-folder-structure-options.md
Created May 4, 2020 — forked from lancejpollard/node-folder-structure-options.md
What is your folder-structure preference for a large-scale Node.js project?
View node-folder-structure-options.md

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@thorizer
thorizer / Expected behavior.js
Last active Apr 28, 2020
Group objects by multiple properties including nested properties and sump up their values
View Expected behavior.js
//Input :************************************************************************************************************************************
[
{
"commissioningDate": "2019-09-27",
"_product": {
"_id": "aaa",
"name": "Installation"
},
"zones": [
@thorizer
thorizer / README.md
Created Apr 27, 2020 — forked from joyrexus/README.md
Nested grouping of arrays
View README.md

nest.js

A multi-level groupBy for arrays inspired by D3's nest operator.

Nesting allows elements in an array to be grouped into a hierarchical tree structure; think of it like the GROUP BY operator in SQL, except you can have multiple levels of grouping, and the resulting output is a tree rather than a flat table. The levels in the tree are specified by key functions.

See this fiddle for live demo.

@thorizer
thorizer / groupBy
Created Apr 27, 2020 — forked from awsp/groupBy
Javascript - multiple groupBy function
View groupBy
/**
* Javascript -
* Array multiple groupBy function
* Forked from http://codereview.stackexchange.com/questions/37028/grouping-elements-in-array-by-multiple-properties
*
* Usage:
* var list = [
* { foo: "bar", id: 1 },
* { foo: "barbar", id: 2 },
* { foo: "bar", id: 1 },
You can’t perform that action at this time.