Skip to content

Instantly share code, notes, and snippets.

@ls404
Created May 18, 2017 07:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ls404/22fd2b6073a7197b8ffcfe5a5ebff4ec to your computer and use it in GitHub Desktop.
Save ls404/22fd2b6073a7197b8ffcfe5a5ebff4ec to your computer and use it in GitHub Desktop.
print crosfilter results in console
/**
* Created by user on 18/05/17.
*/
// Super useful for debug in web console
function print_filter(filter){
var f=eval(filter);
if (typeof(f.length) != "undefined") {}else{}
if (typeof(f.top) != "undefined") {f=f.top(Infinity);}else{}
if (typeof(f.dimension) != "undefined") {f=f.dimension(function(d) { return "";}).top(Infinity);}else{}
console.log("DC DEBUG: "+filter+"("+f.length+") = "+JSON.stringify(f).replace("[","[\n\t").replace(/}\,/g,"},\n\t").replace("]","\n]"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment