Simple timeseries utilities in javascript