'use strict';

class Dummy {
    constructor(options = {}) {
        this.threshold = options.threshold || 0;
    }

    train() {
        // train does nothing, this classifier is really dumb
    }

    predict(features) {
        if (!Array.isArray(features)) {
            features = [features];
        }
        var labels = new Array(features.length);

        for (let i = 0; i < features.length; i++) {
            if (features[i] === this.threshold) {
                labels[i] = 0;
            } else if (features[i] < this.threshold) {
                labels[i] = -1;
            } else {
                labels[i] = 1;
            }
        }
        return labels;
    }
}

module.exports = Dummy;

@@ -42,20 +42,8 @@
 tor(
-options = %7B%7D
 ) %7B%0A
@@ -70,29 +70,8 @@
 ld =
- options.threshold %7C%7C
  0;%0A

fix for nodejs v4