Gathering detailed insights and metrics for @sv443-network/coreutils
Gathering detailed insights and metrics for @sv443-network/coreutils
Gathering detailed insights and metrics for @sv443-network/coreutils
Gathering detailed insights and metrics for @sv443-network/coreutils
[WIP] Cross-platform, general-purpose, JavaScript core library for Node, Deno and the browser. Can be used standalone, but is intended as a common dependency of @sv443-network/userutils and @sv443-network/djsutils
npm install @sv443-network/coreutils
Typescript
Module System
Node Version
NPM Version
TypeScript (94.72%)
JavaScript (5.28%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
73 Commits
3 Branches
1 Contributors
Updated on Jul 10, 2025
Latest Version
2.0.0
Package Id
@sv443-network/coreutils@2.0.0
Unpacked Size
324.78 kB
Size
78.89 kB
File Count
26
NPM Version
10.9.2
Node Version
22.17.0
Published on
Jul 10, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
Cross-platform, general-purpose, JavaScript core library for Node, Deno and the browser.
Intended to be used in conjunction with @sv443-network/userutils
and @sv443-network/djsutils
, but can be used independently as well.
function randomItem()
- Returns a random item from the given arrayfunction randomItemIndex()
- Returns a random array item and index as a tuplefunction randomizeArray()
- Returns a new array with the items in random orderfunction takeRandomItem()
- Returns a random array item and mutates the array to remove itfunction takeRandomItemIndex()
- Returns a random array item and index as a tuple and mutates the array to remove ittype NonEmptyArray
- Non-empty array typefunction darkenColor()
- Darkens the given color by the given percentagefunction hexToRgb()
- Converts a hex color string to an RGB objectfunction lightenColor()
- Lightens the given color by the given percentagefunction rgbToHex()
- Converts an RGB object to a hex color stringfunction abtoa()
- Converts an ArrayBuffer to a stringfunction atoab()
- Converts a string to an ArrayBufferfunction compress()
- Compresses the given string using the given algorithm and encodingfunction decompress()
- Decompresses the given string using the given algorithm and encodingfunction computeHash()
- Computes a string's hash using the given algorithmfunction randomId()
- Generates a random ID of the given lengthclass DataStore
- The main class for the data store
type DataStoreOptions
- Options for the data storetype DataMigrationsDict
- Dictionary of data migration functionstype DataStoreData
- The type of the serializable dataclass DataStoreSerializer
- Serializes and deserializes data for multiple DataStore instances
type DataStoreSerializerOptions
- Options for the DataStoreSerializertype LoadStoresDataResult
- Result of calling loadStoresData()
type SerializedDataStore
- Meta object and serialized data of a DataStore instancetype StoreFilter
- Filter for selecting data storesclass DataStoreEngine
- Base class for DataStore storage engines, which handle the data storage
type DataStoreEngineDSOptions
- Reduced version of DataStoreOptions
class BrowserStorageEngine
- Storage engine for browser environments (localStorage, sessionStorage)
type BrowserStorageEngineOptions
- Options for the browser storage engineclass FileStorageEngine
- File-based storage engine for Node.js and Deno
type FileStorageEngineOptions
- Options for the file storage enginefunction debounce()
- Function wrapper for the Debouncer
classclass Debouncer
- Class that manages listeners whose calls are rate-limited
type DebouncerType
- The triggering type for the debouncertype DebouncedFunction
- Function type that is returned by the debounce()
functiontype DebouncerEventMap
- Event map type for the Debouncer
classclass DatedError
- Base error class with a date
property
class ChecksumMismatchError
- Error thrown when two checksums don't matchclass MigrationError
- Error thrown in a failed data migrationclass ValidationError
- Error while validating datafunction bitSetHas()
- Checks if a bit is set in a bitsetfunction clamp()
- Clamps a number between a given rangefunction digitCount()
- Returns the number of digits in a numberfunction formatNumber()
- Formats a number to a string using the given locale and format identifier
type NumberFormat
- Number format identifierfunction mapRange()
- Maps a number from one range to anotherfunction overflowVal()
- Makes sure a number is in a range by over- & underflowing itfunction randRange()
- Returns a random number in the given rangefunction roundFixed()
- Rounds the given number to the given number of decimal placesfunction valsWithin()
- Checks if the given numbers are within a certain range of each otherfunction consumeGen()
- Consumes a ValueGen
object
type ValueGen
- A value that can be either type T, or a sync or async function that returns Tfunction consumeStringGen()
- Consumes a StringGen
object
type StringGen
- A value that can be either of type string, or a sync or async function that returns a stringfunction fetchAdvanced()
- Wrapper around fetch()
with options like a timeout
type FetchAdvancedOpts
- Options for the fetchAdvanced()
functionfunction getListLength()
- Returns the length of a ListLike
object
type ListLike
- Any value with a quantifiable length
, count
or size
propertyfunction pauseFor()
- Pauses async execution for the given amount of timefunction pureObj()
- Applies an object's props to a null object (object without prototype chain) or just returns a new null objectfunction setImmediateInterval()
- Like setInterval()
, but instantly calls the callback and supports passing an AbortSignal
function setImmediateTimeoutLoop()
- Like a recursive setTimeout()
loop, but instantly calls the callback and supports passing an AbortSignal
function scheduleExit()
- Schedules a process exit after the next event loop tick, to allow operations like IO writes to finish.class NanoEmitter
- Simple, lightweight event emitter class that can be used in both FP and OOP, inspired by EventEmitter
from node:events
, based on nanoevents
type NanoEmitterOptions
- Options for the NanoEmitter
classfunction autoPlural()
- Turns the given term into its plural form, depending on the given number or list lengthfunction capitalize()
- Capitalizes the first letter of the given stringfunction createProgressBar()
- Creates a progress bar string with the given percentage and length
const defaultPbChars
- Default characters for the progress bartype ProgressBarChars
- Type for the progress bar characters objectfunction joinArrayReadable()
- Joins the given array into a string, using the given separators and last separatorfunction secsToTimeStr()
- Turns the given number of seconds into a string in the format (hh:)mm:ss
with intelligent zero-paddingfunction truncStr()
- Truncates the given string to the given lengthtype LooseUnion
- A union type that allows for autocomplete suggestions as well as substitutions of the same typetype ListLike
- Any value with a quantifiable length
, count
or size
propertytype Newable
- Any class reference that can be instantiated with new
type NonEmptyArray
- Non-empty array typetype NonEmptyString
- String type with at least one charactertype NumberFormat
- Number format identifiertype Prettify
- Makes the structure of a type more readable by fully expanding it (recursively)type SerializableVal
- Any value that can be serialized to JSONtype StringGen
- A value that can be either of type string, or a sync or async function that returns a stringtype ValueGen
- A value that can be either the generic type T, or a sync or async function that returns Ttype Stringifiable
- Any value that can be implicitly converted to a string[!NOTE]
🟣 = function
🟧 = class
🔷 = type
🟩 = const
1npm i @sv443-network/coreutils 2pnpm i @sv443-network/coreutils 3yarn add @sv443-network/coreutils 4npx jsr install @sv443-network/coreutils 5deno add jsr:@sv443-network/coreutils
1<script src="https://cdn.jsdelivr.net/npm/@sv443-network/coreutils@INSERT_VERSION_HERE/dist/CoreUtils.min.umd.js"></script> 2<script src="https://unpkg.com/@sv443-network/coreutils@INSERT_VERSION_HERE/dist/CoreUtils.min.umd.js"></script> 3<script src="https://esm.sh/@sv443-network/coreutils@INSERT_VERSION_HERE/dist/CoreUtils.min.umd.js"></script>
1// >> EcmaScript Modules (ESM): 2 3// - import parts of the library: 4import { randomItem } from "@sv443-network/coreutils"; 5// - or import the full library: 6import * as CoreUtils from "@sv443-network/coreutils"; 7// - or import raw TS files, after installing via JSR: 8import { DataStore } from "jsr:@sv443-network/coreutils/lib/DataStore.ts"; 9 10// >> CommonJS (CJS): 11 12// - import parts of the library: 13const { debounce } = require("@sv443-network/coreutils"); 14// - or import the full library: 15const CoreUtils = require("@sv443-network/coreutils"); 16 17// >> Universal Module Definition (UMD): 18 19// - to make the global variable `CoreUtils` available, import this file: 20// "@sv443-network/coreutils/dist/CoreUtils.min.umd.js" 21// - or import the library on your HTML page: 22// <script src="https://cdn.jsdelivr.net/npm/@sv443-network/coreutils@INSERT_VERSION_HERE/dist/CoreUtils.min.umd.js"></script> 23// (make sure to insert the version number above. Use 'latest' (not recommended) or a specific version, e.g. '9.4.3')
Made with ❤️ by Sv443
If you like this userscript, please consider supporting the development
© 2025 Sv443 & Sv443 Network
MIT license
No vulnerabilities found.
No security vulnerabilities found.