diff --git a/.gitignore b/.gitignore index b1b5b6a..1468c08 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ node_modules fluid.waveform.tar.gz /**/fav-max.js pnpm-lock.yaml +.vscode +.DS_Store diff --git a/src/api-max.js b/src/api-max.js index 127a894..bbbe9bb 100644 --- a/src/api-max.js +++ b/src/api-max.js @@ -41,7 +41,7 @@ Signal.prototype['sample'] = function(step, method = "mean"){ if(bucketStart > this.data.length - 1 ) bucketStart = this.data.length -1; if(bucketEnd > this.data.length -1 ) bucketEnd = this.data.length -1; if(bucketStart === bucketEnd) { - newData[i] = i > 0 ? newData[i-1] : this.data[i]; //<------- diff + newData[i] = this.data[bucketStart]; } else newData[i] = stats[method](this.data.slice(bucketStart, bucketEnd)); }