Skip to content

Template Mocks - Version 2.0 (current)

Introduction

Template Mock evaluates Handlebars expressions provided by the customer. Handlebars is a simple templating language that uses template string and the input model to generate output.
Handlebars templates look like a regular text with embedded Handlebars expressions ({{, some contents, followed by a }}).

Here are some helpful topics in Handlebars official documentation you may find useful while implementing your mocks:

Input Model

The input model available for Template Mock consists of two objects: req and state. The req (Request Model) object represents the request sent towards the domain identifying particular SmartMock.io workspace. The state (State) object represents the container for the stateful data for the workspace (see Stateful Responses section for more details.)

Example - accessing the request model

Request HTTP method:

GET

Template:

{{req.method}}

Rendered response body:

GET
Example - accessing the state

The state contains an array of users:

{"users": [{"id": 1, "name": "John"}, {"id": 2, "name": "Gregory"}] }

Template:

{{ state.users.[0].name }}

Rendered response body:

John

Request Model

The HTTP request from client is parsed, supplied to the template mock and available as req variable. The following request attributes are available:

Method

req.method - Value of request HTTP method.

URL

req.url - The URL, the client, used to make the request. The returned URL contains a protocol, server name, port number, and the server path, but it does not include query string parameters.

Example

Request URL:

http://somedomain.app.smartmock.io/user/John%20Doe/permissions?param1=value1

Template:

{{req.url}}

Rendered response body:

http://somedomain.app.smartmock.io/user/John%20Doe/permissions

Path

req.path - The path part of the request's URL. It does not decode the path.

Example

Request URL:

http://somedomain.app.smartmock.io/user/John%20Doe/permissions?param1=value1

Template:

{{req.path}}

Rendered response body:

/user/John%20Doe/permissions

Path Parameters

req.pathParams.[name] - Value of path parameter (see Path Parameter Matchers) extracted from request path. If the parameter not found, the empty string is used.

Example

Path matcher:

/user/{userId}/permissions

Request URL:

http://somedomain.app.smartmock.io/user/123abc/permissions?param1=value1

Template:

{{req.pathParams.[userId]}}

Rendered response body:

123abc

Path Segments

req.pathSegments.[n] - Value of nth URL path segment. Zero indexed. If segment not found, the empty string is used.

Example

Request URL:

http://somedomain.app.smartmock.io/user/123abc/permissions?param1=value1

Template:

{{req.pathSegments.[1]}}

Rendered response body:

123abc

Host

req.host - Name of the host the request is made to.

Example

Request URL:

http://somedomain.app.smartmock.io/user/123abc/permissions?param1=value1

Template:

{{req.host}}

Rendered response body:

somedomain.app.smartmock.io

Headers

req.headers.[name] - Values of the request headers with the given name. If value not found, the empty string is used. req.headers.[name].[n] - Value of nth request header with the given name. Zero indexed. If value not found, the empty string is used.

Example

Request Headers:

Content-Type: application/json
AuthToken: abc123
AuthToken: bcd123

Template:

{{req.headers.[AuthToken]}} - {{req.headers.[AuthToken].[1]}}

Rendered response body:

abc123 bcd123

Cookies

req.cookies.[name] - Values of the request cookies with the given name. If value not found, the empty string is used. req.cookies.[name].[n] - Value of nth request cookie with the given name. Zero indexed. If value not found, the empty string is used.

Example

Request Headers:

Cookie: PHPSESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;

Template:

{{req.cookies.[PHPSESSID]}}

Rendered response body:

298zf09hf012fh2

Query Parameters

req.query.[name] - Values of the request query parameters with the given name. If value not found, the empty string is used. req.query.[name].[n] - Value of nth request query parameter with the given name. Zero indexed. If value not found, the empty string is used.

Example

Request URL:

http://somedomain.app.smartmock.io/user/123abc/permissions?page=1&size=10

Template:

{{req.query.[page]}}

Rendered response body:

1

Query String

req.queryString - Value of request URL query string. If the request URL has no query string, the empty string will is used.

Example

Request URL:

http://somedomain.app.smartmock.io/user/123abc/permissions?page=1&size=10

Template:

{{req.queryString}}

Rendered response body:

page=1&size=10

Body

req.body - Value of request body. The return value is of string type. You may use appropriate helpers to parse it and extract business fields values from it.

Example

Request body:

{"id" : 123, "name": "John", "surname" : "Doe"}

Template:

{{req.body}}

Rendered response body:

{"id" : 123, "name": "John", "surname" : "Doe"}

JSON Body

req.jsonBody - Parsed request JSON body. This property is returned only when the request body is a valid and parsable JSON string. Otherwise, appropriate message gets logged into workspace's Request Log and the empty string is returned.

Example

Request body:

{"id" : 123, "name": "John", "surname" : "Doe"}

Template:

{{req.jsonBody.name}} {{req.jsonBody.surname}}

Rendered response body:

John Doe

Accessing State

{{state.[Key].[Subkey].[index]}} - Retrieve a value from current state of workspace. State may be initialized in Dynamic Mocks. Please note that access to nested object is done through the '.[Key]' operator. If a value does not exist under a given key, an empty string is returned. See more about state.

Example

State:

{"people": [{"name" : "John", "surname": "Doe"},{"name" : "Eric", surname: "Jackson"}]}

Template:

{{state.[people].[0].[name]}} {{state.[people].[0].[surname]}}

Rendered response body:

John Doe

Helpers

Besides accessing request fields, it's possible to include some logic in the form of built-in helpers. Helper names are case sensitive.

Random UUID Helper

randomUuid - Generates UUID type 4 value.

Example

Template:

{{randomUuid}}

Rendered response body:

400bc69f-9b06-43c2-8497-ba8755fe7ef6

Date/Time Helper

now pattern='<pattern>' offset='<offset>' timezone='<zone>' - Generates string value of current time in given zone, with given format, adding given offset.

Example 1

Template:

{{now pattern='YYYY-MM-DD[ at ]HH:mm:ss' offset='-1 hours' timezone='UTC'}}

Rendered response body:

2020-05-10 at 11:12:13
Example 2

Template:

{{now}}

Rendered response body:

2020-05-10T11:12:13Z

Parameters

Parameter Description Default value
pattern Patterns based on a simple sequence of letters and symbols. Use "\" to escape single quote characters in format string. See details below. ISO-8601 extended offset date-time format (YYYY-MM-DDTHH:mm:ss[Z])
offset Add or remove seconds/minutes/hours/days/months/years. Format: +/-<number> <unit> examples: +1 years, -2 months See Moment.js "Add" documentation for a list of time units. -0 seconds
timezone Time zone date(time) will be placed in. Sample values: UTC, CET, America/Los_Angeles, Etc/GMT+1. See column "TZ Database name" on Wikipedia article for a list of available time zones UTC
Pattern details

