Module: util
Variables
charSets
• Const
charSets: Object
Predefined char sets for generating randing strings
Type declaration
Name | Type |
---|---|
alpha |
string |
alphanum |
string |
full |
string |
hexa |
string |
num |
string |
Defined in
chars
• Const
chars: Object
Caracters, by category
Type declaration
Name | Type |
---|---|
lower |
string |
numbers |
string |
other |
string |
upper |
string |
Defined in
Functions
applyMixins
▸ applyMixins(baseClass
, ...mixins
): any
Applies a number of class mixins
to a baseClass
Parameters
Name | Type |
---|---|
baseClass |
any |
...mixins |
(cls : any ) => any [] |
Returns
any
Defined in
capitalize
▸ capitalize(string
): string
Parameters
Name | Type |
---|---|
string |
string |
Returns
string
Defined in
debounce
▸ debounce(fn
, delay
): (...args
: any
[]) => void
"Debounces" a function, making sure it is only called once within a certain time window
Parameters
Name | Type |
---|---|
fn |
(...args : any []) => any |
delay |
number |
Returns
fn
▸ (...args
): void
Parameters
Name | Type |
---|---|
...args |
any [] |
Returns
void
Defined in
escapeRegex
▸ escapeRegex(str
): string
Escapes all regex special characters within a given string.
Parameters
Name | Type |
---|---|
str |
string |
Returns
string
Defined in
getIdFromEmail
▸ getIdFromEmail(email
): Promise
<string
>
Parameters
Name | Type |
---|---|
email |
string |
Returns
Promise
<string
>
Defined in
randomNumber
▸ randomNumber(min?
, max?
): Promise
<number
>
Generates a random number between min
and max
.
Taken from https://github.com/EFForg/OpenWireless/blob/master/app/js/diceware.js
Parameters
Name | Type | Default value |
---|---|---|
min |
number |
0 |
max |
number |
10 |
Returns
Promise
<number
>
Defined in
randomString
▸ randomString(length?
, charSet?
): Promise
<string
>
Creates a random string with a given length
, with characters chosen from a given charSet
Parameters
Name | Type | Default value |
---|---|---|
length |
number |
32 |
charSet |
string |
charSets.full |
Returns
Promise
<string
>
Defined in
removeTrailingSlash
▸ removeTrailingSlash(url
): string
Parameters
Name | Type |
---|---|
url |
string |
Returns
string
Defined in
resolveLanguage
▸ resolveLanguage(locale
, supportedLanguages
): string
Resolves a given locale string to the approprivate available language
Parameters
Name | Type |
---|---|
locale |
string |
supportedLanguages |
Object |
Returns
string
Defined in
setPath
▸ setPath(obj
, path
, value
): void
Parameters
Name | Type |
---|---|
obj |
any |
path |
string |
value |
any |
Returns
void
Defined in
stripPropertiesRecursive
▸ stripPropertiesRecursive(obj
, properties
): object
Parameters
Name | Type |
---|---|
obj |
object |
properties |
string [] |
Returns
object
Defined in
throttle
▸ throttle(fn
, delay
): (...args
: any
[]) => void
Parameters
Name | Type |
---|---|
fn |
(...args : any []) => any |
delay |
number |
Returns
fn
▸ (...args
): void
Parameters
Name | Type |
---|---|
...args |
any [] |
Returns
void
Defined in
truncate
▸ truncate(str
, len
): string
Parameters
Name | Type |
---|---|
str |
string |
len |
number |
Returns
string
Defined in
uuid
▸ uuid(): Promise
<string
>
Generates a random UUID v4
Returns
Promise
<string
>
Defined in
wait
▸ wait(delay
): Promise
<void
>
Returns a promise that resolves after a given delay
.
Parameters
Name | Type |
---|---|
delay |
number |
Returns
Promise
<void
>