Skip to main content

Kreya base script API reference

The following Kreya APIs are available in all Kreya scripts and Kreya operation scripts under the kreya namespace. These can be accessed directly through the kreya object:

kreya.trace('Hello world!');

Variables​

environment​

const environment: EnvironmentContainerScriptApi;

EnvironmentContainerScriptApi
Gets APIs related to the Kreya environment.


faker​

const faker: FakerScriptApi;

FakerScriptApi
The faker API to generate fake data.


preview​

const preview: PreviewScriptApi;

PreviewScriptApi
Gets APIs to preview files in Kreya.


snapshot​

const snapshot: SnapshotScriptApi;

SnapshotScriptApi
Gets APIs to assert snapshots.


variables​

const variables: UserVariablesScriptApi;

UserVariablesScriptApi
Gets the storage to set and retrieve custom variables, which are accessible in other operations and via templating.

Functions​

sleep()​

function sleep(millisecondsTimeout: number): void;

Sleeps for a certain length of time.

Parameters​

ParameterTypeDescription
millisecondsTimeoutnumberMilliseconds to sleep.

Returns​

void

Deprecated​

This blocks the entire scripting thread. Use kreya.wait instead, which returns a promise.


test()​

Call Signature​

function test(name: string, ok: boolean): void;

Reports a test result.

Parameters​
ParameterTypeDescription
namestringA descriptive name of the test.
okbooleanWhether the test was successful.
Returns​

void

Call Signature​

function test(name: string, callback: () => void): Promise<void>;

Runs a test.

Parameters​
ParameterTypeDescription
namestringA descriptive name of the test.
callback() => voidThe test code. The test is considered successful if the callback does not throw.
Returns​

Promise<void>

Call Signature​

function test(name: string, callback: () => boolean): Promise<void>;

Runs a test.

Parameters​
ParameterTypeDescription
namestringA descriptive name of the test.
callback() => booleanThe test code returning whether the test was successful.
Returns​

Promise<void>

Call Signature​

function test(name: string, callback: () => Promise<void>): Promise<void>;

Runs a test.

Parameters​
ParameterTypeDescription
namestringA descriptive name of the test.
callback() => Promise<void>The test code. The test is considered successful if the callback does not throw.
Returns​

Promise<void>

Call Signature​

function test(name: string, callback: () => Promise<boolean>): Promise<void>;

Runs a test.

Parameters​
ParameterTypeDescription
namestringA descriptive name of the test.
callback() => Promise<boolean>The test code returning whether the test was successful.
Returns​

Promise<void>

Call Signature​

function test(name: string, callback: () => void): void;

Runs a test.

Parameters​
ParameterTypeDescription
namestringA descriptive name of the test.
callback() => voidThe test code.
Returns​

void


trace()​

function trace(message: any): void;

Adds a trace message to the Kreya trace log.

Parameters​

ParameterTypeDescription
messageanyThe message to log.

Returns​

void


wait()​

function wait(millisecondsTimeout: number): Promise<void>;

Waits for a certain length of time without blocking the scripting thread.

Parameters​

ParameterTypeDescription
millisecondsTimeoutnumberMilliseconds to wait.

Returns​

Promise<void>

A promise that resolves after the given time has elapsed.

Type Aliases​

EnvironmentContainerScriptApi​

type EnvironmentContainerScriptApi = {
active: EnvironmentScriptApi;
};

APIs related to the Kreya environment.

Properties​

active​
readonly active: EnvironmentScriptApi;

Access to the active Kreya environment.


EnvironmentScriptApi​

type EnvironmentScriptApi = {
content: {
};
id: string;
name: string;
};

APIs to access the environment.

Properties​

content​
readonly content: {
};

Gets the content JSON of the environment.

id​
readonly id: string;

Gets the unique id of the environment.

name​
readonly name: string;

Gets the name of the environment.


FakerAddress​

type FakerAddress = {
locale: string;
random: FakerRandomizer;
buildingNumber: string;
cardinalDirection: string;
city: string;
cityPrefix: string;
citySuffix: string;
country: string;
countryCode: string;
county: string;
direction: string;
fullAddress: string;
latitude: number;
longitude: number;
ordinalDirection: string;
secondaryAddress: string;
state: string;
stateAbbr: string;
streetAddress: string;
streetName: string;
streetSuffix: string;
zipCode: string;
};

Methods for generating an address.

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

buildingNumber()​
buildingNumber(): string;

Get a building number.

Returns​

string

A random building number.

cardinalDirection()​
cardinalDirection(useAbbreviation?: boolean): string;

Generates a cardinal direction. IE: North, South, E, W.

Parameters​
ParameterTypeDescription
useAbbreviation?booleanWhen true, directions such as West turn into W.
Returns​

string

A random cardinal direction

city()​
city(): string;

Get a city name.

Returns​

string

A random city name.

cityPrefix()​
cityPrefix(): string;

Get a city prefix.

Returns​

string

A random city prefix.

citySuffix()​
citySuffix(): string;

Get a city suffix.

Returns​

string

A random city suffix.

country()​
country(): string;

Get a country.

Returns​

string

A random country.

countryCode()​
countryCode(): string;

Get a random ISO 3166-1 country code.

Returns​

string

A random country code.

county()​
county(): string;

Get a county.

Returns​

string

A random county.

direction()​
direction(useAbbreviation?: boolean): string;

Generates a cardinal or ordinal direction. IE: Northwest, South, SW, E.

Parameters​
ParameterTypeDescription
useAbbreviation?booleanWhen true, directions such as Northwest turn into NW.
Returns​

string

A random cardinal or ordinal direction.

fullAddress()​
fullAddress(): string;

Get a full address like Street, City, Country.

Returns​

string

A random full address.

latitude()​
latitude(min?: number, max?: number): number;

Get a Latitude.

Parameters​
ParameterTypeDescription
min?numberThe minimum value.
max?numberThe maximum value.
Returns​

number

A random latitude value.

longitude()​
longitude(min?: number, max?: number): number;

Get a Longitude.

Parameters​
ParameterTypeDescription
min?numberThe minimum value.
max?numberThe maximum value.
Returns​

number

A random longitude value.

ordinalDirection()​
ordinalDirection(useAbbreviation?: boolean): string;

Generates an ordinal direction. IE: Northwest, Southeast, SW, NE.

