Skip to content

Commit dd97129

Browse files
author
Artur Pryka
authored
Merge pull request #62 from keen/apryka-result-parsers
Result parsers
2 parents a302e25 + f49f3b8 commit dd97129

11 files changed

+140
-33
lines changed

dist/keen-analysis.js

+20-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/keen-analysis.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/keen-analysis.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/keen-analysis.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modules/localQuery.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17731,7 +17731,7 @@ module.exports = result;
1773117731
/* 133 */
1773217732
/***/ (function(module) {
1773317733

17734-
module.exports = {"_from":"crossfilter2","_id":"[email protected]","_inBundle":false,"_integrity":"sha512-Fdmb6NqdUqreOuQ9qiNvTLOxMFBQRPDeRBBnqM8Zlebdf2i7Bn5hRhE8RlO9YzbGRyYxvYzdDXt6C1muyanolg==","_location":"/crossfilter2","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"crossfilter2","name":"crossfilter2","escapedName":"crossfilter2","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/crossfilter2/-/crossfilter2-1.4.6.tgz","_shasum":"c173f0d75a04344ad226b1f8ae747f0386f98750","_spec":"crossfilter2","_where":"/Users/adamk/Desktop/my/keen-analysis.js","author":{"name":"Mike Bostock","url":"http://bost.ocks.org/mike"},"bugs":{"url":"https://github.com/crossfilter/crossfilter/issues"},"bundleDependencies":false,"contributors":[{"name":"Jason Davies","url":"http://www.jasondavies.com/"}],"dependencies":{"lodash.result":"^4.4.0"},"deprecated":false,"description":"Fast multidimensional filtering for coordinated views.","devDependencies":{"browserify":"^13.0.0","d3":"3.5","eslint":"2.10.2","package-json-versionify":"1.0.2","semver":"^5.3.0","sinon":"^4.0.2","uglify-js":"2.4.0","vows":"0.7.0"},"eslintConfig":{"env":{"browser":true,"node":true},"globals":{"Uint8Array":true,"Uint16Array":true,"Uint32Array":true},"extends":"eslint:recommended"},"files":["src","index.js","index.d.ts","crossfilter.js","crossfilter.min.js"],"homepage":"https://crossfilter.github.io/crossfilter/","keywords":["analytics","visualization","crossfilter"],"license":"Apache-2.0","main":"./index.js","maintainers":[{"name":"Gordon Woodhull","url":"https://github.com/gordonwoodhull"},{"name":"Tanner Linsley","url":"https://github.com/tannerlinsley"},{"name":"Ethan Jewett","url":"https://github.com/esjewett"}],"name":"crossfilter2","repository":{"type":"git","url":"git+ssh://[email protected]/crossfilter/crossfilter.git"},"scripts":{"benchmark":"node test/benchmark.js","build":"browserify index.js -t package-json-versionify --standalone crossfilter -o crossfilter.js && uglifyjs --compress --mangle --screw-ie8 crossfilter.js -o crossfilter.min.js","clean":"rm -f crossfilter.js crossfilter.min.js","test":"vows --verbose && eslint src/"},"types":"./index.d.ts","unpkg":"./crossfilter.min.js","version":"1.4.6"};
17734+
module.exports = {"_args":[["[email protected]","/Users/arturpryka/SourceFiles/keen-analysis.js"]],"_from":"[email protected]","_id":"[email protected]","_inBundle":false,"_integrity":"sha512-Fdmb6NqdUqreOuQ9qiNvTLOxMFBQRPDeRBBnqM8Zlebdf2i7Bn5hRhE8RlO9YzbGRyYxvYzdDXt6C1muyanolg==","_location":"/crossfilter2","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"[email protected]","name":"crossfilter2","escapedName":"crossfilter2","rawSpec":"1.4.6","saveSpec":null,"fetchSpec":"1.4.6"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/crossfilter2/-/crossfilter2-1.4.6.tgz","_spec":"1.4.6","_where":"/Users/arturpryka/SourceFiles/keen-analysis.js","author":{"name":"Mike Bostock","url":"http://bost.ocks.org/mike"},"bugs":{"url":"https://github.com/crossfilter/crossfilter/issues"},"contributors":[{"name":"Jason Davies","url":"http://www.jasondavies.com/"}],"dependencies":{"lodash.result":"^4.4.0"},"description":"Fast multidimensional filtering for coordinated views.","devDependencies":{"browserify":"^13.0.0","d3":"3.5","eslint":"2.10.2","package-json-versionify":"1.0.2","semver":"^5.3.0","sinon":"^4.0.2","uglify-js":"2.4.0","vows":"0.7.0"},"eslintConfig":{"env":{"browser":true,"node":true},"globals":{"Uint8Array":true,"Uint16Array":true,"Uint32Array":true},"extends":"eslint:recommended"},"files":["src","index.js","index.d.ts","crossfilter.js","crossfilter.min.js"],"homepage":"https://crossfilter.github.io/crossfilter/","keywords":["analytics","visualization","crossfilter"],"license":"Apache-2.0","main":"./index.js","maintainers":[{"name":"Gordon Woodhull","url":"https://github.com/gordonwoodhull"},{"name":"Tanner Linsley","url":"https://github.com/tannerlinsley"},{"name":"Ethan Jewett","url":"https://github.com/esjewett"}],"name":"crossfilter2","repository":{"type":"git","url":"git+ssh://[email protected]/crossfilter/crossfilter.git"},"scripts":{"benchmark":"node test/benchmark.js","build":"browserify index.js -t package-json-versionify --standalone crossfilter -o crossfilter.js && uglifyjs --compress --mangle --screw-ie8 crossfilter.js -o crossfilter.min.js","clean":"rm -f crossfilter.js crossfilter.min.js","test":"vows --verbose && eslint src/"},"types":"./index.d.ts","unpkg":"./crossfilter.min.js","version":"1.4.6"};
1773517735

1773617736
/***/ }),
1773717737
/* 134 */

dist/node/keen-analysis.js

+20-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/keen-analysis.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/modules/localQuery.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26730,7 +26730,7 @@ module.exports = result;
2673026730
/* 241 */
2673126731
/***/ (function(module) {
2673226732

26733-
module.exports = {"_from":"crossfilter2","_id":"[email protected]","_inBundle":false,"_integrity":"sha512-Fdmb6NqdUqreOuQ9qiNvTLOxMFBQRPDeRBBnqM8Zlebdf2i7Bn5hRhE8RlO9YzbGRyYxvYzdDXt6C1muyanolg==","_location":"/crossfilter2","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"crossfilter2","name":"crossfilter2","escapedName":"crossfilter2","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/crossfilter2/-/crossfilter2-1.4.6.tgz","_shasum":"c173f0d75a04344ad226b1f8ae747f0386f98750","_spec":"crossfilter2","_where":"/Users/adamk/Desktop/my/keen-analysis.js","author":{"name":"Mike Bostock","url":"http://bost.ocks.org/mike"},"bugs":{"url":"https://github.com/crossfilter/crossfilter/issues"},"bundleDependencies":false,"contributors":[{"name":"Jason Davies","url":"http://www.jasondavies.com/"}],"dependencies":{"lodash.result":"^4.4.0"},"deprecated":false,"description":"Fast multidimensional filtering for coordinated views.","devDependencies":{"browserify":"^13.0.0","d3":"3.5","eslint":"2.10.2","package-json-versionify":"1.0.2","semver":"^5.3.0","sinon":"^4.0.2","uglify-js":"2.4.0","vows":"0.7.0"},"eslintConfig":{"env":{"browser":true,"node":true},"globals":{"Uint8Array":true,"Uint16Array":true,"Uint32Array":true},"extends":"eslint:recommended"},"files":["src","index.js","index.d.ts","crossfilter.js","crossfilter.min.js"],"homepage":"https://crossfilter.github.io/crossfilter/","keywords":["analytics","visualization","crossfilter"],"license":"Apache-2.0","main":"./index.js","maintainers":[{"name":"Gordon Woodhull","url":"https://github.com/gordonwoodhull"},{"name":"Tanner Linsley","url":"https://github.com/tannerlinsley"},{"name":"Ethan Jewett","url":"https://github.com/esjewett"}],"name":"crossfilter2","repository":{"type":"git","url":"git+ssh://[email protected]/crossfilter/crossfilter.git"},"scripts":{"benchmark":"node test/benchmark.js","build":"browserify index.js -t package-json-versionify --standalone crossfilter -o crossfilter.js && uglifyjs --compress --mangle --screw-ie8 crossfilter.js -o crossfilter.min.js","clean":"rm -f crossfilter.js crossfilter.min.js","test":"vows --verbose && eslint src/"},"types":"./index.d.ts","unpkg":"./crossfilter.min.js","version":"1.4.6"};
26733+
module.exports = {"_args":[["[email protected]","/Users/arturpryka/SourceFiles/keen-analysis.js"]],"_from":"[email protected]","_id":"[email protected]","_inBundle":false,"_integrity":"sha512-Fdmb6NqdUqreOuQ9qiNvTLOxMFBQRPDeRBBnqM8Zlebdf2i7Bn5hRhE8RlO9YzbGRyYxvYzdDXt6C1muyanolg==","_location":"/crossfilter2","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"[email protected]","name":"crossfilter2","escapedName":"crossfilter2","rawSpec":"1.4.6","saveSpec":null,"fetchSpec":"1.4.6"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/crossfilter2/-/crossfilter2-1.4.6.tgz","_spec":"1.4.6","_where":"/Users/arturpryka/SourceFiles/keen-analysis.js","author":{"name":"Mike Bostock","url":"http://bost.ocks.org/mike"},"bugs":{"url":"https://github.com/crossfilter/crossfilter/issues"},"contributors":[{"name":"Jason Davies","url":"http://www.jasondavies.com/"}],"dependencies":{"lodash.result":"^4.4.0"},"description":"Fast multidimensional filtering for coordinated views.","devDependencies":{"browserify":"^13.0.0","d3":"3.5","eslint":"2.10.2","package-json-versionify":"1.0.2","semver":"^5.3.0","sinon":"^4.0.2","uglify-js":"2.4.0","vows":"0.7.0"},"eslintConfig":{"env":{"browser":true,"node":true},"globals":{"Uint8Array":true,"Uint16Array":true,"Uint32Array":true},"extends":"eslint:recommended"},"files":["src","index.js","index.d.ts","crossfilter.js","crossfilter.min.js"],"homepage":"https://crossfilter.github.io/crossfilter/","keywords":["analytics","visualization","crossfilter"],"license":"Apache-2.0","main":"./index.js","maintainers":[{"name":"Gordon Woodhull","url":"https://github.com/gordonwoodhull"},{"name":"Tanner Linsley","url":"https://github.com/tannerlinsley"},{"name":"Ethan Jewett","url":"https://github.com/esjewett"}],"name":"crossfilter2","repository":{"type":"git","url":"git+ssh://[email protected]/crossfilter/crossfilter.git"},"scripts":{"benchmark":"node test/benchmark.js","build":"browserify index.js -t package-json-versionify --standalone crossfilter -o crossfilter.js && uglifyjs --compress --mangle --screw-ie8 crossfilter.js -o crossfilter.min.js","clean":"rm -f crossfilter.js crossfilter.min.js","test":"vows --verbose && eslint src/"},"types":"./index.d.ts","unpkg":"./crossfilter.min.js","version":"1.4.6"};
2673426734

2673526735
/***/ }),
2673626736
/* 242 */

lib/request.js

+22-7
Original file line numberDiff line numberDiff line change
@@ -157,35 +157,50 @@ request.prototype.send = function(obj){
157157
//interval and group by result
158158
response.result.forEach((val) => {
159159
val.value.forEach((res) => {
160+
let parsedValue;
160161
this.config.resultParsers.forEach((func) => {
161-
res.result = func(res.result)
162+
parsedValue = parsedValue ? func(parsedValue) : func(res.result);
162163
})
164+
res.result = parsedValue;
163165
})
164166
})
165167
}
166168
else {
167169
//interval result
168170
response.result.forEach((val) => {
171+
let parsedValue;
169172
this.config.resultParsers.forEach((func) => {
170-
val.value = func(val.value)
173+
parsedValue = parsedValue ? func(parsedValue) : func(val.value);
171174
})
175+
val.value = parsedValue;
172176
})
173177
}
174178
}
175179
else {
176180
//group by result
177181
response.result.forEach((res) => {
182+
let parsedValue;
178183
this.config.resultParsers.forEach((func) => {
179-
res.result = func(res.result)
184+
parsedValue = parsedValue ? func(parsedValue) : func(res.result);
180185
})
186+
res.result = parsedValue;
181187
})
182188
}
183-
}
184-
else {
189+
} else if (typeof response.result === 'object') {
190+
Object.keys(response.result).forEach((res) => {
191+
let parsedValue;
192+
this.config.resultParsers.forEach((func) => {
193+
parsedValue = parsedValue ? func(parsedValue) : func(response.result[res]);
194+
});
195+
response.result[res] = parsedValue;
196+
});
197+
} else {
185198
//simple result
199+
let parsedValue;
186200
this.config.resultParsers.forEach((func) => {
187-
response.result = func(response.result)
188-
})
201+
parsedValue = parsedValue ? func(parsedValue) : func(response.result);
202+
});
203+
response.result = parsedValue;
189204
}
190205
}
191206
if (httpOptions.params &&

0 commit comments

Comments
 (0)