Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
js data processing in cljs
(let [old-arr #js []
new-arr #js []]
(doseq [val old-arr]
(when (should-include? val)
(.push new-arr val))))
var oldArr = []; // <-- original data to be processed
var newArr = [];
for (i=0; i<oldArr.length; i++) {
var val = oldArr[i];
if (shouldInclude(val)) { // <-- basic filter
newArr.push = transform(val); // <-- basic map
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment