Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Feature List

Sven Fehler edited this page May 20, 2020 · 25 revisions

« Home 🏠

This is a list of features that JSLib offers:


Functions:

Name Description Return Type Since Version
isEmpty() Checks if a variable is empty Boolean 1.4.0
isArrayEmpty() Checks if an array is empty Boolean 1.5.0
error() Sends an error message to the console, optionally to a file and/or exits the process void 1.5.0
allEqual() Tests whether or not all items of an array are equal Boolean 1.5.0
softShutdown() Executes a function before process shutdown void 1.5.0
noShudown() Prevents the process from being exited void 1.5.0
yesShutdown() Allows the process to be exited if previously prevented by jsl.noShutdown() void 1.6.0
readableArray() Converts an array to a better readable one String 1.7.0
mapRange() Transforms a value to a different numerical range Number 1.8.0
unused() Indicates an unused variable to a linter void 1.8.0
replaceAt() Replaces a character in a string with a different string String 1.8.0
randRange() Generates highly randomized numbers from a set numerical range Number 1.5.0
randomizeArray() Randomizes all items in an array Array<Any> 1.8.0
randomItem() Returns a random item of an array Any 1.9.4
removeDuplicates() Removes all duplicate items from an array Array<Any> 1.9.0
seededRNG
.generateSeededNumbers()
Generates a set of random numbers based on a seed (same seed = same numbers) Object 1.8.0
seededRNG
.generateRandomSeed()
Generates a random seed to be used in generateSeededNumbers() Number 1.8.0
seededRNG
.validateSeed()
Checks if a seed is valid Boolean 1.8.0
generateUUID
.hexadecimal()
Generates a randomized UUID in hexadecimal format String 1.5.0
generateUUID
.decimal()
Generates a randomized UUID in decimal format String 1.8.0
generateUUID
.alphanumerical()
Generates a randomized UUID in alphanumerical format String 1.8.0
generateUUID
.binary()
Generates a randomized UUID in binary format String 1.8.0
generateUUID
.custom()
Generates a randomized UUID in a custom format String 1.8.0
ping() Pings a URL and returns status code, MIME type and response time Object 1.6.0
downloadFile() Downloads a file from a URL and sends progress callbacks void 1.8.0
logger() Logs a string to a file with an optional timestamp void 1.5.0
readdirRecursive() Asynchronously reads a directory and its subdirectories recursively Array<String> 1.7.0
readdirRecursiveSync() Just like readdirRecursive(), but synchronous Array<String> 1.7.0
pause() Waits for a keypress until continuing with code execution Promise 1.9.0
inDebugger() Checks whether the process is currently running in a debugger environment Boolean 1.9.0

Classes:

Name Description Since Version
ProgressBar Creates a progress bar in the command line (console) 1.7.0
MenuPrompt Creates an interactive menu in the command line (console) 1.8.0

Objects:

Name Description Since Version
info This object contains information about JSLib, like the version, the contributors, the documentation URL and more 1.5.0
colors This object can be used to add color to the console output. Is especially useful with template literals 1.8.0

Deprecated:

⚠️ Some of these features might still be usable but they are not documented and will soon be completely removed, so I don't recommend using them. ⚠️

Name Description Deprecated Since
isempty() This was a lower case alias of isEmpty 1.6.5
settings This object used to contain the contents of a settings.json file but was removed as it is obsolete. You can just use require("./settings.json") instead. 1.6.6
version() This function just returned the version of JSLib. Use the object info instead. 1.8.0
consoleColor() This function used to add color to the console output but was deprecated due to the implementation of the colors object. 1.8.0
runUnitTests() This function ran JSLib's unit tests. But since running them is not needed to be automated, it was removed again. 1.8.3