This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Format value for insert or update in SQLite database | |
* @param {Any} val | |
* @returns Boolean/Number/String/Null | |
*/ | |
const formatSQLValue = (val) => { | |
const escapeString = (str) => { | |
return str.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, (char) => { | |
switch (char) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Constantes used for parsing. | |
*/ | |
const HEADER = 'HEADER'; | |
const DIRECTIVE = 'DIRECTIVE'; | |
const ATTRIBUTE = 'ATTRIBUTE'; | |
const EXTGRP = 'EXTGRP'; | |
const EXTPLS = 'PLAYLIST'; | |
const FILENAME = 'FILENAME'; | |
const GROUPTITLE = 'group-title'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Constantes used for constructing. | |
*/ | |
const EXTGRP = 'EXTGRP'; | |
const EXTPLS = 'PLAYLIST'; | |
const GROUPTITLE = 'group-title'; | |
/** | |
* M3U Writer Class | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple in-memory cache | |
*/ | |
module.exports = class MemCache { | |
// Cache object | |
#cache = Object.create(null); | |
// Cache size | |
#size = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import os module | |
const os = require('os'); | |
// Import fs module | |
const fs = require('fs'); | |
// Import path module | |
const path = require('node:path'); | |
/** | |
* Simple file cache | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import fs module | |
const fs = require('fs'); | |
// Import path module | |
const path = require('node:path'); | |
// Property value - used for key removal in version | |
const removalKey = '__DELETED_FROM_FILE__'; | |
/** | |
* Construct filename with directory | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Title : JSON Database written in Javascript. | |
* Version : 1.0.0.0 | |
* Author : Ernst Reidinga | |
* Copyleft : 2022 (c) ERDesigns - Ernst Reidinga | |
* License : GPL | |
*/ | |
// Import fs module | |
const fs = require('fs'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* News API Class for use in the browser. You can use this on localhost | |
* or if you have a paid subscription you can use it on your website. | |
* Just create a new instance and pass your API key, alternatively | |
* you can set some defaults via the options object. | |
* | |
* License: MIT | |
* Author: Ernst Reidinga - ERDesigns - 26/10/2022 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* CoinLayer API - Cryptocurrency exchange rates etc.. | |
* for use in the browser. | |
* | |
* License: MIT | |
* Author: Ernst Reidinga - ERDesigns - 26/10/2022 | |
*/ | |
class CoinLayerAPIError extends Error { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Terminal colors and style | |
*/ | |
const Color = { | |
Reset: "\x1b[0m", | |
Bright: "\x1b[1m", | |
Dim: "\x1b[2m", | |
Underscore: "\x1b[4m", | |
Blink: "\x1b[5m", | |
Reverse: "\x1b[7m", |
OlderNewer