This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clock = sinon.useFakeTimers(new Date(2016,11,1).getTime()); | |
new Date(); //=> return the fake Date 'Sat Nov 01 2016 00:00:00' | |
clock.restore(); | |
new Date(); //=> will return the real time again (now) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function weightedMean(arrValues, arrWeights) { | |
var result = arrValues.map(function (value, i) { | |
var weight = arrWeights[i]; | |
var sum = value * weight; | |
return [sum, weight]; | |
}).reduce(function (p, c) { |