Latest version: 1.18.2
Click here to view the version history
- Fixes
- Made
system.inDebugger()
no longer dependent on V8'sinspector
module - Fixed wrong color code for
colors.fat
- Made
- Fixes
- Fixed TS types for
randomItem()
,randomItemIndex()
andtakeRandomItem()
- Fixed TS types for
- Additions
splitIntoParts()
function to split an array into n partssplitIntoPartsOfLength()
function to split an array into parts of n length
- Fixes
- Additions
- Added function
allInstanceOf()
to check if all items in an array are an instance of a class - Added function
isClass()
to check if a value is a reference to a class - Added function
randomItemIndex()
to get a random item and its index from an array - Added function
takeRandomItem()
to delete a random item from an array and return it - colors
- Added
colors.fgb
andcolors.bgb
for bright colors - Added
dim
,underscore
,reverse
andhidden
- Added
- Added function
- Breaking changes
- Changed state
fulfilled
toresolved
in StatePromise - colors
- Removed brightness modifier from
colors.fg
andcolors.bg
- Renamed
colors.fat
tocolors.bright
- Removed brightness modifier from
- Changed state
- Fixes
- Added missing documentation for
allOfType()
- Fixed docs in various places
- Added missing documentation for
- Additions
- Added clamp() to ensure a number is between a min and max limit
- Fixes
- randRange() now doesn't depend on the
performance
module anymore - Updated deps
- randRange() now doesn't depend on the
- Breaking changes
- Shortened namespace names:
generateUUID
->uuid
filesystem
->files
- Renamed functions:
seededRNG.generateRandomSeed()
->seededRNG.randomSeed()
seededRNG.generateRandomNumbers()
->seededRNG.generateNumbers()
pause()
->system.pause()
- Shortened namespace names:
- Additions
- Added function
halves()
to get the two halves of an array - Added function
parseDuration()
to parse out time units from a passed duration in milliseconds - Added function
formatDuration()
to convert a duration in milliseconds to a string with custom format - Added function
files.existsSync()
as a synchronous counterpart tofiles.exists()
SelectionMenu
now supports EventEmitter's.on("submit")
method
- Added function
- Fixes
- Fixes
- Internal stuff
- Added CodeQL analysis workflow
- Fixes
filesystem.exists()
can now actually be used 🤦 (issue #25)
- Additions
- Added class
StatePromise
that keeps track of the state of a promise - Added single-parameter overload to
randRange()
- Added string array overload to
generateUUID.custom()
, deprecated older overload softShutdown()
now accepts a Promise for async code execution before shutdown
- Added class
- Changes
- Moved repository to @Sv443-Network
- Improved type declaration file (
.d.ts
) by a lot
- Security
- Audited dependencies
- Security:
- Fixed vulnerability in package
netmask
(CVE-2021-28918)
- Fixed vulnerability in package
- You will need to modify all occurrences of
FolderDaemon
with the new syntax shown in the docs - The namespace of a few functions has changed (see changes below)
- Added functions:
filesystem.exists()
to provide a reimplementation tofs
' deprecatedexists()
function (issue #14)filesystem.ensureDirs()
to ensure a set of directories exists (issue #18)filesystem.ensureDirsSync()
synchronous counterpart toensureDirs()
(issue #18)system.usedHeap()
to get the current heap usage in percent (issue #19)
- Changes:
- Replaced
FolderDaemon
's configuration parameters with a single settings object (issue #13) - Added base class
SCLError
to all errors to implement thedate
property (issue #17) - Moved a few functions to the new
system
namespace:noShutdown()
- moved tosystem
yesShutdown()
- moved tosystem
softShutdown()
- moved tosystem
inDebugger()
- moved tosystem
setWindowTitle()
- moved tosystem
- Replaced
- Fixed bugs:
- Added functions
- Fixed bugs
- Added SCL's custom error classes to new namespace
scl.Errors
- Massively improved the documentation
- My dumbass left some debug text in
- Added the class
SelectionMenu
to create a menu with a scrollable list of options a user can select - Added the function
allOfType()
to see if all items of an array are of a specified type
- Added all features from JSLib-npm v1.9.4
- Added a TypeScript type declaration file so the in-IDE documentation and type safety is even better than before (thanks to @canarado)
- Added the class
FolderDaemon
to supervise a directory for changed files - Added functions
reserialize()
to copy a JSON-compatible object by value and lose the referencebyteLength()
to return the length of a string in byteshttp.pipeString()
to stream a string into an http requesthttp.pipeFile()
to stream a file into an http requesthttp.getClientEncoding()
to get the encoding method a client requested
- Added the
rst
property tocolors.fg
andcolors.bg
- Remade the documentation to be a bit more clear and better structured (thanks to @ThatCopy for helping)
- Fixed invalid usage of the "SIGKILL" signal in
jsl.softShutdown()
(GitHub issue #49) - Added function
jsl.randomItem()
that returns a random item of an array
- Decreased size of package by adding some files to the
.npmignore
(GitHub issue #45) - Fixed memory leak issues as all events in
jsl.pause()
are now correctly unregistered (GitHub issue #43) - Fixed the JSDoc documentation comments for
jsl.seededRNG.generateSeededNumbers()
and some other functions (GitHub issue #44) - Improved handling of the two separate
package.json
files, for NPM and GPR (GitHub issue #47) - Modified the
.editorconfig
a bit
- Fixed some minor docs issues
- Added Promise return to
jsl.downloadFile()
andjsl.readdirRecursive()
- Made "Exit" text localizable in
jsl.MenuPrompt
jsl.pause()
now correctly unregisters events, fixing memory leak issues
jsl.unused()
now has a rest parameter instead of a single parameter- Added
jsl.removeDuplicates()
to remove duplicate entries in an array - Added
jsl.pause()
to wait until user confirmation before continuing code execution - Added a
localization
property tojsl.MenuPrompt
to enable it for being translated - Added
jsl.inDebugger()
to check if the process is currently running in a debugger - Fixed a bug in
jsl.MenuPrompt
by ensuring that the raw mode of the stdin is always set to true
- Fixed high severity security vulnerabilities in ESLint's dependencies:
- TIL you can't use a previously published and unpublished tag in NPM sigh #2
- fixed typo in the JSDoc comment for "jsl.randRange()"
- fixed JSDoc typedefs for MenuPrompt
- fixed "directory not found" error in the unit test script
- added GitHub actions scripts to automate building and publishing
- added MenuPrompt option to auto submit the menu after a single char was entered
- improvements / fixes:
- version bumped because GitHub package registry doesn't allow unpublishing sigh
- new features:
- function "jsl.seededRNG.generateSeededNumbers(count, seed)" to generate "random" numbers based on a passed seed
- function "jsl.seededRNG.generateRandomSeed(digitCount)" to generate a random seed to be used in "jsl.generateSeededNumbers()"
- function "jsl.seededRNG.validateSeed(seed)" to check whether or not a seed is valid
- function "jsl.mapRange(value, range_1_min, range_1_max, range_2_min, range_2_max)" to transform a value from one numerical range to another
- function "jsl.downloadFile(url, destPath, options)" to download a file from a URL
- function "jsl.unused(any_var)" to indicate an unused variable to a linter
- function "jsl.replaceAt(input: str, index: number, replacement: str)" to replace a character at the specified index of a string with a replacement
- function "jsl.randomizeArray(array: array)" to randomize the indexes of the items of an array
- object "colors" to make it easier to add colors to the console output - this will replace "jsl.consoleColor()"
- class "MenuPrompt" for an interactive menu (directly in the CLI) - methods:
- "open()" to open the prompt
- "addMenu()" to add a new menu to the prompt
- "validateMenu()" to check whether a menu is invalid
- "currentMenu()" to get the current menu index
- "close()" to prematurely close the prompt and get the results
- "result()" to prematurely get the results of the prompt (without closing it)
- added unit tests for every function, class and object. They can be run with "npm test" or "node unittest"
- improvements / fixes:
- added support for ESLint (use "npm i --save-dev" and then "npm run lint")
- improved time measurement system for "jsl.ping()"
- improved the background stuff in "jsl.ping()" to improve performance
- added "contentType" property to "jsl.ping()"'s promise callback
- edited a bunch of functions and methods to throw an error instead of returning it as a string, which could've caused unwanted and unpredictable behavior
- put the UUID generation inside an object, renamed it and added four new ones:
- "generateUUID.hexadecimal(format: str, upperCase: bool)" [0-9,a-f/A-F]
- "generateUUID.alphanumerical(format: str, upperCase: bool)" [0-9,a-z/A-Z]
- "generateUUID.decimal(format: str)" [0-9]
- "generateUUID.binary(format: str)" [0-1]
- "generateUUID.custom(format: str, possibleValues: str)" [Custom]
- added "contributors" and "documentation" properties to the "jsl.info" object
- removed the signal "SIGKILL" from the shutdown prevention functions as "SIGKILL" is intended as a signal that forces a process to be exited no matter what
- rewrote the entire documentation, I'm crying rn
- restructured the entire script to separate each function into its own file
- fixed "isEmpty()"'s object-with-length-0-detection
- fixed typo in "readme.md"
- added "ProgressBar" class to create a dynamic progress bar
- added function "jsl.readdirRecursive(folder, callback(err, result){})" to read a folder and its subfolders asynchronously
- added function "jsl.readdirRecursiveSync(folder)" to read a folder and its subfolders synchronously
- added function "jsl.readableArray(array, separators, lastSeparator)" to make an array more easily human-readable
- split the package up into three separate files
- removed all dependencies because they are either included by default or their effect was easily recreatable in vanilla JS
- removed "jsl.settings" completely
- updated documentation for "jsl.ping()"
- changed dependency "perf_hooks" to "execution-time" because a feature was deprecated
- completely deprecated the all-lowercase alias "jsl.isempty()" of the function "jsl.isEmpty()"
- cleaned up the code a bit
SvCoreLib
JSLib-npm (deprecated predecessor)