UNPKG

ps2census

Version:

Client to connect to the PS2 Event Stream websocket.

30 lines 883 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.unixToDate = unixToDate; exports.numberStringToBoolean = numberStringToBoolean; exports.stringToBoolean = stringToBoolean; function unixToDate(unix) { const int = parseInt(unix, 10); if (isNaN(int)) throw new TypeError(`Unable to parse unix time: ${unix}`); return new Date(int * 1000); } function numberStringToBoolean(value) { switch (value.trim()) { case '0': return false; case '1': return true; } throw new TypeError(`Unable to parse boolean: ${value}`); } function stringToBoolean(value) { switch (value.trim()) { case 'false': return false; case 'true': return true; } throw new TypeError(`Unable to parse boolean: ${value}`); } //# sourceMappingURL=formatters.js.map