blob: 95b9b4f438571aa61aa1a8404179b006efc85903 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
var numberLogger = function (name, length) {
this.name = name;
this.ns = new Array(length);
this.len = length;
for (i = 0; i < length; ++i)
this.ns[i] = 0;
};
numberLogger.prototype.add = function (x) {
this.ns.splice(0, 1);
this.ns.push(x);
};
numberLogger.prototype.stringify = function () {
return {"name": this.name, "dat": this.ns, "len": this.length};
};
module.exports = numberLogger;
|