This package has been deprecated

Author message:

Abandoned project

myrmica

0.1.1 • Public • Published

Myrmica

Myrmica is a library for effective dealing with "quite big" data.

It's totally alpha version it isn't guaranted even to work.

Functions

Nested loop

Myrmica.nestedLoops allows you to iterate over cartesian join of two arrays. It's equivalent of native forEach method.

var array1 = [1,2,3,4,5,6];
var array2 = array1;
var chances = {};
Myrmica.nestedLoops(array1, array2, function(element1, element2, index1, index2, array1, array2){
    if (this.chances[element1+element2])
        this.chances[element1+element2]++;
    else
        this.chances[element1+element2] = 1;
}, chances);

Joins

loopJoin

CREATE TABLE People (ID INT, Name VARCHAR(MAX), FatherID INT, MotherID INT)

var _ = require('lodash')
var people = db.query('SELECT * FROM People');
people.forEach((person)=> person.childs = []);
Myrmica.loopJoin(people, people, _.property('FatherID'), _.property('ID'), function(child, parent){
    child.father = parent;
    parent.children.push(child);
});
Myrmica.loopJoin(people, people, _.property('MotherID'), _.property('ID'), function(child, parent){
    child.mother = parent;
    parent.children.push(child);
});

/myrmica/

    Package Sidebar

    Install

    npm i myrmica

    Weekly Downloads

    1

    Version

    0.1.1

    License

    MIT

    Last publish

    Collaborators

    • ginden