Parameters​
ParameterTypeDescription
useAbbreviation?booleanWhen true, directions such as Northwest turn into NW.
Returns​

string

A random ordinal direction.

secondaryAddress()​
secondaryAddress(): string;

Get a secondary address like 'Apt. 2' or 'Suite 321'.

Returns​

string

A random secondary address.

state()​
state(): string;

Get a random state state.

Returns​

string

A random state.

stateAbbr()​
stateAbbr(): string;

Get a state abbreviation.

Returns​

string

An abbreviation for a random state.

streetAddress()​
streetAddress(useFullAddress?: boolean): string;

Get a street address.

Parameters​
ParameterTypeDescription
useFullAddress?boolean.
Returns​

string

A random street address.

streetName()​
streetName(): string;

Get a street name.

Returns​

string

A random street name.

streetSuffix()​
streetSuffix(): string;

Get a street suffix.

Returns​

string

A random street suffix.

zipCode()​
zipCode(format?: string): string;

Get a zipcode.

Parameters​
ParameterTypeDescription
format?stringIf a format is provided it will fill the format with letters and numbers. Example "???? ##" can become "QYTE 78".
Returns​

string

A random zipcode.


FakerCommerce​

type FakerCommerce = {
locale: string;
random: FakerRandomizer;
categories: string[];
color: string;
department: string;
ean13: string;
ean8: string;
price: string;
product: string;
productAdjective: string;
productDescription: string;
productMaterial: string;
productName: string;
};

Methods relating to commerce.

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

categories()​
categories(num: number): string[];

Get random product categories.

Parameters​
ParameterTypeDescription
numnumberThe amount of categories to be generated.
Returns​

string[]

A collection of random product categories.

color()​
color(): string;

Get a random color.

Returns​

string

A random color.

department()​
department(max?: number, returnMax?: boolean): string;

Get a random commerce department.

Parameters​
ParameterTypeDescription
max?numberThe maximum amount of departments
returnMax?booleanIf true the method returns the max amount of values, otherwise the number of categories returned is between 1 and max.
Returns​

string

A random commerce department.

ean13()​
ean13(): string;

Get a random EAN-13 barcode number.

Returns​

string

A random EAN-13 barcode number.

ean8()​
ean8(): string;

Get a random EAN-8 barcode number.

Returns​

string

A random EAN-8 barcode number.

price()​
price(
min?: number,
max?: number,
decimals?: number,
symbol?: string): string;

Get a random product price.

Parameters​
ParameterTypeDescription
min?numberThe minimum price.
max?numberThe maximum price.
decimals?numberHow many decimals the number may include.
symbol?stringThe symbol in front of the price.
Returns​

string

A randomly generated price.

product()​
product(): string;

Get a random product.

Returns​

string

A random product.

productAdjective()​
productAdjective(): string;

Random product adjective.

Returns​

string

A random product adjective.

productDescription()​
productDescription(): string;

Random product description.

Returns​

string

A random product description.

productMaterial()​
productMaterial(): string;

Random product material.

Returns​

string

A random product material.

productName()​
productName(): string;

Get a random product name.

Returns​

string

A random product name.


FakerCompany​

type FakerCompany = {
locale: string;
random: FakerRandomizer;
bs: string;
catchPhrase: string;
companyName: string;
companySuffix: string;
};

Generates a random company name and phrases

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

bs()​
bs(): string;

Get a company BS phrase.

Returns​

string

A random company BS phrase.

catchPhrase()​
catchPhrase(): string;

Get a company catch phrase.

Returns​

string

A random company catch phrase.

companyName()​
Call Signature​
companyName(formatIndex?: number): string;

Get a company name.

Parameters​
ParameterTypeDescription
formatIndex?number0: name + suffix, 1: name-name, 2: name, name and name."
Returns​

string

A random company name.

Call Signature​
companyName(format: string): string;

Get a company name. The format can use any name.* and company.* methods.

Parameters​
ParameterTypeDescription
formatstringExample: "{{name.lastName}} {{company.companySuffix}}"
Returns​

string

A random company name in the given format.

companySuffix()​
companySuffix(): string;

Get a company suffix. "Inc" and "LLC" etc.

Returns​

string

A random company suffix.


FakerCurrency​

type FakerCurrency = {
code: string;
description: string;
symbol: string;
};

Represents a currency

Properties​

code​
code: string;

The currency code. IE: USD.

description​
description: string;

The long for description of the currency. IE: "US Dollar"

symbol​
symbol: string;

The currency symbol. IE: $


FakerDatabase​

type FakerDatabase = {
locale: string;
random: FakerRandomizer;
collation: string;
column: string;
engine: string;
type: string;
};

Generates some random database stuff.

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

collation()​
collation(): string;

Generates a collation.

Returns​

string

A random collation.

column()​
column(): string;

Generates a column name.

Returns​

string

A random column name.

engine()​
engine(): string;

Generates a storage engine.

Returns​

string

A random storage engine.

type()​
type(): string;

Generates a column type.

Returns​

string

A random column type.


FakerDate​

type FakerDate = {
locale: string;
random: FakerRandomizer;
between: Date;
future: Date;
month: string;
past: Date;
recent: Date;
soon: Date;
timeZoneString: string;
weekday: string;
};

Methods for generating dates

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

between()​
between(start: Date, end: Date): Date;

Get a random DateTime between start and end.

Parameters​
ParameterTypeDescription
startDateis used from this parameter.
endDateEnd time
Returns​

Date

future()​
future(yearsToGoForward?: number, refDate?: Date): Date;

Get a DateTime in the future between refDate and yearsToGoForward.

Parameters​
ParameterTypeDescription
yearsToGoForward?number. Default is 1 year.
refDate?Date.
Returns​

Date

month()​
month(abbreviation?: boolean, useContext?: boolean): string;

Get a random month.

Parameters​
ParameterTypeDescription
abbreviation?boolean-
useContext?boolean-
Returns​

string

past()​
past(yearsToGoBack?: number, refDate?: Date): Date;

Get a DateTime in the past between refDate and yearsToGoBack.

Parameters​
ParameterTypeDescription
yearsToGoBack?number. Default is 1 year.
refDate?Date.
Returns​

Date

recent()​
recent(days?: number, refDate?: Date): Date;

Get a random DateTime within the last few days.

