Gap statistic in node.js