Commit c747a8b351b0246af5dedcb14f4765da8862993f
1 parent
a5f5921d23
Exists in
master
DEBUG
Showing 1 changed file with 3 additions and 1 deletions Inline Diff
lib/history.js
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | const CircularBuffer = require("circular-buffer"); | 3 | const CircularBuffer = require("circular-buffer"); |
4 | const history = new CircularBuffer(200); | 4 | const history = new CircularBuffer(200); |
5 | 5 | ||
6 | function push(item) { | 6 | function push(item) { |
7 | history.push(item); | 7 | history.push(item); |
8 | } | 8 | } |
9 | 9 | ||
10 | function dump() { | 10 | function dump() { |
11 | return history.toarray(); | 11 | const result = history.toarray(); |
12 | console.log(JSON.stringify(result, null, 2)); | ||
13 | return result; | ||
12 | } | 14 | } |
13 | 15 | ||
14 | exports.push = push; | 16 | exports.push = push; |
15 | exports.dump = dump; | 17 | exports.dump = dump; |