data-juggler
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -16,3 +16,4 @@ import { FormatterObject, GenericDatum } from './utils/dataInference'; | ||
moments: MomentsObject<T>; | ||
inferedTypes: InferObject<T>; | ||
}; | ||
export {}; |
@@ -14,13 +14,15 @@ "use strict"; | ||
const filledDataSet = stats_1.populateNullData(unparsedDataset); | ||
const inferTypes = passedInferTypes || dataInference_1.autoInferenceType(unparsedDataset); | ||
if (!parseObjects_1.doKeysMatch(unparsedDataset, inferTypes)) { | ||
const inferedTypes = passedInferTypes || dataInference_1.autoInferenceType(unparsedDataset); | ||
if (!parseObjects_1.doKeysMatch(unparsedDataset, inferedTypes)) { | ||
throw new Error(MISMATCH_KEY); | ||
} | ||
const dataSet = passedInferTypes ? filledDataSet : parse_1.parseDates(filledDataSet, inferTypes); | ||
const moments = stats_1.computeMoments(dataSet, inferTypes); | ||
const datumPreprocessor = parse_1.parseDatumFactory(inferTypes, moments, formatter); | ||
const dataSet = passedInferTypes | ||
? filledDataSet | ||
: parse_1.parseDates(filledDataSet, inferedTypes); | ||
const moments = stats_1.computeMoments(dataSet, inferedTypes); | ||
const datumPreprocessor = parse_1.parseDatumFactory(inferedTypes, moments, formatter); | ||
const data = dataSet.map(datum => datumPreprocessor(datum)); | ||
return { data, moments }; | ||
return { data, moments, inferedTypes }; | ||
} | ||
exports.dataJuggler = dataJuggler; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianVnZ2xlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9saWIvanVnZ2xlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUF1RDtBQUN2RCx5REFBd0Y7QUFHeEYsdURBQWtEO0FBQ2xELHlDQUdzQjtBQUV0QixNQUFNLFlBQVksR0FBRywyRUFBMkUsQ0FBQTtBQVloRyxnQ0FBZ0M7QUFDaEM7O0dBRUc7Q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RCxrQ0EwQkMifQ== |
@@ -16,3 +16,4 @@ import { FormatterObject, GenericDatum } from './utils/dataInference'; | ||
moments: MomentsObject<T>; | ||
inferedTypes: InferObject<T>; | ||
}; | ||
export {}; |
import { parseDates, parseDatumFactory } from './parse'; | ||
import { autoInferenceType } from './utils/dataInference'; | ||
import { doKeysMatch } from './utils/parseObjects'; | ||
import { computeMoments, populateNullData, } from './utils/stats'; | ||
import { computeMoments, populateNullData } from './utils/stats'; | ||
const MISMATCH_KEY = 'It seems like the data keys and the types object you passed do not match!'; | ||
@@ -12,12 +12,14 @@ // TODO: Better typing for this. | ||
const filledDataSet = populateNullData(unparsedDataset); | ||
const inferTypes = passedInferTypes || autoInferenceType(unparsedDataset); | ||
if (!doKeysMatch(unparsedDataset, inferTypes)) { | ||
const inferedTypes = passedInferTypes || autoInferenceType(unparsedDataset); | ||
if (!doKeysMatch(unparsedDataset, inferedTypes)) { | ||
throw new Error(MISMATCH_KEY); | ||
} | ||
const dataSet = passedInferTypes ? filledDataSet : parseDates(filledDataSet, inferTypes); | ||
const moments = computeMoments(dataSet, inferTypes); | ||
const datumPreprocessor = parseDatumFactory(inferTypes, moments, formatter); | ||
const dataSet = passedInferTypes | ||
? filledDataSet | ||
: parseDates(filledDataSet, inferedTypes); | ||
const moments = computeMoments(dataSet, inferedTypes); | ||
const datumPreprocessor = parseDatumFactory(inferedTypes, moments, formatter); | ||
const data = dataSet.map(datum => datumPreprocessor(datum)); | ||
return { data, moments }; | ||
return { data, moments, inferedTypes }; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianVnZ2xlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9saWIvanVnZ2xlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLGlCQUFpQixFQUFFLE1BQU0sU0FBUyxDQUFBO0F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QUNmLENBQUMsQ0FBQyxVQUFVLENBQUMsYUFBYSxFQUFFLFlBQVksQ0FBQyxDQUFDO0lBQzVDLE1BQU0sT0FBTyxHQUFHLGNBQWMsQ0FBQyxPQUFPLEVBQUUsWUFBWSxDQUFDLENBQUM7SUFFdEQsTUFBTSxpQkFBaUIsR0FBRyxpQkFBaUIsQ0FBQyxZQUFZLEVBQUUsT0FBTyxFQUFFLFNBQVMsQ0FBQyxDQUFDO0lBRTlFLE1BQU0sSUFBSSxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxpQkFBaUIsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDO0lBRTVELE9BQU8sRUFBRSxJQUFJLEVBQUUsT0FBTyxFQUFFLFlBQVksRUFBRSxDQUFDO0FBQ3pDLENBQUMifQ== |
{ | ||
"name": "data-juggler", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"main": "build/main/index.js", | ||
@@ -5,0 +5,0 @@ "typings": "build/main/index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80710
877