Parameters​
ParameterTypeDescription
days?numberNumber of days to go back.
refDate?Date.
Returns​

Date

soon()​
soon(days?: number, refDate?: Date): Date;

Get a DateTime that will happen soon.

Parameters​
ParameterTypeDescription
days?numberahead.
refDate?Date.
Returns​

Date

timeZoneString()​
timeZoneString(): string;

Get a timezone string. Eg: America/Los_Angeles

Returns​

string

weekday()​
weekday(abbreviation?: boolean, useContext?: boolean): string;

Get a random weekday.

Parameters​
ParameterTypeDescription
abbreviation?boolean-
useContext?boolean-
Returns​

string


FakerFinance​

type FakerFinance = {
locale: string;
random: FakerRandomizer;
account: string;
accountName: string;
amount: number;
bic: string;
bitcoinAddress: string;
creditCardCvv: string;
currency: FakerCurrency;
ethereumAddress: string;
iban: string;
litecoinAddress: string;
routingNumber: string;
transactionType: string;
};

Provides financial randomness.

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

account()​
account(length?: number): string;

Get an account number. Default length is 8 digits.

Parameters​
ParameterTypeDescription
length?numberThe length of the account number.
Returns​

string

accountName()​
accountName(): string;

Get an account name. Like "savings", "checking", "Home Loan" etc..

Returns​

string

amount()​
amount(
min?: number,
max?: number,
decimals?: number): number;

Get a random amount. Default 0 - 1000.

Parameters​
ParameterTypeDescription
min?numberMin value. Default 0.
max?numberMax value. Default 1000.
decimals?numberDecimal places. Default 2.
Returns​

number

bic()​
bic(): string;

Generates Bank Identifier Code (BIC) code.

Returns​

string

bitcoinAddress()​
bitcoinAddress(): string;

Generates a random Bitcoin address.

Returns​

string

creditCardCvv()​
creditCardCvv(): string;

Generate a credit card CVV.

Returns​

string

currency()​
currency(includeFundCodes?: boolean): FakerCurrency;

Get a random currency.

Parameters​
ParameterTypeDescription
includeFundCodes?boolean-
Returns​

FakerCurrency

ethereumAddress()​
ethereumAddress(): string;

Generate a random Ethereum address.

Returns​

string

iban()​
iban(formatted?: boolean, countryCode?: string): string;

Generates an International Bank Account Number (IBAN).

Parameters​
ParameterTypeDescription
formatted?booleanFormatted IBAN containing spaces.
countryCode?stringA two letter ISO3166 country code. Throws an exception if the country code is not found or is an invalid length.
Returns​

string

litecoinAddress()​
litecoinAddress(): string;

Generate a random Litecoin address.

Returns​

string

routingNumber()​
routingNumber(): string;

Generates an ABA routing number with valid check digit.

Returns​

string

transactionType()​
transactionType(): string;

Get a transaction type: "deposit", "withdrawal", "payment", or "invoice".

Returns​

string


FakerHacker​

type FakerHacker = {
locale: string;
random: FakerRandomizer;
abbreviation: string;
adjective: string;
ingVerb: string;
noun: string;
phrase: string;
verb: string;
};

Hackerish words

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

abbreviation()​
abbreviation(): string;

Returns an abbreviation.

Returns​

string

A random abbreviation.

adjective()​
adjective(): string;

Returns a adjective.

Returns​

string

A random adjective.

ingVerb()​
ingVerb(): string;

Returns a verb ending with -ing.

Returns​

string

A random -ing verb.

noun()​
noun(): string;

Returns a noun.

Returns​

string

A random noun.

phrase()​
phrase(): string;

Returns a phrase.

Returns​

string

A random phrase.

verb()​
verb(): string;

Returns a verb.

Returns​

string

A random verb.


FakerImages​

type FakerImages = {
locale: string;
random: FakerRandomizer;
dataUri: string;
loremFlickrUrl: string;
picsumUrl: string;
placeholderUrl: string;
placeImgUrl: string;
};

Generates images URLs.

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

dataUri()​
dataUri(
width: number,
height: number,
htmlColor?: string): string;

Get a SVG data URI image with a specific width and height.

Parameters​
ParameterTypeDescription
widthnumberWidth of the image.
heightnumberHeight of the image.
htmlColor?stringAn html color in named format 'grey', RGB format 'rgb(r,g,b)', or hex format '#888888'.
Returns​

string

loremFlickrUrl()​
loremFlickrUrl(
width?: number,
height?: number,
keywords?: string,
grascale?: boolean,
matchAllKeywords?: boolean,
lockId?: number): string;

Get an image from https://loremflickr.com service.

Parameters​
ParameterTypeDescription
width?numberThe image width.
height?numberThe image height.
keywords?stringSpace or comma delimited list of keywords you want the picture to contain. IE: "cat, dog" for images with cats and dogs.
grascale?booleanGrayscale the image.
matchAllKeywords?booleanTrue tries to match an image with all specified keywords. False tries to match an image with any specified keyword.
lockId?numberDeterministic image id. By default, this method generates URLs with image lock ids. So, if a random seed is set, repeat runs of this method will generate the same lock id sequence for images. If you want explicit control over the lock id, you can pass it as a parameter here. Additionally, if you don't want any lock ids, pass -1 for this parameter this method will generate a URL that will result in a new random image every time the HTTP URL is hit.
Returns​

string

picsumUrl()​
picsumUrl(
width?: number,
height?: number,
grayscale?: boolean,
blur?: boolean,
imageId?: number): string;

Get an image from the https://picsum.photos service.

Parameters​
ParameterTypeDescription
width?numberWidth of the image.
height?numberHeight of the image.
grayscale?booleanGrayscale (no color) image.
blur?booleanBlurry image.
imageId?numberOptional Image ID found here https://picsum.photos/images
Returns​

string

placeholderUrl()​
placeholderUrl(
width: number,
height: number,
text?: string,
backColor?: string,
textColor?: string,
format?: string): string;

Get an image from https://placehold.co service.

Parameters​
ParameterTypeDescription
widthnumberWidth of the image.
heightnumberHeight of the image.
text?string-
backColor?stringHTML color code for the background color.
textColor?stringHTML color code for the foreground (text) color.
format?stringImage format. Supported values: 'jpg', 'jpeg', 'png', 'gif', 'webp'.
Returns​

string

placeImgUrl()​
placeImgUrl(
width?: number,
height?: number,
category?: string): string;

Get an image from the https://placeimg.com service.

Parameters​
ParameterTypeDescription
width?numberWidth of the image.
height?numberHeight of the image.
category?stringfor string categories.
Returns​

string


FakerInternet​

type FakerInternet = {
locale: string;
random: FakerRandomizer;
avatar: string;
color: string;
domainName: string;
domainSuffix: string;
domainWord: string;
email: string;
exampleEmail: string;
ip: string;
ipv6: string;
mac: string;
password: string;
port: number;
protocol: string;
url: string;
urlRootedPath: string;
urlWithPath: string;
userAgent: string;
userName: string;
userNameUnicode: string;
};

Random Internet things like email addresses

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

avatar()​
avatar(ipfsGatewayRootUrl?: string): string;

Generates a legit Internet URL avatar from twitter accounts.

Parameters​
ParameterTypeDescription
ipfsGatewayRootUrl?stringA root IPFS Gateway URL. Default is 'https://ipfs.io'. Other examples include passing 'https://gateway.pinata.cloud' or 'https://dweb.link', or any other public IPFS gateway found here: https://ipfs.github.io/public-gateway-checker/. This parameter is used in case the default public IPFS gateway used in Bogus (https://ipfs.io) goes down or an alternative IPFS public or private gateway is needed.
Returns​

string

A string containing a URL avatar from twitter accounts. This URL parameter should not contain any trailing '/'.

color()​
color(
baseRed?: number,
baseGreen?: number,
baseBlue?: number,
grayscale?: boolean): string;

Gets a random aesthetically pleasing color near the base RGB. See here.

Parameters​
ParameterTypeDescription
baseRed?numberRed base color
baseGreen?numberGreen base color
baseBlue?numberBlue base color
grayscale?booleanOutput a gray scale color
Returns​

string

A random color.

domainName()​
domainName(): string;

Generates a random domain name.

Returns​

string

A random domain name.

domainSuffix()​
domainSuffix(): string;

Generates a domain name suffix like .com, .net, .org

Returns​

string

A random domain suffix.

domainWord()​
domainWord(): string;

Generates a domain word used for domain names.

Returns​

string

A random domain word.

email()​
email(
firstName?: string,
lastName?: string,
provider?: string,
uniqueSuffix?: string): string;

Generates an email address.

Parameters​
ParameterTypeDescription
firstName?stringAlways use this first name.
lastName?stringSometimes used depending on randomness. See 'UserName'.
provider?stringAlways use the provider.
uniqueSuffix?stringvalue each time before calling this method to ensure that email accounts that are generated are totally unique.
Returns​

string

An email address

exampleEmail()​
exampleEmail(firstName?: string, lastName?: string): string;

Generates an example email with @example.com.

Parameters​
ParameterTypeDescription
firstName?stringOptional: first name of the user.
lastName?stringOptional: last name of the user.
Returns​

string

An example email ending with @example.com.

ip()​
ip(): string;

Gets a random IPv4 address string.

Returns​

string

A random IPv4 address.

ipv6()​
ipv6(): string;

Generates a random IPv6 address string.

Returns​

string

A random IPv6 address.

mac()​
mac(separator?: string): string;

Gets a random mac address.

Parameters​
ParameterTypeDescription
separator?stringThe string the mac address should be separated with.
Returns​

string

A random mac address.

password()​
password(
length?: number,
memorable?: boolean,
regexPattern?: string,
prefix?: string): string;

Generates a random password.

Parameters​
ParameterTypeDescription
length?numberLength of the password.
memorable?booleanA memorable password (ie: all lower case).
regexPattern?stringRegex pattern that the password should follow.
prefix?stringPassword prefix.
Returns​

string

A random password.

port()​
port(): number;

Generates a random port number.

Returns​

number

A random port number

protocol()​
protocol(): string;

Returns a random protocol. HTTP or HTTPS.

Returns​

string

A random protocol.

url()​
url(): string;

Generates a random URL.

Returns​

string

A random URL.

urlRootedPath()​
urlRootedPath(fileExt?: string): string;

Get a rooted URL path like: /foo/bar. Optionally with file extension.

Parameters​
ParameterTypeDescription
fileExt?stringis null, then a rooted URL directory is returned.
Returns​

string

Returns a rooted URL path like: /foo/bar; optionally with a file extension.

urlWithPath()​
urlWithPath(
protocol?: string,
domain?: string,
fileExt?: string): string;

Get an absolute URL with random path.

Parameters​
ParameterTypeDescription
protocol?stringProtocol part of the URL, random if null
domain?stringDomain part of the URL, random if null
fileExt?stringThe file extension to use in the path, directory if null
Returns​

string

An URL with a random path.

userAgent()​
userAgent(): string;

Generates a random user agent.

Returns​

string

A random user agent.

userName()​
userName(firstName?: string, lastName?: string): string;

Generates user names.

Parameters​
ParameterTypeDescription
firstName?stringFirst name is always part of the returned user name.
lastName?stringLast name may or may not be used.
Returns​

string

A random user name.

userNameUnicode()​
userNameUnicode(firstName?: string, lastName?: string): string;

Generates a user name preserving Unicode characters.

Parameters​
ParameterTypeDescription
firstName?stringFirst name is always part of the returned user name.
lastName?stringLast name may or may not be used.
Returns​

string


FakerLorem​

type FakerLorem = {
locale: string;
random: FakerRandomizer;
letter: string;
lines: string;
paragraph: string;
paragraphs: string;
sentence: string;
sentences: string;
slug: string;
text: string;
word: string;
words: string[];
};

Generates plain old boring text.

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

letter()​
letter(num?: number): string;

Get a character letter.

Parameters​
ParameterTypeDescription
num?numberThe number of characters to return.
Returns​

string

lines()​
lines(lineCount?: number, separator?: string): string;

Get lines of lorem.

Parameters​
ParameterTypeDescription
lineCount?numberThe amount of lines to generate. Defaults between 1 and 5.
separator?stringThe string to separate the lines.
Returns​

string

paragraph()​
paragraph(min?: number): string;

Get a paragraph.

Parameters​
ParameterTypeDescription
min?numbermethod.
Returns​

string

paragraphs()​
Call Signature​
paragraphs(count?: number, separator?: string): string;

Get a specified number of paragraphs.

Parameters​
ParameterTypeDescription
count?numberNumber of paragraphs.
separator?stringThe string to separate paragraphs.
Returns​

string

Call Signature​
paragraphs(
min: number,
max: number,
separator?: string): string;

Get a random number of paragraphs between min and max.

Parameters​
ParameterTypeDescription
minnumberMinimum number of paragraphs.
maxnumberMaximum number of paragraphs.
separator?stringThe string to separate the paragraphs.
Returns​

string

sentence()​
sentence(wordCount?: number, range?: number): string;

Get a random sentence of specific number of words.

Parameters​
ParameterTypeDescription
wordCount?numberGet a sentence with wordCount words. Defaults between 3 and 10.
range?numberAdd anywhere between 0 to 'range' additional words to wordCount. Default is 0.
Returns​

string

sentences()​
sentences(sentenceCount?: number, separator?: string): string;

Get some sentences.

Parameters​
ParameterTypeDescription
sentenceCount?numberThe number of sentences.
separator?stringThe string to separate sentences.
Returns​

string

slug()​
slug(wordcount?: number): string;

Slugify lorem words.

Parameters​
ParameterTypeDescription
wordcount?numberThe amount of words to slugify.
Returns​

string

text()​
text(): string;

Get random text on a random lorem methods.

Returns​

string

word()​
word(): string;

Get a random lorem word.

Returns​

string

words()​
words(num?: number): string[];

Get an array of random lorem words.

Parameters​
ParameterTypeDescription
num?numberThe number of random lorem words to return.
Returns​

string[]


FakerMusic​

type FakerMusic = {
locale: string;
random: FakerRandomizer;
genre: string;
};

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

genre()​
genre(): string;

Get a music genre

Returns​

string


FakerName​

type FakerName = {
item: FakerName;
locale: string;
random: FakerRandomizer;
findName: string;
firstName: string;
fullName: string;
jobArea: string;
jobDescriptor: string;
jobTitle: string;
jobType: string;
lastName: string;
prefix: string;
suffix: string;
};

Methods for generating names

Properties​

item​
readonly item: FakerName;
locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

findName()​
findName(
firstName?: string,
lastName?: string,
withPrefix?: boolean,
withSuffix?: boolean): string;

Gets a full name.

Parameters​
ParameterTypeDescription
firstName?stringUse this first name.
lastName?stringuse this last name.
withPrefix?booleanAdd a prefix?
withSuffix?booleanAdd a suffix?
Returns​

string

firstName()​
firstName(): string;

Get a first name. Getting a gender specific name is only supported on locales that support it.

Returns​

string

fullName()​
fullName(): string;

Get a full name, concatenation of calling FirstName and LastName.

Returns​

string

jobArea()​
jobArea(): string;

Get a job area expertise.

Returns​

string

jobDescriptor()​
jobDescriptor(): string;

Get a job description.

Returns​

string

jobTitle()​
jobTitle(): string;

Gets a random job title.

Returns​

string

jobType()​
jobType(): string;

Get a type of job.

Returns​

string

lastName()​
lastName(): string;

Get a last name. Getting a gender specific name is only supported on locales that support it.

Returns​

string

prefix()​
prefix(): string;

Gets a random prefix for a name.

Returns​

string

suffix()​
suffix(): string;

Gets a random suffix for a name.

Returns​

string


FakerPhoneNumbers​

type FakerPhoneNumbers = {
locale: string;
random: FakerRandomizer;
phoneNumber: string;
phoneNumberFormat: string;
};

Generates phone numbers

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

phoneNumber()​
phoneNumber(format?: string): string;

Get a phone number.

Parameters​
ParameterTypeDescription
format?stringFormat of phone number in any format. Replaces # characters with numbers. IE: '###-###-####' or '(###) ###-####'.
Returns​

string

A random phone number.

phoneNumberFormat()​
phoneNumberFormat(phoneFormatsArrayIndex?: number): string;

Gets a phone number based on the locale's phone_number.formats[] array index.

Parameters​
ParameterTypeDescription
phoneFormatsArrayIndex?numberThe array index as defined in the locale's phone_number.formats[] array.
Returns​

string

A random phone number.


FakerRandomizer​

type FakerRandomizer = {
alphaNumeric: string;
bool: boolean;
byte: number;
bytes: Uint8Array;
char: string;
chars: string[];
clampString: string;
decimal: number;
digits: number[];
double: number;
even: number;
float: number;
guid: Guid;
hash: string;
hexadecimal: string;
int: number;
long: number;
number: number;
odd: number;
randomLocale: string;
replace: string;
replaceNumbers: string;
replaceSymbols: string;
sByte: number;
short: number;
string: string;
string2: string;
uInt: number;
uLong: number;
uShort: number;
utf16String: string;
uuid: Guid;
word: string;
words: string;
wordsArray: string[];
};

A randomizer that randomizes things.

Methods​

alphaNumeric()​
alphaNumeric(length: number): string;

Returns a random set of alpha numeric characters 0-9, a-z.

Parameters​
ParameterTypeDescription
lengthnumber-
Returns​

string

bool()​
Call Signature​
bool(): boolean;

Get a random boolean.

Returns​

boolean

Call Signature​
bool(weight: number): boolean;

Get a random boolean.

Parameters​
ParameterTypeDescription
weightnumberThe probability of true. Ranges from 0 to 1.
Returns​

boolean

byte()​
byte(min?: number, max?: number): number;

Generate a random byte between 0 and 255.

Parameters​
ParameterTypeDescription
min?numberMin value, inclusive. Default byte.MinValue 0
max?numberMax value, inclusive. Default byte.MaxValue 255
Returns​

number

bytes()​
bytes(count: number): Uint8Array;

Get a random sequence of bytes.

Parameters​
ParameterTypeDescription
countnumberThe size of the byte array
Returns​

Uint8Array

char()​
char(min?: string, max?: string): string;

Generate a random char between MinValue and MaxValue.

Parameters​
ParameterTypeDescription
min?stringMin value, inclusive. Default char.MinValue
max?stringMax value, inclusive. Default char.MaxValue
Returns​

string

chars()​
chars(
min?: string,
max?: string,
count?: number): string[];