Source

Token
Month M 1 2 ... 11
Mo 1st 2nd ... 11th
MM 01 02 ... 11
MMM Jan Feb ... Nov
MMMM January February ... November
Quarter Q 1 2 3
Qo 1st 2nd 3rd
Day of Month D 1 2 ... 30
Do 1st 2nd ... 30th
DD 01 02 ... 30
Day of Year DDD 1 2 ... 364
DDDo 1st 2nd ... 364th
DDDD 001 002 ... 364
Day of Week d 0 1 ... 5
do 0th 1st ... 5th
dd Su Mo ... Fr
ddd Sun Mon ... Fri
dddd Sunday Monday ... Friday
Day of Week (Locale) e 0 1 ... 5
Day of Week (ISO) E 1 2 ... 6
Week of Year w 1 2 ... 52
wo 1st 2nd ... 52nd
ww 01 02 ... 52
Week of Year (ISO) W 1 2 ... 52
Wo 1st 2nd ... 52nd
WW 01 02 ... 52
Year YY 70 71 ... 29
YYYY 1970 1971 ... 2029
YYYYYY -001970 -001971 ... +001907 +001971 Note: Expanded Years (Covering the full time value range of approximately 273,790 years forward or backward from 01 January, 1970)
Y 1970 1971 ... 9999 +10000 +10001 Note: This complies with the ISO 8601 standard for dates past the year 9999
Era Year y 1 2 ... 2020
Era N BC AD Note: Abbr era name
NN BC AD Note: Narrow era name
NNN Before Christ, Anno Domini Note: Full era name
Week Year gg 70 71 ... 29
gggg 1970 1971 ... 2029
Week Year (ISO) GG 70 71 ... 29
GGGG 1970 1971 ... 2029
AM/PM A AM
a am
Hour H 0 1 ... 22
HH 00 01 ... 22
h 1 2 ... 11
hh 01 02 ... 11
k 1 2 ... 23
kk 01 02 ... 23
Minute m 0 1 ... 58
mm 00 01 ... 58
Second s 0 1 ... 58
ss 00 01 ... 58
Fractional Second S 0 1 ... 8
SS 00 01 ... 98
SSS 000 001 ... 998
SSSS ... SSSSSSSSS 000[0..] 001[0..] ... 998[0..] 999[0
Time Zone z or zz EST CST ... MST PST Note: as of 1.6.0, the z/zz format tokens have been deprecated from plain moment objects. Read more about it here. However, they *do* work if you are using a specific time zone with the moment-timezone addon.
Z -07:00 -06:00 ... +06:00 +07:
ZZ -0700 -0600 ... +0600 +
Unix Timestamp X 1360013296
Unix Millisecond Timestamp x 1360013296123
Escaping characters

To escape characters in format strings, you can wrap the characters in square brackets.

Example 3

Template:

{{now pattern='[today] dddd'}}

Rendered response body:

today Sunday

Unix Timestamp Helper

unixTimestamp unit='<unit>' - Generates string representing number of milliseconds, seconds, minutes, hours, days since Jan 01 1970. (UTC)

Parameter Description Default value
unit Time unit of timestamp. Possible values: MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS SECONDS

Random String Helper

randomString length=<length> type='<type>' case='<case>' - Generates random string of given type with given length and given case.

Parameter Description Default value
length Length of string 10
type Type of string. Possible types: ALPHABETIC, ALPHANUMERIC, NUMERIC, ALPHANUMERIC_AND_SYMBOLS ALPHABETIC
case Defines if letters are upper case or lower case. Possible values: UPPER, LOWER, none none
Example 1 (alphabetic string)

Template:

{{randomString}}

Rendered response body:

EhFGqGiZpK
Example 2 (numeric string)

Template:

{{randomString length=5 type='NUMERIC'}}

Rendered response body:

22187
Example 3 (alphanumeric upper case string)

Template:

{{randomString length=20 type='ALPHANUMERIC' case='UPPER'}}

Rendered response body:

2TFO8F6YM0XBHFVGDZER

Random Number Helper

randomNumber min=<min> max=<max> fractionDigits=<digits> - Generates random number greater or equal to min and lower than max with given number of fraction digits

Parameter Description Default value
min inclusive minimum 0
max exclusive maximum 100
fractionDigits Number of fraction digits - useful for generating float values 0
Example 1

Template:

{{randomNumber}}

Rendered response body:

82
Example 2

Template:

{{randomNumber min=1000 max=100000 fractionDigits=5}}

Rendered response body:

67342.60221

Assignment Helper

{{assign 'varName' varValue }} - Creates auxiliary variable (varName) in current context and assigns the value of varValue to that variable. It's not possible to assign value to the req and state objects. This helper may be used to simplify templates that require complex helpers' compositions.

Example

Request body:

{"name" : "John", "surname": "Doe"}

Template:

{{assign 'name' req.jsonBody.name}}
{{name}}

Rendered response body:

John

Faker Helper

{{faker <fakeName> <...fakeArguments> lang='<lang>''}} - Allows using the Faker library as a helper.

Parameter Description Default value
fakerName String representing the specific fake type to be generated (address.zipCode, finance.account etc.) - see the list available at Faker's official documentation ---
fakeArguments Fake arguments. Values are dependent on the specific fake. Please check fakes documentation in the source code to check available arguments for specific helpers. ---
lang Language locale. Supported values: az, cz, de, de_AT, de_CH, en, en_AU, en_AU_ocker, en_BORK, en_CA, en_GB, en_IE, en_IND, en_US, en_ZA, es, es_MX, fa, fr, fr_CA, fr_CH, ge, id_ID, it, ja, ko, nb_NO, nep, nl, nl_BE, pl, pt_BR, pt_PT, ru, sk, sv, tr, uk, vi, zh_CN, zh_TW en

Available Fakes

Name
Example Sample output
Description Arguments
address.zipCode
`{{faker 'address.zipCode'}}` `67158-5600`
Generates zip code.
  1. format:string (Optional) - the format of zip code. For example `##-###`. The default value depends on locale.
address.zipCodeByState
`{{faker 'address.zipCodeByState' 'TX' lang='en_US'}}` `73301`
Generates random zipcode from state abbreviation. If state abbreviation is not specified, a random zip code is generated according to the locale's zip format.
  1. state:string (Optional) - the state abbreviation. For example `'TX'`. No default value.
address.city
`{{faker 'address.city'}}` `Connland`
Generates a random localized city name.
  1. format:string (Optional) - [more info](https://github.com/Marak/faker.js/blob/master/lib/address.js)
address.streetName
`{{faker 'address.streetName'}}` `Stark Island`
Generates a random localized street name. -----
address.streetAddress
`{{faker 'address.streetAddress'}}` `806 Feil Loaf`
Generates a random localized street address.
  1. useFullAddress:boolean (Optional) - decides if secondary address should be included. Default `false`.
address.secondaryAddress
`{{faker 'address.secondaryAddress'}}` `Apt. 661`
Generates a random secondary address. -----
address.county
`{{faker 'address.county'}}` `Buckinghamshire`
Generates a random county name. -----
address.country
`{{faker 'address.country'}}` `Germany`
Generates a random country name. -----
address.countryCode
`{{faker 'address.countryCode'}}` `LR`
Generates a random country code.
  1. alphaCode:string (Optional) - default value `'alpha-2'`
address.state
`{{faker 'address.state'}}` `New Hampshire`
Generates a random state name. -----
address.stateAbbr
`{{faker 'address.stateAbbr'}}` `NC`
Generates a random state abbreviation. -----
address.latitude
`{{faker 'address.latitude'}}` `70.7711`
Generates a random latitude.
  1. max:double (Optional), default `90`
  2. min:double (Optional), default `-90`
  3. precision:double (Optional), (default `4`)
address.longitude
`{{faker 'address.longitude'}}` `159.3064`
Generates a random longitude.
  1. max:double (Optional), default `180`
  2. min:double (Optional), default `-180`
  3. precision:double (Optional), (default `4`)
address.direction
`{{faker 'address.direction'}}` `Northwest`
Generates a random geographical direction.
  1. useAbbr:boolean (Optional) - set to `true` to return direction abbreviation (`W`, `E`, `SW` etc.). Default `false`
address.cardinalDirection
`{{faker 'address.cardinalDirection'}}` `West`
Generates a random geographical cardinal direction.
  1. useAbbr:boolean (Optional) - set to `true` to return direction abbreviation (`W`, `E`, etc.). Default `false`
address.nearbyGPSCoordinate
`{{assign 'loc' (JSONparse '[70.0, 60.0]')}} {{faker 'address.nearbyGPSCoordinate' loc 1 false}}` `70.0056,60.0002`
Generates a random GPS coordinates nearby the given coordinates.
  1. coordinate:array (Optional) - the point to generate coordinates nearby. No default.
  2. radius:double (Optional) - radius around the given coordinates to generate new coordinates (miles of km). Default `10.0`.
  3. isMetric:boolean (Optional) - is radius in metric units (km). Default `false`.
commerce.color
`{{faker 'commerce.color'}}` `pink`
Generates a random color. -----
commerce.department
`{{faker 'commerce.department'}}` `Outdoors`
Generates a random department. -----
commerce.productName
`{{faker 'commerce.productName'}}` `Unbranded Fresh Shirt`
Generates a random product name. -----
commerce.price
`{{faker 'commerce.price' 10 20 2 '$'}}` `$16.00`
Generates a random price.
  1. min:number (Optional) - minimum. Default `1`
  2. max:number (Optional) maximum. Default `1000`
  3. dec:number (Optional) - number of decimal points. Default `2`
  4. symbol:string (Optional) - currency symbol. Default - empty string
commerce.productAdjective
`{{faker 'commerce.productAdjective'}}` `Tasty`
Generates a random product adjective. -----
commerce.productMaterial
`{{faker 'commerce.productMaterial'}}` `Concrete`
Generates a random product material. -----
commerce.product
`{{faker 'commerce.product'}}` `Bacon`
Generates a random product . -----
commerce.productDescription
`{{faker 'commerce.productDescription'}}` `The Football Is Good For Training And Recreational Purposes`
Generates a random product description. -----
company.companySuffix
`{{faker 'company.companySuffix'}}` `Group`
Generates a random company suffix. -----
company.companyName
`{{faker 'company.companyName' }}` `Hamill and Sons`
Generates a random company name.
  1. format:string (Optional) - [more info](https://github.com/Marak/faker.js/blob/master/lib/company.js)
company.catchPhrase
`{{faker 'company.catchPhrase' }}` `Profit-focused explicit internet solution`
Generates a random company catch phrase. -----
company.bs
`{{faker 'company.bs' }}` `evolve next-generation systems`
Generates a random buzz sentence. -----
company.catchPhraseAdjective
`{{faker 'company.catchPhraseAdjective' }}` `Advanced`
Generates a random catch phrase adjective. -----
company.catchPhraseDescriptor
`{{faker 'company.catchPhraseDescriptor' }}` `intermediate`
Generates a random catch phrase descriptor. -----
company.catchPhraseNoun
`{{faker 'company.catchPhraseNoun' }}` `success`
Generates a random catch phrase noun. -----
company.bsAdjective
`{{faker 'company.bsAdjective' }}` `cross-platform`
Generates a random buzz sentence adjective. -----
company.bsBuzz
`{{faker 'company.bsBuzz' }}` `exploit`
Generates a random buzz word. -----
company.bsNoun
`{{faker 'company.bsNoun' }}` `metrics`
Generates a random buzz word noun. -----
database.column
`{{faker 'database.column' }}` `token`
Generates a random database column. -----
database.type
`{{faker 'database.type' }}` `enum`
Generates a random database type. -----
database.collation
`{{faker 'database.collation' }}` `utf8_general_ci`
Generates a random database collation. -----
database.engine
`{{faker 'database.engine' }}` `MEMORY`
Generates a random database engine. -----
date.past
`{{faker 'date.past 10 '2010-01-01' }}` `Wed Feb 21 2007 06:13:54 GMT+0100 (CET)`
Generates a random date from the past.
  1. years:number (Optional) - number of years to look back into. Default `1`.
  2. refDate:string (Optional) - reference date to start with. Default `now`.
date.future
`{{faker 'date.future' 10 '2020-01-01' }}` `Tue May 19 2020 14:26:53 GMT+0200 (CEST)`
Generates a random date from the future.
  1. years:number (Optional) - number of years to look forward into. Default `1`.
  2. refDate:string (Optional) - reference date to start with. Default `now`.
date.between
`{{faker 'date.between' '2010-01-01' '2020-01-01' }}` ` Sat May 22 2010 17:06:10 GMT+0200 (CEST)`
Generates a random date between two dates.
  1. from:string (Optional) - start date. Default `1`.
  2. to:string (Optional) - end date. Default `now`.
date.recent
`{{faker 'date.recent' 10 '2020-01-01' }}` `Thu Dec 26 2019 18:36:59 GMT+0100 (CET)`
Generates a random recent date.
  1. days:number (Optional) - number of days to look back into. Default `1`.
  2. refDate:string (Optional) - reference date to start with. Default `now`.
date.soon
`{{faker 'date.soon' '2020-01-01' }}` ` Mon Jan 06 2020 20:48:25 GMT+0100 (CET)`
Generates a random soon date.
  1. days:number (Optional) - number of days to look forward into. Default `1`.
  2. refDate:string (Optional) - reference date to start with. Default `now`.
date.month
`{{faker 'date.month' abbr=true}}` `Jan`
Generates a random month name.
  1. abbr:boolean(hash) (Optional) - specifies if month abbreviation should be returned. Default `false`.
date.weekday
`{{faker 'date.weekday' abbr=true }}` `Tue`
Generates a random weekday name.
  1. abbr:boolean(hash) (Optional) - specifies if day abbreviation should be returned. Default `false`.
finance.account
`{{faker 'finance.account' 10 }}` `8509109839`
Generates a random account number.
  1. length:number (Optional) - The length of an account number. Default `8`.
finance.accountName
`{{faker 'finance.accountName' }}` `Credit Card Account`
Generates a random account name. -----
finance.routingNumber
`{{faker 'finance.routingNumber' }}` `296112809`
Generates a random routing number. -----
finance.mask
`{{faker 'finance.mask' 4 false true }}` `...9846`
Generates a random numeric mask.
  1. length:number (Optional) - The length of the mask. Default `4`.
  2. parens:boolean (Optional) - Specifies if mast should be enclosed in parenthesis. Default `true`.
  3. ellipsis:boolean (Optional) - Specifies if mask should be prepended with `...`. Default `true`
finance.amount
`{{faker 'finance.amount' 1 20 2 }}` `5.74`
Generates a random amount.
  1. min:number (Optional) - The minimum value. Default `0`.
  2. max:number (Optional) - The maximum value. Default `1000`.
  3. dec:number (Optional) - The number of decimal places. Default `2`.
finance.transactionType
`{{faker 'finance.transactionType' }}` `payment`
Generates a random transaction type. -----
finance.currencyCode
`{{faker 'finance.currencyCode' }}` `VUV`
Generates a random currency code. -----
finance.currencyName
`{{faker 'finance.currencyName' }}` `Cape Verde Escudo`
Generates a random currency name. -----
finance.currencySymbol
`{{faker 'finance.currencySymbol' }}` `BZ$`
Generates a random currency symbol. -----
finance.bitcoinAddress
`{{faker 'finance.bitcoinAddress' }}` `3qf5fGisbKhiSQLoDQwe7dvWqu`
Generates a random Bitcoin address. -----
finance.litecoinAddress
`{{faker 'finance.litecoinAddress' }}` `M3yTEUJxE1bR9PoeAQT2temGST4SrB`
Generates a random Litecoin address. -----
finance.creditCardNumber
`{{faker 'finance.creditCardNumber' 'Mastercard' }}` `5207-2222-3328-0433`
Generates a random credit card number.
  1. provider:string (Optional) - The type of the card provider ("visa", "mastercard", "americanexpress", "discover"). Default - random provider.
finance.creditCardCVV
`{{faker 'finance.creditCardCVV' }}` `151`
Generates a random credit card cvv. -----
finance.ethereumAddress
`{{faker 'finance.ethereumAddress' }}` `0x6ebeee71626fd3edb428dfd382c1dcb8e2a1f1f1`
Generates a random Ethereum address. -----
finance.iban
`{{faker 'finance.iban' true }}` `AD40 0400 8199 R374 5H90 4J41`
Generates a random IBAN number.
  1. formatted:boolean (Optional) - Specifies if IBAN number should be formatted. Default - `false`.
finance.bic
`{{faker 'finance.bic' }}` `HLBIINR1`
Generates a random bank identification code (bic). -----
git.branch
`{{faker 'git.branch' }}` ` bandwidth-back-up`
Generates a random git branch name. -----
git.commitEntry
`{{faker 'git.commitEntry' }}` ` quantify multi-byte protocol`
Generates a random git commit entry.
  1. merge:boolean(hash) (Optional) - Specifies if commit entry should start with `Merge:` string. Default - `false`.
git.commitMessage
`{{faker 'git.commitMessage' }}` `calculate neural transmitter`
Generates a random git commit message. -----
git.commitSha
`{{faker 'git.commitSha' }}` `eea49609a96318acee11880f0d86ad3810985a1a`
Generates a random git commit SHA. -----
git.shortSha
`{{faker 'git.shortSha' }}` `eb0d56d`
Generates a random git commit short SHA. -----
hacker.abbreviation
`{{faker 'hacker.abbreviation' }}` `THX`
Generates a random hacker abbreviation. -----
hacker.adjective
`{{faker 'hacker.adjective' }}` `redundant`
Generates a random hacker adjective. -----
hacker.noun
`{{faker 'hacker.noun' }}` `interface`
Generates a random hacker noun. -----
hacker.verb
`{{faker 'hacker.verb' }}` `connect`
Generates a random hacker verb. -----
hacker.ingverb
`{{faker 'hacker.ingverb' }}` `hacking`
Generates a random hacker gerund verb. -----
hacker.phrase
`{{faker 'hacker.phrase' }}` `Use the auxiliary XML hard drive, then you can connect the 1080p matrix!`
Generates a random hacker phrase. -----
image.image
`{{faker 'image.image' 640 480 true }}` `http://placeimg.com/640/480/people?20729`
Generates a random image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.avatar
`{{faker 'image.avatar' }}` `https://s3.amazonaws.com/uifaces/faces/twitter/shoaib253/128.jpg`
Generates a random avatar link. -----
image.imageUrl
`{{faker 'image.imageUrl' 640 480 'flowers' true true }}` `https://placeimg.com/640/480/flowers?77652`
Generates a random image URL.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. category:string (Optional) - The category of the image.
  4. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
  5. https:number (Optional) - Specifies if random URL should be of the https scheme. Default `false`.
image.abstract
`{{faker 'image.abstract' 640 480 true }}` `http://placeimg.com/640/480/abstract?10498`
Generates a random abstract image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.animals
`{{faker 'image.animals' 640 480 true }}` `http://placeimg.com/640/480/animals?29284`
Generates a random animal image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.business
`{{faker 'image.business' 640 480 true }}` `http://placeimg.com/640/480/business?29284`
Generates a random business image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.cats
`{{faker 'image.cats' 640 480 true }}` `http://placeimg.com/640/480/cats?29284`
Generates a random cat image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.city
`{{faker 'image.city' 640 480 true }}` `http://placeimg.com/640/480/city?29284`
Generates a random city image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.food
`{{faker 'image.food' 640 480 true }}` `http://placeimg.com/640/480/food?29284`
Generates a random food image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.nightlife
`{{faker 'image.nightlife' 640 480 true }}` `http://placeimg.com/640/480/nightlife?29284`
Generates a random nightlife image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.fashion
`{{faker 'image.fashion' 640 480 true }}` `http://placeimg.com/640/480/fashion?29284`
Generates a random fashion image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.people
`{{faker 'image.people' 640 480 true }}` `http://placeimg.com/640/480/people?29284`
Generates a random people image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.nature
`{{faker 'image.nature' 640 480 true }}` `http://placeimg.com/640/480/nature?29284`
Generates a random nature image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.sports
`{{faker 'image.sports' 640 480 true }}` `http://placeimg.com/640/480/sports?29284`
Generates a random sport image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.technics
`{{faker 'image.technics' 640 480 true }}` `http://placeimg.com/640/480/technics?29284`
Generates a random technology image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.transport
`{{faker 'image.transport' 640 480 true }}` `http://placeimg.com/640/480/transport?29284`
Generates a random transport image link.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. randomize:number (Optional) - Specifies if random URL should be generated. Default `false`.
image.dataUri
`{{faker 'image.dataUri' }}` `data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns...`
Generates a random data URI image.
  1. width:number (Optional) - The width of the image. Default `640`.
  2. height:number (Optional) - The height of the image. Default `480`.
  3. color:string (Optional) - Specifies the color of the image. Default `grey`.
internet.avatar
`{{faker 'internet.avatar' }}` `https://s3.amazonaws.com/uifaces/faces/twitter/pierre_nel/128.jpg`
Generates a random avatar image link. -----
internet.email
`{{faker 'internet.email'}}` `John.Doe12@company.com`
Generates a random email address.
  1. firstName:string (Optional) - The first name of the user. Default - random.
  2. lastName:string (Optional) - The last name of the user. Default - random.
  3. provider:string (Optional) - The domain of the user. Default - random.
internet.exampleEmail
`{{faker 'internet.exampleEmail' }}` `John.Doe@example.net`
Generates a random in domain of 'example.net'
  1. firstName:string (Optional) - The first name of the user. Default - random.
  2. lastName:string (Optional) - The last name of the user. Default - random.
internet.userName
`{{faker 'internet.userName' }}` `Vince.Abshire`
Generates a random username.
  1. firstName:string (Optional) - The first name of the user. Default - random.
  2. lastName:string (Optional) - The last name of the user. Default - random.
internet.protocol
`{{faker 'internet.protocol' }}` `http`
Generates a random protocol. -----
internet.url
`{{faker 'internet.url' }}` `http://talon.info`
Generates a random URL. -----
internet.domainName
`{{faker 'internet.domainName' }}` `collin.net`
Generates a random domain name. -----
internet.domainSuffix
`{{faker 'internet.domainSuffix' }}` `com`
Generates a random domain suffix. -----
internet.domainWord
`{{faker 'internet.domainWord' }}` `terry`
Generates a random domain word. -----
internet.ip
`{{faker 'internet.ip' }}` `123.21.100.68`
Generates a random IP address. -----
internet.ipv6
`{{faker 'internet.ipv6' }}` `8815:cccb:7749:3f0e:08c5:8baa:0ca0:8f31`
Generates a random IP V6 address. -----
internet.userAgent
`{{faker 'internet.userAgent' }}` `Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:13.0) Gecko/20100101 Firefox/13.0.6`
Generates a random user agent statement. -----
internet.color
`{{faker 'internet.color 120 130 140' }}` `#847d6c`
Generates a random hex color.
  1. baseRed255:number (Optional) - The red value. Valid values are 0 - 255. Default `0`.
  2. baseGreen255:number (Optional) - The green value. Valid values are 0 - 255. Default `0`.
  3. baseBlue255:number (Optional) - The blue value. Valid values are 0 - 255. Default `0`.
internet.mac
`{{faker 'internet.mac' ':'}}` `d2:e1:7f:86:2a:80`
Generates a random MAC address.
  1. sep:string (Optional) - The tokens separator. Default `:`.
internet.password
`{{faker 'internet.password' 10 false }}` `B94C0tQEqX`
Generates a random password.
  1. len:number (Optional) - The number of characters in the password. Default `10`.
  2. memorable:boolean (Optional) - Whether a password should be easy to remember. Default `true`.
  3. pattern:string (Optional) - A regex to match each character of the password against. Default `/\w/`.
  4. prefix:string (Optional) - TA value to prepend to the generated password. Default - empty string.
lorem.word
`{{faker 'lorem.word' 10 }}` `nihil`
Generates a random Lorem word.
  1. length:number (Optional) - The length of the word that should be returned.
lorem.words
`{{faker 'lorem.words' 5 }}` `ut qui repellat reiciendis consequuntur`
Generates a random Lorem words.
  1. num:number (Optional) - The number of the words that should be returned. Default `3`.
lorem.sentence
`{{faker 'lorem.sentence' 5 }}` `Omnis odit consectetur assumenda et.`
Generates a random Lorem sentence.
  1. wordCount:number (Optional) - The number of the words that should be returned. Default - random number between 3 and 10.
lorem.slug
`{{faker 'lorem.slug' 3}}` `voluptatem-amet-deleniti-earum-sit`
Generates a random Lorem slug.
  1. wordCount:number (Optional) - The number of the words that should be returned. Default `3`.
lorem.sentences
`{{faker 'lorem.sentences' 3 }}` `Sed et voluptate animi. Voluptatibus asperiores quis fugit labore soluta ipsum eum. Maxime non quo rerum laborum quibusdam consequatur.`
Generates a random Lorem sentences.
  1. sentenceCount:number (Optional) - The number of the sentences that should be returned. Default - random number between 3 and 10.
  2. separator:string (Optional) - The sentences separator. Default ` `.
lorem.paragraph
`{{faker 'lorem.paragraph' 3 }}` `Amet beatae aut. Laboriosam error deserunt unde. Quas explicabo omnis mollitia qui corporis sit nemo. Mollitia corporis possimus doloremque asperiores.`
Generates a random Lorem paragraph.
  1. sentenceCount:number (Optional) - The number of the sentences that should be returned. Default `3`.
lorem.paragraphs
`{{faker 'lorem.paragraphs' 1 }}` `Ipsam suscipit eaque exercitationem et delectus inventore molestiae omnis. Optio repellat nisi natus voluptas sequi. Accusantium quo deleniti esse est.`
Generates a random Lorem paragraphs.
  1. paragraphCount:number (Optional) - The number of the paragraphs that should be returned. Default `3`.
  2. separator:string (Optional) - The paragraphs separator. Default `\n \r`.
lorem.text
`{{faker 'lorem.text' 1 }}` `Aut repellendus facilis. Aspernatur expedita aut quibusdam eaque praesentium aut id id...`
Generates a random Lorem text. -----
lorem.lines
`{{faker 'lorem.lines' 1}}` ` A modi praesentium enim dolores.`
Generates a random Lorem lines.
  1. lineCount:number (Optional) - The number of the lines that should be returned. Default - random between 1 and 5.
name.firstName
`{{faker 'name.firstName' 'female' }}` `Libby`
Generates a random first name.
  1. gender:string (Optional) - The gender of the name. Default - random.
name.lastName
`{{faker 'name.lastName' }}` `Goodwin`
Generates a random last name.
  1. gender:string (Optional) - The gender of the surname. Default - random.
name.findName
`{{faker 'name.findName' }}` `Muriel Cruickshank`
Generates a random full name.
  1. firstName:string (Optional) - The first name. Default - random.
  2. lastName:string (Optional) - The last name. Default - random.
name.jobTitle
`{{faker 'name.jobTitle' }}` `Dynamic Functionality Associate`
Generates a random job title. -----
name.gender
`{{faker 'name.gender' }}` `Female`
Generates a random gender. -----
name.prefix
`{{faker 'name.prefix' }}` `Miss`
Generates a random name prefix.
  1. gender:string (Optional) - The gender of the prefix. Default - random.
name.suffix
`{{faker 'name.suffix' }}` `Jr.`
Generates a random name suffix. -----
name.title
`{{faker 'name.title' }}` `Corporate Web Strategist`
Generates a random personal title. -----
name.jobDescriptor
`{{faker 'name.jobDescriptor' }}` `Regional`
Generates a random job descriptor. -----
name.jobArea
`{{faker 'name.jobArea' }}` `Operations`
Generates a random job area. -----
name.jobType
`{{faker 'name.jobType' }}` `Administrator`
Generates a random job type. -----
phone.phoneNumber
`{{faker 'phone.phoneNumber' '(!##) !##-####' }}` `(450) 718-7354`
Generates a random phone number.
  1. format:string (Optional) - The format of the phone number. Default - depending on locale.
phone.phoneFormats
`{{faker 'phone.phoneFormats' }}` `1-!##-!##-#### x###`
Generates a random phone format. -----
random.number
`{{faker 'random.number' min=0 max=999 precision=0.1 }}` `531.4`
Generates a random number.
  1. min:number(hash) (Optional) - The minimum value. Default `0`.
  2. max:number(hash) (Optional) - The maximum value. Default `99999`.
  3. precision:float(hash) (Optional) - The precision. Default `1`.
random.float
`{{faker 'random.float' precision=0.01 }}` `24431.75`
Generates a random float number.
  1. precision:float(hash) (Optional) - The precision. Default `0.01`.
random.arrayElement
`{{faker 'random.arrayElement' (JSONparse '[1,2,3,4,5]') }}` `4`
Selects a random array element.
  1. array:array (Optional) - The array to pick values from. Default `["a", "b", "c"]`.
random.arrayElements
`{{JSONstringify (faker 'random.arrayElements' (JSONparse '[1,2,3,4,5]') 3 )}}` `[2,4,5]`
Selects a random subarray.
  1. array:array (Optional) - The array to pick values from. Default `["a", "b", "c"]`.
  2. count:number (Optional) - The length of output array. Default - the length of an input array.
random.objectElement
`{{faker 'random.objectElement' (JSONparse '{ "foo": "bar", "too": "car" }')}}` `bar`
Selects a random object element.
  1. object:object (Optional) - The object to pick values from. Default ` { "foo": "bar", "too": "car" }`.
  2. field:string (Optional) - The field to pick values from.
random.uuid
`{{faker 'random.uuid' }}` `ce8ab5db-e03c-48bc-bacb-152efc214b1b`
Generates a random UUID. -----
random.boolean
`{{faker 'random.boolean' }}` `true`
Generates a random boolean. -----
random.word
`{{faker 'random.word' }}` `envisioneer`
Generates a random word.
  1. type:string (Optional) - The type of word to be generated. Default - random value.
random.words
`{{faker 'random.words' 5 }}` `SMTP Berkshire Incredible Concrete Mouse protocol Jordan`
Generates a random words.
  1. count:number (Optional) - The number of words to be generated. Default - random value between 1 and 3.
random.image
`{{faker 'random.image' }}` `http://placeimg.com/640/480/cats`
Generates a random image URL. -----
random.locale
`{{faker 'random.locale' }}` `en`
Generates a random locale. -----
random.alpha
`{{faker 'random.alpha' count=10 upcase=true }}` `ZPKHASSAPD`
Generates a random alphabetic string.
  1. count:number(hash) (Optional) - The number of characters to generate. Default `1`.
  2. upcase:boolean(hash) (Optional) - The case of the output. Default `false`.
random.alphaNumeric
`{{faker 'random.alphaNumeric' 5 }}` `6tpyo`
Generates a random alphanumeric string.
  1. count:number (Optional) - The number of characters to generate. Default `1`.
random.hexaDecimal
`{{faker 'random.hexaDecimal'5 }}` `0xe6e36`
Generates a random hexadecimal number.
  1. count:number (Optional) - The number of characters to generate. Default `1`.
system.fileName
`{{faker 'system.fileName' }}` `hong_kong_dollar.karbon`
Generates a random file name. -----
system.commonFileName
`{{faker 'system.commonFileName' }}` `4th_generation_parsing.m1v`
Generates a random common file name. -----
system.mimeType
`{{faker 'system.mimeType' }}` ` text/1d-interleaved-parityfec`
Generates a random mime type. -----
system.commonFileType
`{{faker 'system.commonFileType' }}` `video`
Generates a random common file type. -----
system.commonFileExt
`{{faker 'system.commonFileExt' }}` `application/pdf`
Generates a random common file extension. -----
system.fileType
`{{faker 'system.fileType' }}` `chemical`
Generates a random file type. -----
system.fileExt
`{{faker 'system.fileExt' }}` `snf`
Generates a random file extension. -----
system.directoryPath
`{{faker 'system.directoryPath' }}` `/var/mail`
Generates a random durectory path. -----
system.filePath
`{{faker 'system.filePath' }}` `/var/spool/pula_optical.z7`
Generates a random file path. -----
system.semver
`{{faker 'system.semver' }}` `5.9.3`
Generates a random semantic version. -----
time.recent
`{{faker 'time.recent' 'abbr' }}` `3:39:12 PM`
Generates a random recent time.
  1. outputType:string (Optional) - The type of the output (`abbr`, `wide`, `unix`). Default `unix`.
vehicle.vehicle
`{{faker 'vehicle.vehicle' }}` `Cadillac Altima`
Generates a random vehicle. -----
vehicle.manufacturer
`{{faker 'vehicle.manufacturer' }}` `Mini`
Generates a random vehicle manufacturer. -----
vehicle.model
`{{faker 'vehicle.model' }}` `Aventador`
Generates a random vehicle model. -----
vehicle.type
`{{faker 'vehicle.type' }}` `Wagon`
Generates a random vehicle type. -----
vehicle.fuel
`{{faker 'vehicle.fuel' }}` `Electric`
Generates a random fuel name. -----
vehicle.vin
`{{faker 'vehicle.vin' }}` `ICSGO2TLAILJ88512`
Generates a random vehicle VIN number. -----
vehicle.color
`{{faker 'vehicle.color' }}` `ivory`
Generates a random vehicle color. -----

Log helper

log ...arguments - allows for logging of context state while executing a template. Logged messages are available in the workspace's Request Log

Example 1

Request body:

{"name" : "John", "surname": "Doe"}

Template:

{{~log 'Request body is: ' req.body~}}

Logged message:

2020-05-27T13:17:04.963Z - Request body is: {"name" : "John", "surname": "Doe"}

JSON Path Helper

jsonPathGet '<path>' object - Evaluates JSONPath expression. JSONPath is a query language for JSON, similar to XPath for XML. This helper allows extracting data from a JSON object. See more about JSONPath.

Parameter Description Default value
path Valid JSONPath expression Tester. If path is incorrect empty string will be returned. none
object JS object to extract data from. You may use JSONparse helper to parse string to JS object. none
Example 1

Request body:

{"name" : "John", "surname": "Doe"}

Template:

{{jsonPathGet '$.name' (JSONparse req.body) }}

Rendered response body:

John

Other helpers

Next to the set of helpers described above template mocks also support the following third-party helpers provided by the project handlebars-helpers:

array helpers - (Documentation)
{{after}} Returns all of the items in an array after the specified index.
{{arrayify}} Cast the given value to an array.
{{before}} Return all of the items in the collection before the specified count. Opposite of after.
{{eachIndex}}
{{filter}} Block helper that filters the given array and renders the block for values that evaluate to true, otherwise the inverse block is returned.
{{first}} Returns the first item, or first n items of an array.
{{forEach}} Iterates over each item in an array and exposes the current item in the array as context to the inner block.
{{inArray}} Block helper that renders the block if an array has the given value. Optionally specify an inverse block to render when the array does not have the given value.
{{isArray}} Returns true if value is an es5 array.
{{itemAt}} Returns the item from array at index idx.
{{join}} Join all elements of array into a string, optionally using a given separator.
{{equalsLength}} Returns true if the the length of the given value is equal to the given length. Can be used as a block or inline helper.
{{last}} Returns the last item, or last n items of an array or string. Opposite of first.
{{length}} Returns the length of the given string or array.
{{lengthEqual}} Alias for equalsLength
{{pluck}} Map over the given object or array or objects and create an array of values from the given prop. Dot-notation may be used (as a string) to get nested properties.
{{reverse}} Reverse the elements in an array, or the characters in a string.
{{some}} Block helper that returns the block if the callback returns true for some value in the given array.
{{sort}} Sort the given array. If an array of objects is passed, you may optionally pass a key to sort on as the second argument. You may alternatively pass a sorting function as the second argument.
{{sortBy}} Sort an array. If an array of objects is passed, you may optionally pass a key to sort on as the second argument. You may alternatively pass a sorting function as the second argument.
{{withAfter}} Use the items in the array after the specified index as context inside a block. Opposite of withBefore.
{{withBefore}} Use the items in the array before the specified index as context inside a block. Opposite of withAfter.
{{withFirst}} Use the first item in a collection inside a handlebars block expression. Opposite of withLast.
{{withGroup}} Block helper that groups array elements by given group size.
{{withLast}} Use the last item or n items in an array as context inside a block. Opposite of withFirst.
{{withSort}} Block helper that sorts a collection and exposes the sorted collection as context inside the block.
{{unique}} Block helper that return an array with all duplicate values removed. Best used along with a each helper.
collection helpers - (Documentation)
{{isEmpty}} Inline, subexpression, or block helper that returns true (or the block) if the given collection is empty, or false (or the inverse block, if supplied) if the colleciton is not empty.
comparison helpers - (Documentation)
{{and}} Helper that renders the block if both of the given values are truthy. If an inverse block is specified it will be rendered when falsy. Works as a block helper, inline helper or subexpression.
{{compare}} Render a block when a comparison of the first and third arguments returns true. The second argument is the arithemetic operator to use. You may also optionally specify an inverse block to render when falsy.
{{contains}} Block helper that renders the block if collection has the given value, using strict equality (===) for comparison, otherwise the inverse block is rendered (if specified). If a startIndex is specified and is negative, it is used as the offset from the end of the collection.
{{default}} Returns the first value that is not undefined, otherwise the "default" value is returned.
{{eq}} Block helper that renders a block if a is equal to b. If an inverse block is specified it will be rendered when falsy. You may optionally use the compare="" hash argument for the second value.
{{gt}} Block helper that renders a block if a is greater than b.
{{gte}} Block helper that renders a block if a is greater than or equal to b.
{{has}} Block helper that renders a block if value has pattern. If an inverse block is specified it will be rendered when falsy.
{{isFalsey}} Returns true if the given value is falsey. Uses the falsey library for comparisons. Please see that library for more information or to report bugs with this helper.
{{isTruthy}} Returns true if the given value is truthy. Uses the falsey library for comparisons. Please see that library for more information or to report bugs with this helper.
{{ifEven}} Return true if the given value is an even number.
{{ifNth}} Conditionally renders a block if the remainder is zero when a operand is divided by b. If an inverse block is specified it will be rendered when the remainder is not zero.
{{ifOdd}} Block helper that renders a block if value is an odd number. If an inverse block is specified it will be rendered when falsy.
{{is}} Block helper that renders a block if a is equal to b. If an inverse block is specified it will be rendered when falsy. Similar to eq but does not do strict equality.
{{isnt}} Block helper that renders a block if a is not equal to b. If an inverse block is specified it will be rendered when falsy. Similar to unlessEq but does not use strict equality for comparisons.
{{lt}} Block helper that renders a block if a is less than b.
{{lte}} Block helper that renders a block if a is less than or equal to b.
{{neither}} Block helper that renders a block if neither of the given values are truthy. If an inverse block is specified it will be rendered when falsy.
{{not}} Returns true if val is falsey. Works as a block or inline helper.
{{or}} Block helper that renders a block if any of the given values is truthy. If an inverse block is specified it will be rendered when falsy.
{{unlessEq}} Block helper that always renders the inverse block unless a is is equal to b.
{{unlessGt}} Block helper that always renders the inverse block unless a is is greater than b.
{{unlessLt}} Block helper that always renders the inverse block unless a is is less than b.
{{unlessGteq}} Block helper that always renders the inverse block unless a is is greater than or equal to b.
{{unlessLteq}} Block helper that always renders the inverse block unless a is is less than or equal to b.
html helpers - (Documentation)
{{attr}} Stringify attributes on the options hash.
{{sanitize}} Strip HTML tags from a string, so that only the text nodes are preserved.
{{ul}} Block helper for creating unordered lists (
    )
    {{ol}} Block helper for creating ordered lists (
      )
      inflection helpers - (Documentation)
      {{inflect}} Returns either the singular or plural inflection of a word based on the given count.
      {{ordinalize}} Returns an ordinalized number as a string.
      math helpers - (Documentation)
      {{abs}} Return the magnitude of a.
      {{add}} Return the sum of a plus b.
      {{avg}} Returns the average of all numbers in the given array.
      {{ceil}} Get the Math.ceil() of the given value.
      {{divide}} Divide a by b
      {{floor}} Get the Math.floor() of the given value.
      {{minus}} Return the difference of a minus b.
      {{modulo}} Get the remainder of a division operation.
      {{multiply}} Return the product of a times b.
      {{plus}} Add a by b.
      {{random}} Generate a random number between two values
      {{remainder}} Get the remainder when a is divided by b.
      {{round}} Round the given number.
      {{subtract}} Return the product of a minus b.
      {{sum}} Returns the sum of all numbers in the given array.
      {{times}} Multiply number a by number b.
      misc helpers - (Documentation)
      {{option}} Return the given value of prop from this.options.
      {{noop}} Block helper that renders the block without taking any arguments.
      {{typeOf}} Get the native type of the given value
      {{withHash}} Block helper that builds the context for the block from the options hash.
      number helpers - (Documentation)
      {{bytes}} Format a number to it's equivalent in bytes. If a string is passed, it's length will be formatted and returned.
      {{addCommas}} Add commas to numbers
      {{phoneNumber}} Convert a string or number to a formatted phone number.
      {{toAbbr}} Abbreviate numbers to the given number of precision. This is for general numbers, not size in bytes.
      {{toExponential}} Returns a string representing the given number in exponential notation.
      {{toFixed}} Formats the given number using fixed-point notation.
      {{toFloat}}
      {{toInt}}
      {{toPrecision}} Returns a string representing the Number object to the specified precision.
      object helpers - (Documentation)
      {{extend}} Extend the context with the properties of other objects. A shallow merge is performed to avoid mutating the context.
      {{forIn}} Block helper that iterates over the properties of an object, exposing each key and value on the context.
      {{forOwn}} Block helper that iterates over the own properties of an object, exposing each key and value on the context.
      {{toPath}} Take arguments and, if they are string or number, convert them to a dot-delineated object property path.
      {{get}} Use property paths (a.b.c) to get a value or nested value from the context. Works as a regular helper or block helper.
      {{getObject}} Use property paths (a.b.c) to get an object from the context. Differs from the get helper in that this helper will return the actual object, including the given property key. Also, this helper does not work as a block helper.
      {{hasOwn}} Return true if key is an own, enumerable property of the given context object.
      {{isObject}} Return true if value is an object.
      {{JSONparse}} Parses the given string using JSON.parse.
      {{JSONstringify}} Stringify an object using JSON.stringify.
      {{merge}} Deeply merge the properties of the given objects with the context object.
      {{pick}} Pick properties from the context object.
      regex helpers - (Documentation)
      {{toRegex}} Convert the given string to a regular expression.
      {{test}} Returns true if the given str matches the given regex. A regex can be passed on the context, or using the toRegex helper as a subexpression.
      string helpers - (Documentation)
      {{append}} Append the specified suffix to the given string.
      {{camelcase}} camelCase the characters in the given string.
      {{capitalize}} Capitalize the first word in a sentence.
      {{capitalizeAll}} Capitalize all words in a string.
      {{center}} Center a string using non-breaking spaces
      {{chop}} Like trim, but removes both extraneous whitespace and non-word characters from the beginning and end of a string.
      {{dashcase}} dash-case the characters in string. Replaces non-word characters and periods with hyphens.
      {{dotcase}} dot.case the characters in string.
      {{downcase}} Lowercase all of the characters in the given string. Alias for lowercase.
      {{ellipsis}} Truncates a string to the specified length, and appends it with an elipsis, ….
      {{hyphenate}} Replace spaces in a string with hyphens.
      {{isString}} Return true if value is a string.
      {{lowercase}} Lowercase all characters in the given string.
      {{occurrences}} Return the number of occurrences of substring within the given string.
      {{pascalcase}} PascalCase the characters in string.
      {{pathcase}} path/case the characters in string.
      {{plusify}} Replace spaces in the given string with pluses.
      {{prepend}} Prepends the given string with the specified prefix.
      {{raw}} Render a block without processing mustache templates inside the block.
      {{remove}} Remove all occurrences of substring from the given str.
      {{removeFirst}} Remove the first occurrence of substring from the given str.
      {{replace}} Replace all occurrences of substring a with substring b.
      {{replaceFirst}} Replace the first occurrence of substring a with substring b.
      {{reverse}} Reverse a string.
      {{sentence}} Sentence case the given string
      {{snakecase}} snake_case the characters in the given string.
      {{split}} Split string by the given character.
      {{startsWith}} Tests whether a string begins with the given prefix.
      {{titleize}} Title case the given string.
      {{trim}} Removes extraneous whitespace from the beginning and end of a string.
      {{trimLeft}} Removes extraneous whitespace from the beginning of a string.
      {{trimRight}} Removes extraneous whitespace from the end of a string.
      {{truncate}} Truncate a string to the specified length. Also see ellipsis.
      {{truncateWords}} Truncate a string to have the specified number of words. Also see truncate.
      {{upcase}} Uppercase all of the characters in the given string. Alias for uppercase.
      {{uppercase}} Uppercase all of the characters in the given string. If used as a block helper it will uppercase the entire block. This helper does not support inverse blocks.
      url helpers - (Documentation)
      {{encodeURI}} Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.
      {{escape}} Escape the given string by replacing characters with escape sequences. Useful for allowing the string to be used in a URL, etc.
      {{decodeURI}} Decode a Uniform Resource Identifier (URI) component.
      {{urlResolve}} Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag.
      {{urlParse}} Parses a url string into an object.
      {{stripQuerystring}} Strip the query string from the given url.
      {{stripProtocol}} Strip protocol from a url. Useful for displaying media that may have an 'http' protocol on secure connections.

      Last update: September 3, 2020