Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

data-juggler

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-juggler - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

3

build/main/lib/juggler.d.ts
import { FormatterObject, GenericDatum } from './utils/dataInference';
import { CategoricalDatum, ContinuousDatum, DatetimeDatum, InferObject } from '../types/types';
declare type JuggledData<D> = Array<{
export declare type JuggledData<D> = Array<{
[V in keyof D]: ContinuousDatum | CategoricalDatum | DatetimeDatum;

@@ -10,2 +10,1 @@ }>;

export declare function dataJuggler<T>(rawDataSet: Array<GenericDatum<T>>, inferTypes: InferObject<T>, parserObject?: FormatterObject<T>): JuggledData<T>;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const parse_1 = require("./parse");
const parseObjects_1 = require("./utils/parseObjects");
const stats_1 = require("./utils/stats");

@@ -10,2 +11,5 @@ // TODO: Better typing for this.

function dataJuggler(rawDataSet, inferTypes, parserObject) {
if (!parseObjects_1.doKeysMatch(rawDataSet, inferTypes)) {
throw new Error('It seems like the data keys and the types object you passed do not match!');
}
const filledDataSet = stats_1.populateNullData(rawDataSet);

@@ -18,2 +22,2 @@ const moments = stats_1.computeMoments(filledDataSet, inferTypes);

exports.dataJuggler = dataJuggler;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianVnZ2xlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9saWIvanVnZ2xlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUE0QztBQUk1Qyx5Q0FHdUI7QUFPdkIsZ0NBQWdDO0FBQ2hDOztHQUVHO0FBQ0gsU0FBZ0IsV0FBVyxDQUN6QixVQUFrQyxFQUNsQyxVQUEwQixFQUMxQixZQUF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QWlCLEdBQUcseUJBQWlCLENBQ3pDLFVBQVUsRUFDVixPQUFPLEVBQ1AsWUFBWSxDQUNiLENBQUE7SUFFRCxNQUFNLFlBQVksR0FBRyxhQUFhLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxFQUFFLENBQUMsaUJBQWlCLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQTtJQUV6RSxPQUFPLFlBQVksQ0FBQTtBQUNyQixDQUFDO0FBdkJELGtDQXVCQyJ9

@@ -1,2 +0,3 @@

import { ValueOf } from "../../types/types";
import { InferObject, ValueOf } from "../../types/types";
import { GenericDatum } from "./dataInference";
export declare function fromPairs<K extends string, V>(pairs: Array<[K, V]>): {

@@ -6,1 +7,2 @@ [P in K]: V;

export declare function toPairs<O>(obj: O): Array<[keyof O, ValueOf<O>]>;
export declare function doKeysMatch<T>(dataSet: Array<GenericDatum<T>>, inferObject: InferObject<T>): boolean;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const stats_1 = require("./stats");
// tslint:disable:no-expression-statement

@@ -16,2 +17,25 @@ // tslint:disable:no-object-mutation

exports.toPairs = toPairs;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFyc2VPYmplY3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2xpYi91dGlscy9wYXJzZU9iamVjdHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFFQSx5Q0FBeUM7QUFDekMsb0NBQW9DO0FBQ3BDLGtEQUFrRDtBQUVsRCxTQUFnQixTQUFTLENBQXNCLEtBQW9CO0lBQ2pFLE1BQU0sTUFBTSxHQUFHLEVBQW1CLENBQUE7SUFDbEMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsR0FBRyxFQUFFLEtBQUssQ0FBQyxFQUFFLEVBQUUsR0FBRyxNQUFNLENBQUMsR0FBRyxDQUFDLEdBQUcsS0FBSyxDQUFBLENBQUMsQ0FBQyxDQUFDLENBQUE7SUFFeEQsT0FBTyxNQUFNLENBQUE7QUFDZixDQUFDO0FBTEQsOEJBS0M7QUFFRCxTQUFnQixPQUFPLENBQUksR0FBTTtJQUMvQixPQUFPLE1BQU0sQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFpQyxDQUFBO0FBQzVELENBQUM7QUFGRCwwQkFFQyJ9
// TODO: Optimize this ugly function
function equalSets(setOne, setTwo) {
if (setOne.size !== setTwo.size) {
return false;
}
for (const one of setOne) {
if (!setTwo.has(one)) {
return false;
}
}
for (const two of setTwo) {
if (!setOne.has(two)) {
return false;
}
}
return true;
}
function doKeysMatch(dataSet, inferObject) {
const incomingKeys = stats_1.getAllKeys(dataSet);
const expectedKeys = new Set([...Object.keys(inferObject)]);
return equalSets(incomingKeys, expectedKeys);
}
exports.doKeysMatch = doKeysMatch;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFyc2VPYmplY3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2xpYi91dGlscy9wYXJzZU9iamVjdHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFFQSxtQ0FBcUM7QUFFckMseUNBQXlDO0FBQ3pDLG9DQUFvQztBQUNwQyxrREFBa0Q7QUFFbEQsU0FBZ0IsU0FBUyxDQUFzQixLQUFvQjtJQUNqRSxNQUFNLE1BQU0sR0FBRyxFQUFtQixDQUFBO0lBQ2xDLEtBQUssQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLEdBQUcsRUFBRSxLQUFLLENBQUMsRUFBRSxFQUFFLEdBQUcsTUFBTSxDQUFDLEdBQUcsQ0FBQyxHQUFHLEtBQUssQ0FBQSxDQUFDLENBQUMsQ0FBQyxDQUFBO0lBRXhELE9BQU8sTUFBTSxDQUFBO0FBQ2YsQ0FBQztBQUxELDhCQUtDO0FBRUQsU0FBZ0IsT0FBTyxDQUFJLEdBQU07SUFDL0IsT0FBTyxNQUFNLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBaUMsQ0FBQTtBQUM1RCxDQUFDO0FBRkQsMEJBRUM7QUFFRCxvQ0FBb0M7QUFDcEMsU0FBUyxTQUFTLENBQUksTUFBYyxFQUFFLE1BQWM7SUFDbEQsSUFBSSxNQUFNLENBQUMsSUFBSSxLQUFLLE1BQU0sQ0FBQyxJQUFJLEVBQUU7UUFBRSxPQUFPLEtBQUssQ0FBQTtLQUFFO0lBRWpELEtBQUssTUFBTSxHQUFHLElBQUksTUFBTSxFQUFFO1FBQ3hCLElBQUksQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxFQUFFO1lBQUUsT0FBTyxLQUFLLENBQUE7U0FBRTtLQUN2QztJQUVELEtBQUssTUFBTSxHQUFHLElBQUksTUFBTSxFQUFFO1FBQ3hCLElBQUksQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxFQUFFO1lBQUUsT0FBTyxLQUFLLENBQUE7U0FBRTtLQUN2QztJQUVELE9BQU8sSUFBSSxDQUFBO0FBQ2IsQ0FBQztBQUVELFNBQWdCLFdBQVcsQ0FBSSxPQUErQixFQUFFLFdBQTJCO0lBQ3pGLE1BQU0sWUFBWSxHQUFHLGtCQUFVLENBQUMsT0FBTyxDQUFDLENBQUE7SUFDeEMsTUFBTSxZQUFZLEdBQUcsSUFBSSxHQUFHLENBQUMsQ0FBQyxHQUFHLE1BQU0sQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLENBQUMsQ0FBQyxDQUFBO0lBQzNELE9BQU8sU0FBUyxDQUFDLFlBQVksRUFBRSxZQUFZLENBQUMsQ0FBQTtBQUM5QyxDQUFDO0FBSkQsa0NBSUMifQ==
import { InferObject, MomentsObject } from '../../types/types';
import { GenericDatum } from './dataInference';
export declare function generateParamsArrayFromInferObject<T>(inferObject: InferObject<T>): MomentsObject<T>;
export declare function generateDefaultMoments<T>(inferObject: InferObject<T>): MomentsObject<T>;
export declare function getAllKeys<T>(rawDataSet: Array<GenericDatum<T>>): Set<(keyof T)>;

@@ -5,0 +5,0 @@ export declare function populateNullData<T>(rawDataSet: Array<GenericDatum<T>>): Array<GenericDatum<T>>;

@@ -6,3 +6,2 @@ "use strict";

const parseObjects_1 = require("./parseObjects");
// tslint:disable:no-console
const mapParams = {

@@ -17,3 +16,3 @@ categorical: { frequencies: {} },

const setDifference = (a, b) => [...a].filter(x => !b.has(x));
function generateParamsArrayFromInferObject(inferObject) {
function generateDefaultMoments(inferObject) {
const variables = getKeys(inferObject);

@@ -23,3 +22,3 @@ const moments = variables.reduce((acc, v) => (Object.assign({}, acc, { [v]: mapParams[inferObject[v]] })), {});

}
exports.generateParamsArrayFromInferObject = generateParamsArrayFromInferObject;
exports.generateDefaultMoments = generateDefaultMoments;
function getAllKeys(rawDataSet) {

@@ -77,3 +76,3 @@ return rawDataSet.reduce((acc, datum) => new Set([...acc, ...getKeys(datum)]), new Set());

function computeMoments(rawDataSet, inferObject) {
const inferedObject = generateParamsArrayFromInferObject(inferObject);
const inferedObject = generateDefaultMoments(inferObject);
const momentsObject = rawDataSet.reduce(exports.generateNewMoments, inferedObject);

@@ -83,2 +82,2 @@ return momentsObject;

exports.computeMoments = computeMoments;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhdHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvbGliL3V0aWxzL3N0YXRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EsbURBTXdCO0FBRXhCLG1DQUErQjtBQUMvQixpREFBbUQ7QUFDbkQsNEJBQTRCO0FBRTVCLE1BQU0sU0FBUyxHQUFpQjtJQUM5QixXQUFXLEVBQUUsRUFBRSxXQUFXLEVBQUUsRUFBR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LEdBQXFCLFVBQVUsQ0FBQyxNQUFNLENBQUMsMEJBQWtCLEVBQUUsYUFBYSxDQUFDLENBQUE7SUFFNUYsT0FBTyxhQUFhLENBQUE7QUFDdEIsQ0FBQztBQVZELHdDQVVDIn0=
import { FormatterObject, GenericDatum } from './utils/dataInference';
import { CategoricalDatum, ContinuousDatum, DatetimeDatum, InferObject } from '../types/types';
declare type JuggledData<D> = Array<{
export declare type JuggledData<D> = Array<{
[V in keyof D]: ContinuousDatum | CategoricalDatum | DatetimeDatum;

@@ -10,2 +10,1 @@ }>;

export declare function dataJuggler<T>(rawDataSet: Array<GenericDatum<T>>, inferTypes: InferObject<T>, parserObject?: FormatterObject<T>): JuggledData<T>;
export {};
import { parseDatumFactory } from './parse';
import { computeMoments, populateNullData } from './utils/stats';
import { doKeysMatch } from './utils/parseObjects';
import { computeMoments, populateNullData, } from './utils/stats';
// TODO: Better typing for this.

@@ -8,2 +9,5 @@ /**

export function dataJuggler(rawDataSet, inferTypes, parserObject) {
if (!doKeysMatch(rawDataSet, inferTypes)) {
throw new Error('It seems like the data keys and the types object you passed do not match!');
}
const filledDataSet = populateNullData(rawDataSet);

@@ -15,2 +19,2 @@ const moments = computeMoments(filledDataSet, inferTypes);

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianVnZ2xlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9saWIvanVnZ2xlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxTQUFTLENBQUM7QUFJNUMsT0FBTyxFQUNMLGNBQWMsRUFDZCxnQkFBZ0IsRUFDakIsTUFBTSxlQUFlLENBQUM7QUFPdkIsZ0NBQWdDO0FBQ2hDOztHQUVHO0FBQ0gsTUFBTSxVQUFVLFdBQVcsQ0FDekIsVUFBa0MsRUFDbEMsVUFBMEIsR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HLGdCQUFnQixDQUFDLFVBQVUsQ0FBQyxDQUFBO0lBQ2xELE1BQU0sT0FBTyxHQUFHLGNBQWMsQ0FBQyxhQUFhLEVBQUUsVUFBVSxDQUFDLENBQUE7SUFFekQsTUFBTSxpQkFBaUIsR0FBRyxpQkFBaUIsQ0FDekMsVUFBVSxFQUNWLE9BQU8sRUFDUCxZQUFZLENBQ2IsQ0FBQTtJQUVELE1BQU0sWUFBWSxHQUFHLGFBQWEsQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxpQkFBaUIsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFBO0lBRXpFLE9BQU8sWUFBWSxDQUFBO0FBQ3JCLENBQUMifQ==

@@ -1,2 +0,3 @@

import { ValueOf } from "../../types/types";
import { InferObject, ValueOf } from "../../types/types";
import { GenericDatum } from "./dataInference";
export declare function fromPairs<K extends string, V>(pairs: Array<[K, V]>): {

@@ -6,1 +7,2 @@ [P in K]: V;

export declare function toPairs<O>(obj: O): Array<[keyof O, ValueOf<O>]>;
export declare function doKeysMatch<T>(dataSet: Array<GenericDatum<T>>, inferObject: InferObject<T>): boolean;

@@ -0,1 +1,2 @@

import { getAllKeys } from "./stats";
// tslint:disable:no-expression-statement

@@ -12,2 +13,24 @@ // tslint:disable:no-object-mutation

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFyc2VPYmplY3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2xpYi91dGlscy9wYXJzZU9iamVjdHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEseUNBQXlDO0FBQ3pDLG9DQUFvQztBQUNwQyxrREFBa0Q7QUFFbEQsTUFBTSxVQUFVLFNBQVMsQ0FBc0IsS0FBb0I7SUFDakUsTUFBTSxNQUFNLEdBQUcsRUFBbUIsQ0FBQTtJQUNsQyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxHQUFHLEVBQUUsS0FBSyxDQUFDLEVBQUUsRUFBRSxHQUFHLE1BQU0sQ0FBQyxHQUFHLENBQUMsR0FBRyxLQUFLLENBQUEsQ0FBQyxDQUFDLENBQUMsQ0FBQTtJQUV4RCxPQUFPLE1BQU0sQ0FBQTtBQUNmLENBQUM7QUFFRCxNQUFNLFVBQVUsT0FBTyxDQUFJLEdBQU07SUFDL0IsT0FBTyxNQUFNLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBaUMsQ0FBQTtBQUM1RCxDQUFDIn0=
// TODO: Optimize this ugly function
function equalSets(setOne, setTwo) {
if (setOne.size !== setTwo.size) {
return false;
}
for (const one of setOne) {
if (!setTwo.has(one)) {
return false;
}
}
for (const two of setTwo) {
if (!setOne.has(two)) {
return false;
}
}
return true;
}
export function doKeysMatch(dataSet, inferObject) {
const incomingKeys = getAllKeys(dataSet);
const expectedKeys = new Set([...Object.keys(inferObject)]);
return equalSets(incomingKeys, expectedKeys);
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFyc2VPYmplY3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2xpYi91dGlscy9wYXJzZU9iamVjdHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLFNBQVMsQ0FBQztBQUVyQyx5Q0FBeUM7QUFDekMsb0NBQW9DO0FBQ3BDLGtEQUFrRDtBQUVsRCxNQUFNLFVBQVUsU0FBUyxDQUFzQixLQUFvQjtJQUNqRSxNQUFNLE1BQU0sR0FBRyxFQUFtQixDQUFBO0lBQ2xDLEtBQUssQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLEdBQUcsRUFBRSxLQUFLLENBQUMsRUFBRSxFQUFFLEdBQUcsTUFBTSxDQUFDLEdBQU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import { InferObject, MomentsObject } from '../../types/types';
import { GenericDatum } from './dataInference';
export declare function generateParamsArrayFromInferObject<T>(inferObject: InferObject<T>): MomentsObject<T>;
export declare function generateDefaultMoments<T>(inferObject: InferObject<T>): MomentsObject<T>;
export declare function getAllKeys<T>(rawDataSet: Array<GenericDatum<T>>): Set<(keyof T)>;

@@ -5,0 +5,0 @@ export declare function populateNullData<T>(rawDataSet: Array<GenericDatum<T>>): Array<GenericDatum<T>>;

import { isCategorical, isContinuous, isDatetime } from './dataInference';
import { isNull } from 'lodash';
import { fromPairs, toPairs } from './parseObjects';
// tslint:disable:no-console
const mapParams = {

@@ -14,3 +13,3 @@ categorical: { frequencies: {} },

const setDifference = (a, b) => [...a].filter(x => !b.has(x));
export function generateParamsArrayFromInferObject(inferObject) {
export function generateDefaultMoments(inferObject) {
const variables = getKeys(inferObject);

@@ -73,6 +72,6 @@ const moments = variables.reduce((acc, v) => ({ ...acc, [v]: mapParams[inferObject[v]] }), {});

export function computeMoments(rawDataSet, inferObject) {
const inferedObject = generateParamsArrayFromInferObject(inferObject);
const inferedObject = generateDefaultMoments(inferObject);
const momentsObject = rawDataSet.reduce(generateNewMoments, inferedObject);
return momentsObject;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhdHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvbGliL3V0aWxzL3N0YXRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFHTCxhQUFhLEVBQ2IsWUFBWSxFQUNaLFVBQVUsRUFDWCxNQUFNLGlCQUFpQixDQUFBO0FBRXhCLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxRQUFRLENBQUE7QUFDL0IsT0FBTyxFQUFFLFNBQVMsRUFBRSxPQUFPLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQTtBQUNuRCw0QkFBNEI7QUFFNUIs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sR0FBRyxFQUFFLE1BQU07YUFDWixDQUFBO1lBQ0QsT0FBTyxDQUFDLFFBQVEsRUFBRSxrQkFBa0IsQ0FBbUMsQ0FBQTtTQUN4RTthQUFNO1lBQ0wsT0FBTyxDQUFDLFFBQVEsRUFBRSxlQUFlLENBQXlDLENBQUE7U0FDM0U7SUFDSCxDQUFDLENBQUMsQ0FBQyxDQUFBO0FBRUwsQ0FBQyxDQUFBO0FBRUQsTUFBTSxVQUFVLGNBQWMsQ0FDNUIsVUFBa0MsRUFDbEMsV0FBMkI7SUFJM0IsTUFBTSxhQUFhLEdBQXFCLHNCQUFzQixDQUFDLFdBQVcsQ0FBQyxDQUFBO0lBQzNFLE1BQU0sYUFBYSxHQUFxQixVQUFVLENBQUMsTUFBTSxDQUFDLGtCQUFrQixFQUFFLGFBQWEsQ0FBQyxDQUFBO0lBRTVGLE9BQU8sYUFBYSxDQUFBO0FBQ3RCLENBQUMifQ==
{
"name": "data-juggler",
"version": "0.1.2",
"version": "0.1.3",
"main": "build/main/index.js",

@@ -61,2 +61,3 @@ "typings": "build/main/index.d.ts",

"@types/d3-scale": "^2.1.1",
"@types/node-fetch": "^2.3.2",
"ava": "1.0.0-beta.7",

@@ -67,2 +68,3 @@ "codecov": "^3.1.0",

"gh-pages": "^2.0.1",
"node-fetch": "^2.3.0",
"npm-run-all": "^4.1.5",

@@ -78,3 +80,3 @@ "nyc": "^13.1.0",

"typedoc": "^0.13.0",
"typescript": "^3.1.6"
"typescript": "^3.4.4"
},

@@ -81,0 +83,0 @@ "ava": {

@@ -7,3 +7,3 @@ # data-juggler

In the context, the idea is to generalize and abstract the overused and reused DataStore, that we magically create in all of our projects, with a fetching function and so on.
In the context, the idea is to generalize and abstract the data propagation within an application, that we magically create in all of our projects.
This library abstracts that, normalizes, counts, calculates and does many inefficient things that feed into our laziness.

@@ -16,3 +16,3 @@

```bash
yarn add mst-datastore
yarn add data-juggler
```

@@ -39,10 +39,10 @@

const dataset = dataJuggler('dataStore', data, types);
const dataset = dataJuggler(data, types);
```
Launch the `dataStoreFactory` function with a name and the sample data and instance types, and enjoy a beutiful mobx-state-tree store with everything that you need in it (this is, at least for now, a lie).
Launch the `dataJuggler` function with the sample data and instance types, and enjoy a beutiful dataset full of getters and stuff with everything that you need in it (this is, at least for now, a lie).
### Properties
The datastore will have a defult property `data`, i.e. an array of the decorated datum instances.
You'll get your data back (don't worry) with added properties!

@@ -73,9 +73,9 @@ ```javascript

All of the feautures and representation of a datapoint are computed and lazy and whatnot.
On top of that you also get some getters for each variable that return the whole column, this could be cutted eventually in a censorship attempt by my boss.
Edit: the censorship did happen, this is not there anymore.
### Custom formatter
You can also pass a custom formatter for each column type (in the next PR you will be able to pass multiple per column so stay tuned) as follow:
You can also pass a custom formatter for each column type as follow:

@@ -101,3 +101,3 @@ ```javascript

const dataStore = dataStoreFactory('dataStore', data, types, formatter);
const dataStore = dataStoreFactory(data, types, formatter);

@@ -104,0 +104,0 @@ instance === {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc