Index

lognestmonster / 78129ce

A general-purpose single-header C logging library and parser for event-based logs. (Incomplete)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
2425 Dec 2018 21:196a7fa04Update queue.jsJoshua110N

Blob @ lognestmonster / src / queue.js

application/javascript905 bytesdownload raw
1const statement = require("./statement.js");
2
3class Queue {
4 constructor(name, location) {
5 this.name = name;
6 this.location = location;
7 this.queue = [];
8 return this;
9 }
10
11 push() {
12 if (arguments.length >= 3) {
13 if (typeof arguments[0] == "string" && typeof arguments[1] == "string" && typeof arguments[2] == "string") {
14 this.queue.push(new statement(arguments[0], arguments[1], arguments[2]));
15 } else throw new Error("Expected 3 strings for Statement creation");
16 } else if (arguments.length > 0) {
17 if (arguments[0].statements) this.queue.push(arguments[0].statements); // object is an Event
18 else if (arguments[0].timestamp) this.queue.push(arguments[0]); // object is a Statement
19 else throw new Error("Expected an Event or Statement object");
20 } else throw new Error("Expeted at least one argument");
21 return this;
22 }
23
24 write() {
25 return this;
26 }
27}
28
29module.exports = Queue;
30