Generate a random chars between MinValue and MaxValue.

Parameters​
ParameterTypeDescription
min?stringMin value, inclusive. Default char.MinValue
max?stringMax value, inclusive. Default char.MaxValue
count?numberThe length of chars to return
Returns​

string[]

clampString()​
clampString(
str: string,
min?: number,
max?: number): string;

Clamps the length of a string between min and max characters. If the string is below the minimum, the string is appended with random characters up to the minimum length. If the string is over the maximum, the string is truncated at maximum characters; additionally, if the result string ends with whitespace, it is replaced with a random characters.

Parameters​
ParameterTypeDescription
strstring-
min?number-
max?number-
Returns​

string

decimal()​
decimal(min?: number, max?: number): number;

Get a random decimal, between 0.0 and 1.0.

Parameters​
ParameterTypeDescription
min?numberMinimum, inclusive. Default 0.0
max?numberMaximum, exclusive. Default 1.0
Returns​

number

digits()​
digits(
count: number,
minDigit?: number,
maxDigit?: number): number[];

Get a random sequence of digits.

Parameters​
ParameterTypeDescription
countnumberHow many
minDigit?numberminimum digit, inclusive
maxDigit?numbermaximum digit, inclusive
Returns​

number[]

double()​
double(min?: number, max?: number): number;

Get a random double, between 0.0 and 1.0.

Parameters​
ParameterTypeDescription
min?numberMinimum, inclusive. Default 0.0
max?numberMaximum, exclusive. Default 1.0
Returns​

number

even()​
even(min?: number, max?: number): number;

Returns a random even number. If the range does not contain any even numbers, an ArgumentException is thrown.

Parameters​
ParameterTypeDescription
min?numberLower bound, inclusive
max?numberUpper bound, inclusive
Returns​

number

float()​
float(min?: number, max?: number): number;

Get a random float, between 0.0 and 1.0.

Parameters​
ParameterTypeDescription
min?numberMinimum, inclusive. Default 0.0
max?numberMaximum, inclusive. Default 1.0
Returns​

number

guid()​
guid(): Guid;

Get a random GUID.

Returns​

Guid

hash()​
hash(length?: number, upperCase?: boolean): string;

Return a random hex hash. Default 40 characters, aka SHA-1.

Parameters​
ParameterTypeDescription
length?numberThe length of the hash string. Default, 40 characters, aka SHA-1.
upperCase?booleanReturns the hex string with uppercase characters.
Returns​

string

hexadecimal()​
hexadecimal(length?: number, prefix?: string): string;

Generates a random hexadecimal string.

Parameters​
ParameterTypeDescription
length?number-
prefix?string-
Returns​

string

int()​
int(min?: number, max?: number): number;

Generate a random int between MinValue and MaxValue.

Parameters​
ParameterTypeDescription
min?numberMin value, inclusive. Default int.MinValue
max?numberMax value, inclusive. Default int.MaxValue
Returns​

number

long()​
long(min?: number, max?: number): number;

Generate a random long between MinValue and MaxValue.

Parameters​
ParameterTypeDescription
min?numberMin value, inclusive. Default long.MinValue
max?numberMax value, inclusive. Default long.MaxValue
Returns​

number

number()​
Call Signature​
number(max: number): number;

Get an int from 0 to max.

Parameters​
ParameterTypeDescription
maxnumberUpper bound, inclusive.
Returns​

number

Call Signature​
number(min?: number, max?: number): number;

Get an int from min to max.

Parameters​
ParameterTypeDescription
min?numberLower bound, inclusive
max?numberUpper bound, inclusive
Returns​

number

odd()​
odd(min?: number, max?: number): number;

Returns a random odd number. If the range does not contain any odd numbers, an ArgumentException is thrown.

Parameters​
ParameterTypeDescription
min?numberLower bound, inclusive
max?numberUpper bound, inclusive
Returns​

number

randomLocale()​
randomLocale(): string;

Returns a random locale.

Returns​

string

replace()​
replace(format: string): string;

Replaces symbols with numbers and letters. # = number, ? = letter, * = number or letter. IE: ###???* -> 283QED4. Letters are uppercase.

Parameters​
ParameterTypeDescription
formatstring-
Returns​

string

replaceNumbers()​
replaceNumbers(format: string, symbol?: string): string;

Replaces symbols with numbers. IE: ### -> 283

Parameters​
ParameterTypeDescription
formatstringThe string format
symbol?stringThe symbol to search for in format that will be replaced with a number
Returns​

string

replaceSymbols()​
replaceSymbols(
format: string,
symbol: string,
func: () => string): string;

Replaces each character instance in a string. Func is called each time a symbol is encountered.

Parameters​
ParameterTypeDescription
formatstringThe string with symbols to replace.
symbolstringThe symbol to search for in the string.
func() => stringThe function that produces a character for replacement. Invoked each time the replacement symbol is encountered.
Returns​

string

sByte()​
sByte(min?: number, max?: number): number;

Generate a random sbyte between -128 and 127.

Parameters​
ParameterTypeDescription
min?numberMin value, inclusive. Default sbyte.MinValue -128
max?numberMax value, inclusive. Default sbyte.MaxValue 127
Returns​

number

short()​
short(min?: number, max?: number): number;

Generate a random short between MinValue and MaxValue.

Parameters​
ParameterTypeDescription
min?numberMin value, inclusive. Default short.MinValue -32768
max?numberMax value, inclusive. Default short.MaxValue 32767
Returns​

number

string()​
Call Signature​
string(
length?: number,
minChar?: string,
maxChar?: string): string;

Get a string of characters of a specific length. Uses Int32). Note: This method can return ill-formed UTF16 Unicode strings with unpaired surrogates. Use Boolean) for technically valid Unicode.

Parameters​
ParameterTypeDescription
length?numberThe exact length of the result string. If null, a random length is chosen between 40 and 80.
minChar?stringMin character value, inclusive. Default char.MinValue
maxChar?stringMax character value, inclusive. Default char.MaxValue
Returns​

string

Call Signature​
string(
minLength: number,
maxLength: number,
minChar?: string,
maxChar?: string): string;

Get a string of characters between minLength and maxLength. Uses Int32). Note: This method can return ill-formed UTF16 Unicode strings with unpaired surrogates. Use Boolean) for technically valid Unicode.

Parameters​
ParameterTypeDescription
minLengthnumberLower-bound string length. Inclusive.
maxLengthnumberUpper-bound string length. Inclusive.
minChar?stringMin character value, inclusive. Default char.MinValue
maxChar?stringMax character value, inclusive. Default char.MaxValue
Returns​

string

string2()​
Call Signature​
string2(length: number, chars?: string): string;

Get a string of characters with a specific length drawing characters from chars. The returned string may contain repeating characters from the chars string.

Parameters​
ParameterTypeDescription
lengthnumberThe length of the string to return.
chars?stringThe pool of characters to draw from. The returned string may contain repeat characters from the pool.
Returns​

string

Call Signature​
string2(
minLength: number,
maxLength: number,
chars?: string): string;

Get a string of characters with a specific length drawing characters from chars. The returned string may contain repeating characters from the chars string.

Parameters​
ParameterTypeDescription
minLengthnumberThe minimum length of the string to return, inclusive.
maxLengthnumberThe maximum length of the string to return, inclusive.
chars?stringThe pool of characters to draw from. The returned string may contain repeat characters from the pool.
Returns​

string

uInt()​
uInt(min?: number, max?: number): number;

Generate a random uint between MinValue and MaxValue.

Parameters​
ParameterTypeDescription
min?numberMin value, inclusive. Default uint.MinValue
max?numberMax value, inclusive. Default uint.MaxValue
Returns​

number

uLong()​
uLong(min?: number, max?: number): number;

Generate a random ulong between MinValue and MaxValue.

Parameters​
ParameterTypeDescription
min?numberMin value, inclusive. Default ulong.MinValue
max?numberMax value, inclusive. Default ulong.MaxValue
Returns​

number

uShort()​
uShort(min?: number, max?: number): number;

Generate a random ushort between MinValue and MaxValue.

Parameters​
ParameterTypeDescription
min?numberMin value, inclusive. Default ushort.MinValue 0
max?numberMax value, inclusive. Default ushort.MaxValue 65535
Returns​

number

utf16String()​
utf16String(
minLength?: number,
maxLength?: number,
excludeSurrogates?: boolean): string;

Get a string of valid UTF16 Unicode characters. This method returns a string where each character IsLetterOrDigit() is true.

Parameters​
ParameterTypeDescription
minLength?numberThe minimum length of the string to return, inclusive.
maxLength?numberThe maximum length of the string to return, inclusive.
excludeSurrogates?booleanExcludes surrogate pairs from the returned string.
Returns​

string

uuid()​
uuid(): Guid;

Get a random GUID. Alias for Randomizer.Guid().

Returns​

Guid

word()​
word(): string;

Returns a single word or phrase in English.

Returns​

string

words()​
words(count?: number): string;

Gets some random words and phrases in English.

Parameters​
ParameterTypeDescription
count?numberNumber of times to call Word()
Returns​

string

wordsArray()​
Call Signature​
wordsArray(min: number, max: number): string[];

Get a range of words in an array (English).

Parameters​
ParameterTypeDescription
minnumberMinimum word count, inclusive.
maxnumberMaximum word count, inclusive.
Returns​

string[]

Call Signature​
wordsArray(count: number): string[];

Get a specific number of words in an array (English).

Parameters​
ParameterTypeDescription
countnumber-
Returns​

string[]


FakerScriptApi​

type FakerScriptApi = {
address: FakerAddress;
commerce: FakerCommerce;
company: FakerCompany;
database: FakerDatabase;
date: FakerDate;
finance: FakerFinance;
hacker: FakerHacker;
image: FakerImages;
internet: FakerInternet;
lorem: FakerLorem;
music: FakerMusic;
name: FakerName;
phone: FakerPhoneNumbers;
random: FakerRandomizer;
system: FakerSystem;
vehicle: FakerVehicle;
};

The faker methods to generate fake, but realistic, data.

Properties​

address​
readonly address: FakerAddress;

Methods for generating an address.

commerce​
readonly commerce: FakerCommerce;

Methods relating to commerce.

company​
readonly company: FakerCompany;

Methods for generating random company names and phrases.

database​
readonly database: FakerDatabase;

Generates some random database stuff.

date​
readonly date: FakerDate;

Methods for generating dates.

finance​
readonly finance: FakerFinance;

Provides financial randomness.

hacker​
readonly hacker: FakerHacker;

Hackerish words.

image​
readonly image: FakerImages;

Generates images URLs.

internet​
readonly internet: FakerInternet;

Random Internet things like email addresses.

lorem​
readonly lorem: FakerLorem;

Generates plain old boring text.

music​
readonly music: FakerMusic;

Methods for generating music related stuff.

name​
readonly name: FakerName;

Methods for generating names.

phone​
readonly phone: FakerPhoneNumbers;

Generates phone numbers.

random​
readonly random: FakerRandomizer;

A randomizer that randomizes things.

system​
readonly system: FakerSystem;

Generates fake data for many computer systems properties.

vehicle​
readonly vehicle: FakerVehicle;

Methods for generating vehicle information.


FakerSystem​

type FakerSystem = {
locale: string;
random: FakerRandomizer;
androidId: string;
applePushToken: string;
blackBerryPin: string;
commonFileExt: string;
commonFileName: string;
commonFileType: string;
directoryPath: string;
fileExt: string;
fileName: string;
filePath: string;
fileType: string;
mimeType: string;
semver: string;
};

Generates fake data for many computer systems properties

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

androidId()​
androidId(): string;

Get a random GCM registration ID.

Returns​

string

A random GCM registration ID.

applePushToken()​
applePushToken(): string;

Get a random Apple Push Token.

Returns​

string

A random Apple Push Token.

blackBerryPin()​
blackBerryPin(): string;

Get a random BlackBerry Device PIN.

Returns​

string

A random BlackBerry Device PIN.

commonFileExt()​
commonFileExt(): string;

Returns a commonly used file extension.

Returns​

string

A commonly used file extension.

commonFileName()​
commonFileName(ext?: string): string;

Generates a random file name with a common file extension. Extension can be overwritten with ext.

Parameters​
ParameterTypeDescription
ext?stringThe extensions to be used for a file name.
Returns​

string

A random file name with a common extension or ext.

commonFileType()​
commonFileType(): string;

Returns a commonly used file type.

Returns​

