Index

lognestmonster / 6ea7e60

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

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
2725 Dec 2018 21:546ea7e60Update event.jsJoshua143N

Blob @ lognestmonster / src / event.js

application/javascript662 bytesdownload raw
1const statement = require("./statement.js");
2
3class Event {
4 constructor() {
5 this.statements = [];
6 this.push(arguments[0], arguments[1], arguments[2]);
7 return this;
8 }
9
10 push() {
11 if (arguments.length == 1) {
12 if (arguments[0] instanceof Event) this.statements.push(arguments[0].statements);
13 else if (arguments[0] instanceof statement) this.statements.push(arguments[0]);
14 else throw new TypeError("Expected an Event or Statement");
15 }
16 else if (arguments.length == 3) this.statements.push(new statement(arguments[0], arguments[1], arguments[2]));
17 else throw new Error("Expected 1 or 3 arguments");
18 return this;
19 }
20}
21
22module.exports = Event;
23