Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@awai/toolbox
Advanced tools
Set of tools you'll always need. So, just `npm install --save @awai/toolbox` and have it always at hand.
Set of tools you'll always need. So, just npm install --save @awai/toolbox
and have it always at hand.
Set of helper constants and methods for text processing.
Accessor | Description |
---|---|
empty | Empty string |
englishLettersOrdered | Ordered set of lowercase English letters |
Method | Description |
---|---|
capitalize(str: string) | Return a copy of the string with its first character capitalized and the rest lowercased |
isAlpha(str: string) | Return true if all characters in the string are alpha only |
isControl(char: string) | Return true if char is ASCII control symbol |
isDomainName(str: string) | Return true if string looks like a valid domain name |
isEmail(str: string) | Return true if string is a valid email address |
isIp(str: string) | Return true if string is a valid IP address |
isLower(str: string) | Return true if all characters in the string are lowercase |
isNullOrEmpty(str: string) | Return true if a specified string is null or empty |
isNullOrWhiteSpace(str: string) | Return true if a specified string is null, empty, or consists only of white-space characters |
isNumber(str: string) | Return true if all characters in the string are digits only |
isUpper(str: string) | Return true if all characters in the string are uppercase |
parseNumBool(str: string) | Try to find number or boolean value in a provided string and return converted value |
random(size: number, alphaLower, alphaUpper, decimal) | Generate alpha numeric random sequence string |
splitLines(str: string) | Return an array of the lines in the string, breaking at line boundaries |
swapCase(str: string) | Return a copy of the string with uppercase characters converted to lowercase and vice versa |
wrapInHtmlTag(str: string, term: string, tagName: string, tagClasses: string[]) | Return source text with "term" wrapped by specified HTML tag |
Provides a set of helper methods for arrays.
Accessor | Description |
---|---|
englishLettersOrdered | Ordered set of lowercase English letters |
englishLettersUppercaseOrdered | Ordered set of upercase English letters |
Method | Description |
---|---|
bytesToFloat(bytes: Uint8Array) | Convert array of bytes into array of floats within range [0.0, 1.0] |
first(arr: Array) | Return the first element of a specified array |
isNullOrEmpty(arr: Array) | Return true if a specified array is null or empty |
last(arr: Array) | Return the last element of a specified array |
range(size: number, start: number) | Return array filled by range of integers |
removeEmptyStrings(arr: string[]) | Remove empty string elements from string array |
shuffle(arr: Array) | Shuffle the array by method Fisher–Yates |
stringToCharArray(str: string) | Convert string into array of chars |
Provides a set of helper methods to generate cryptographically strong random values.
Method | Description |
---|---|
nextBytes(size: number) | Return array of random bytes |
nextBytesAsync(size: number) | Return promise that resolves to array of random bytes |
Method | Description |
---|---|
nextFloat(qty: number) | Return a random floating-point number or array of random floating-point numbers that is greater than or equal to 0.0, and less than 1.0 |
nextFloatAsync(qty: number) | Return a promise that resolves to random floating-point number or array of random floating-point numbers that is greater than or equal to 0.0, and less than 1.0 |
nextInt(min: number, max: number, qty: number) | Return a random integer or array of random integers that is within a specified range |
nextIntAsync(min: number, max: number, qty: number) | Return a promise that resolves to random integer or array of random integers that is within a specified range |
The Url class is used to parse or create from 0 the URL. It gives you different property accessors that allow you easily access or set parts of the URL. Create the Url instance with the uri string or empty to construct it from zero.
Method | Description |
---|---|
isUrl(value: string) | Return true if provided value can be parsed as valid URI |
toString() | Return string representation of the whole URL |
toURL() | Return URL object |
Accessor | Description |
---|---|
protocol | IANA-registered scheme or protocol |
domain | Name of the domain or IP address |
port | IP port number |
username | Username for HTTP Authentication |
password | Password for HTTP Authentication |
pathString | Route path in form /route/path |
pathParams | Route path as array of its parts |
path | Route path in form /route/path |
queryParams | Map of query params as a key - value. Values are parsed as strings, numbers and booleans |
hashFragment | Hash fragment |
isSsl | Return true if SSL is used |
Run nx test toolbox
to execute the unit tests via Jest.
FAQs
Set of tools you'll always need. So, just `npm install --save @awai/toolbox` and have it always at hand.
The npm package @awai/toolbox receives a total of 0 weekly downloads. As such, @awai/toolbox popularity was classified as not popular.
We found that @awai/toolbox demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.