string

A commonly used file type.

directoryPath()​
directoryPath(): string;

Get a random directory path (Unix).

Returns​

string

A random Unix directory path.

fileExt()​
fileExt(mimeType?: string): string;

Gets a random extension for the given mime type.

Parameters​
ParameterTypeDescription
mimeType?string-
Returns​

string

A random extension for the given mime type.

fileName()​
fileName(ext?: string): string;

Get a random file name.

Parameters​
ParameterTypeDescription
ext?stringThe extension the file name will have. If null is provided, a random extension will be picked.
Returns​

string

A random file name with the given ext or a random extension

filePath()​
filePath(): string;

Get a random file path (Unix).

Returns​

string

A random Unix file path.

fileType()​
fileType(): string;

Returns any file type available as mime-type.

Returns​

string

Any file type available as mime-type.

mimeType()​
mimeType(): string;

Get a random mime type.

Returns​

string

A random mime type.

semver()​
semver(): string;

Get a random semver version string.

Returns​

string

A random semver version string.


FakerVehicle​

type FakerVehicle = {
locale: string;
random: FakerRandomizer;
fuel: string;
manufacturer: string;
model: string;
type: string;
vin: string;
};

Methods for generating vehicle information

Properties​

locale​
locale: string;
random​
random: FakerRandomizer;

Methods​

fuel()​
fuel(): string;

Get a vehicle fuel type. IE: Electric, Gasoline, Diesel.

Returns​

string

manufacturer()​
manufacturer(): string;

Get a vehicle manufacture name. IE: Toyota, Ford, Porsche.

Returns​

string

model()​
model(): string;

Get a vehicle model. IE: Camry, Civic, Accord.

Returns​

string

type()​
type(): string;

Get a vehicle type. IE: Minivan, SUV, Sedan.

Returns​

string

vin()​
vin(strict?: boolean): string;

Generate a vehicle identification number (VIN).

Parameters​
ParameterTypeDescription
strict?booleanLimits the acceptable characters to alpha numeric uppercase except I, O and Q.
Returns​

string


Guid​

type Guid = {
variant: number;
version: number;
toString: string;
};

Properties​

variant​
readonly variant: number;
version​
readonly version: number;

Methods​

toString()​
toString(): string;
Returns​

string


PreviewScriptApi​

type PreviewScriptApi = {
file: Promise<void>;
html: Promise<void>;
pdf: Promise<void>;
};

Functions to view previews of files inside Kreya.

Methods​

file()​
file(path: string, name?: string): Promise<void>;

Opens a preview tab in Kreya and displays a preview of the provided file.

Parameters​
ParameterTypeDescription
pathstringThe path to the file. Needs to be in the directory of the Kreya project or any subdirectory.
name?stringThe name of the preview. If the same name is used as with a previous call, the previous preview is updated.
Returns​

Promise<void>

html()​
html(data: string, name?: string): Promise<void>;

Opens a preview tab in Kreya and displays the provided data as HTML.

Parameters​
ParameterTypeDescription
datastringThe data.
name?stringThe name of the preview. If the same name is used as with a previous call, the previous preview is updated.
Returns​

Promise<void>

pdf()​
pdf(data: Uint8Array, name?: string): Promise<void>;

Opens a preview tab in Kreya and displays the provided data as a PDF.

Parameters​
ParameterTypeDescription
dataUint8ArrayThe data.
name?stringThe name of the preview. If the same name is used as with a previous call, the previous preview is updated.
Returns​

Promise<void>


SnapshotScriptApi​

type SnapshotScriptApi = {
verifyFile: Promise<void>;
verifyJson: Promise<void>;
verifyObjectAsJson: Promise<void>;
verifyText: Promise<void>;
};

Functions to assert snapshots.

Methods​

verifyFile()​
Call Signature​
verifyFile(path: string): Promise<void>;

Asserts a snapshot file. Only text-based files are supported.

Parameters​
ParameterTypeDescription
pathstringThe path to the file to assert.
Returns​

Promise<void>

Call Signature​
verifyFile(name: string, path: string): Promise<void>;

Asserts a snapshot file. Only text-based files are supported.

Parameters​
ParameterTypeDescription
namestringThe name of the snapshot.
pathstringThe path to the file to assert.
Returns​

Promise<void>

verifyJson()​
verifyJson(name: string, json: string): Promise<void>;

Asserts a string as a JSON snapshot.

Parameters​
ParameterTypeDescription
namestringThe name of the snapshot.
jsonstringThe JSON string to assert.
Returns​

Promise<void>

verifyObjectAsJson()​
verifyObjectAsJson(name: string, obj: any): Promise<void>;

Asserts an object as a JSON snapshot.

Parameters​
ParameterTypeDescription
namestringThe name of the snapshot.
objanyThe JSON object to assert.
Returns​

Promise<void>

verifyText()​
verifyText(name: string, text: string): Promise<void>;

Asserts a string snapshot.

Parameters​
ParameterTypeDescription
namestringThe name of the snapshot.
textstringThe string to assert.
Returns​

Promise<void>


UserVariablesScriptApi​

type UserVariablesScriptApi = {
clear: void;
delete: void;
get: any;
has: boolean;
keys: Iterable<string>;
set: void;
};

The storage to set and retrieve custom variables, which are accessible in other operations and via templating.

Methods​

clear()​
clear(): void;

Clears/deletes ALL variables.

Returns​

void

delete()​
delete(key: string): void;

Deletes the specified variable.

Parameters​
ParameterTypeDescription
keystringThe key of the variable.
Returns​

void

get()​
get(key: string): any;

Gets the value of a variable.

Parameters​
ParameterTypeDescription
keystringThe key of the variable.
Returns​

any

The value of the variable or undefined if the variable does not exist.

has()​
has(key: string): boolean;

Checks whether the specified variable exists.

Parameters​
ParameterTypeDescription
keystringThe key of the variable.
Returns​

boolean

True when the variable exists, otherwise false.

keys()​
keys(): Iterable<string>;

Returns the keys of all stored variables.

Returns​

Iterable<string>

The keys of all stored variables.

set()​
set(key: string, value: any): void;

Sets a variable. Setting undefined as a value deletes the variable.

Parameters​
ParameterTypeDescription
keystringThe key of the variable.
valueanyThe value of the variable.
Returns​

void