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 { PathLike, readFile, appendFile } from "fs"; | |
import path from "path"; | |
import { fileURLToPath } from "url"; | |
import { dirname } from "path"; | |
const __filename = fileURLToPath(import.meta.url); | |
const __dirname = dirname(__filename); | |
const files = process.argv.slice(2); | |
/** |
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
/** | |
* Example of the iterator pattern described in Node.js Design Patterns. | |
* @see https://gist.github.com/lmammino/ac91a7bde88c0f6c6962268d67e3ffbe | |
* @see https://www.nodejsdesignpatterns.com/ | |
* | |
* "The Sequential Iterator pattern: | |
* execute a list of tasks in sequence by creating an iterable function, which | |
* invokes the next available task in the collection and makes sure to invoke | |
* the next step of the interaction when the current tasks completes." | |
* |
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 { EventEmitter } from "events"; | |
(function (number, callback) { | |
const EMITTER = new EventEmitter; | |
const MILLISECONDS_INTERVAL = 50; | |
const TIMESTAMP_ERROR = new Error('Timestamp is divisile by 5'); | |
let ticks = 0; | |
let elapsedTimeInMilliseconds = 0; | |
let intervalID; |
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 { EventEmitter } from "events"; | |
(function (number, callback) { | |
const EMITTER = new EventEmitter; | |
const MILLISECONDS_INTERVAL = 50; | |
let ticks = 0; | |
let elapsedTimeInMilliseconds = 0; | |
let intervalID; | |
function start() { |
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 { EventEmitter } from "events"; | |
(function (number, callback) { | |
const EMITTER = new EventEmitter; | |
const MILLISECONDS_INTERVAL = 50; | |
let ticks = 0; | |
let elapsedTimeInMilliseconds = 0; | |
let intervalID; | |
function start() { |