Module: utils
Type Aliases
Parseable
Ƭ Parseable: string
| number
| boolean
| null
| undefined
| Record
<string
, unknown
>
A value that can be stringified using one of the util functions.
Defined in
DeepRequired
Ƭ DeepRequired<T
>: { [P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : NonNullable<T[P]> }
A type that makes all properties of an object required, recursively.
Type parameters
Name |
---|
T |
Defined in
Functions
strConcat
▸ strConcat(...strs
): string
Concatenates strings, arrays of strings, and objects with truthy values.
It works recursively, so adding an array of strings to an array of strings will work.
Falsy values are ignored, so pasing undefined
or null
will not add anything to the result,
and using a boolean will only add it if it is true
. Using 0 will also not add anything.
Parameters
Name | Type |
---|---|
...strs | (Parseable | Parseable [])[] |
Returns
string
Defined in
indent
▸ indent(str
, indent?
): string
Indents a string or an array of strings. Concatenates them all using strConcat
.
Parameters
Name | Type | Default value |
---|---|---|
str | Parseable | Parseable [] | undefined |
indent | number | 2 |
Returns
string
Defined in
capitalize
▸ capitalize(str
): string
Parameters
Name | Type |
---|---|
str | string |
Returns
string
Defined in
splitWords
▸ splitWords(str
): string
[]
Splits a name into words, using camelCase, PascalCase, snake_case, and kebab-case or regular spaced strings.
Parameters
Name | Type |
---|---|
str | string |
Returns
string
[]
Defined in
toCamelCase
▸ toCamelCase(str
): string
Parameters
Name | Type |
---|---|
str | string |
Returns
string
Defined in
toPascalCase
▸ toPascalCase(str
): string
Parameters
Name | Type |
---|---|
str | string |
Returns
string
Defined in
getErrorMessage
▸ getErrorMessage(err
): string
Parameters
Name | Type |
---|---|
err | unknown |
Returns
string