File tree 7 files changed +37
-19
lines changed
7 files changed +37
-19
lines changed Original file line number Diff line number Diff line change
1
+ lib /algorithms /* .js
2
+ ! lib /algorithms /default.js
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ {
2
+ "env" : {
3
+ "node" : true
4
+ },
5
+ "extends" : " eslint:recommended" ,
6
+ "rules" : {
7
+ "indent" : [
8
+ " error" ,
9
+ 2
10
+ ],
11
+ "linebreak-style" : [
12
+ " error" ,
13
+ " unix"
14
+ ],
15
+ "quotes" : [
16
+ " error" ,
17
+ " single"
18
+ ],
19
+ "semi" : [
20
+ " error" ,
21
+ " always"
22
+ ]
23
+ }
24
+ }
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- var path = require ( 'path' ) ;
4
3
var extend = require ( 'xtend' ) ;
5
4
var defaultAlgorithm = require ( './algorithms/default.js' ) ;
6
5
@@ -44,6 +43,7 @@ Slayer.prototype = {
44
43
* @param i {Number}
45
44
* @returns {Number }
46
45
*/
46
+ // eslint-disable-next-line no-unused-vars
47
47
getItem : function getItem ( item , originalItem , i ) {
48
48
return item ;
49
49
} ,
@@ -70,7 +70,7 @@ Slayer.prototype = {
70
70
* Configures the internal filters of a slayer instance
71
71
*/
72
72
configureFilters : function configureFilters ( config ) {
73
- if ( typeof config . minPeakHeight !== 'number' || config . minPeakHeight === NaN ) {
73
+ if ( typeof config . minPeakHeight !== 'number' || isNaN ( config . minPeakHeight ) ) {
74
74
throw new TypeError ( 'config.minPeakHeight should be a numeric value. Was: ' + String ( config . minPeakHeight ) ) ;
75
75
}
76
76
@@ -104,7 +104,7 @@ Slayer.prototype = {
104
104
return this ;
105
105
}
106
106
107
- throw new TypeError ( '.use() expects its first and only paramter to be a peak detection function.' )
107
+ throw new TypeError ( '.use() expects its first and only paramter to be a peak detection function.' ) ;
108
108
} ,
109
109
/**
110
110
* Index accessor applied to each series item.
Original file line number Diff line number Diff line change @@ -27,9 +27,9 @@ var commons = require('./_common.js');
27
27
function fromArray ( data ) {
28
28
var self = this ;
29
29
30
- return new Promise ( function ( resolve , reject ) {
30
+ return new Promise ( function ( resolve ) {
31
31
if ( ! Array . isArray ( data ) ) {
32
- throw new TypeError ( 'The data argument should be an array of time series values.' )
32
+ throw new TypeError ( 'The data argument should be an array of time series values.' ) ;
33
33
}
34
34
35
35
var spikes = data
@@ -39,7 +39,7 @@ function fromArray(data){
39
39
. map ( commons . objectMapper . bind ( self , data ) )
40
40
. filter ( commons . cleanEmptyElement . bind ( null , self . config . transformedValueProperty ) ) ;
41
41
42
- resolve ( spikes ) ;
42
+ resolve ( spikes ) ;
43
43
} ) ;
44
44
}
45
45
Original file line number Diff line number Diff line change @@ -61,11 +61,10 @@ function createReadStream(options){
61
61
var emittedCache = [ ] ;
62
62
var currentOffset = 0 ;
63
63
var SLIDING_WINDOW_SIZE = this . config . minPeakDistance * options . bufferingFactor ;
64
- console . log ( SLIDING_WINDOW_SIZE )
65
64
var SLIDING_WINDOW_OVERLAP = SLIDING_WINDOW_SIZE * options . lookAheadFactor ;
66
65
67
66
var findSpikes = function findSpikes ( items , stream ) {
68
- var spikes = items
67
+ return items
69
68
. map ( self . getValueY . bind ( self ) )
70
69
. map ( self . filterDataItem . bind ( self ) )
71
70
. map ( self . algorithm . bind ( self , self . config . minPeakDistance ) )
@@ -74,7 +73,7 @@ function createReadStream(options){
74
73
. map ( incrementOffset . bind ( self , 'x' , currentOffset ) )
75
74
. filter ( cleanEmitted . bind ( self , 'x' , emittedCache ) )
76
75
. map ( pushToStream , stream ) ;
77
- }
76
+ } ;
78
77
79
78
var flush = function flushBuffer ( done ) {
80
79
findSpikes ( buffer , this ) ;
Original file line number Diff line number Diff line change 5
5
"main" : " index.js" ,
6
6
"scripts" : {
7
7
"test" : " nyc mocha --reporter dot 'test/**/*.js'" ,
8
- "eslint" : " eslint ./lib/" ,
8
+ "posttest" : " npm run lint" ,
9
+ "lint" : " eslint index.js ./lib" ,
9
10
"benchmarks" : " ./bin/run-benchmarks.js"
10
11
},
11
12
"repository" : {
35
36
"devDependencies" : {
36
37
"benchmark" : " ^1.0.0" ,
37
38
"chai" : " ^3.5.0" ,
38
- "eslint" : " ^0.5.0 " ,
39
+ "eslint" : " ^3.7.1 " ,
39
40
"mocha" : " ^3.1.0" ,
40
41
"nyc" : " ^8.3.0" ,
41
42
"sinon" : " ^1.9.1" ,
You can’t perform that action at this time.
0 commit comments