Formulas reference

Browse the built-in formulas in Nordcraft, which you can use to transform data, perform calculations, and implement conditional logic throughout your application.

Tip

To learn more about formulas, check out the formulas overview.

Get the absolute value of a Number.

Arguments

NameTypeDescription
ValueNumberThe input Number.

Output

TypeDescription
NumberThe absolute value of the input.

Get the sum of multiple numbers.

Arguments

NameTypeDescription
0NumberNumber to be added.
1NumberNumber to be added.

Output

TypeDescription
NumberThe sum of all the input numbers.

Add an element to the end of an Array.

Arguments

NameTypeDescription
ArrayArrayThe Array to append to.
ItemAnyThe item to append to the Array.

Output

TypeDescription
ArrayA new Array containing all elements from the input Array, including the new item.

Convert a value of any type to a Boolean.

Arguments

NameTypeDescription
InputAnyValue of any type.

Output

TypeDescription
BooleanThe input value converted to a Boolean. False and Null will return False, all other values will return True.

Branch NameView on GitHub

Get the name of the current branch. For production, the branch name is 'main'.

Output

TypeDescription
StringReturns the name of the current branch.

Return a Boolean indicating whether the provided data can be shared (with the "Share" action).

Arguments

NameTypeDescription
URLStringThe URL you want to check.
TitleStringThe title you want to check.
TextStringThe text you want to check.

CapitalizeView on GitHub

Capitalize a string: make the first letter uppercase whilst keeping the rest lowercase.

Arguments

NameTypeDescription
StringStringAn input String.

Output

TypeDescription
StringThe capitalized String.

Limit a value to a specified Min and Max value.

Arguments

NameTypeDescription
ValueNumberNumber to round.
MinNumberThe smallest allowed Number.
MaxNumberThe largest allowed Number.

Output

TypeDescription
NumberReturns the input value if between the specified Min and Max. Otherwise, it returns the Min or Max value.

ConcatenateView on GitHub

Concatenate two or more values.

Arguments

NameTypeDescription
0Array | String | ObjectThis is text

Output

TypeDescription
Array | String | ObjectReturns a String, Array or Object containing all the specified input values.

Current URLView on GitHub

Return the current URL of the browser. Use the "Parse URL" formula for working with the URL.

Output

TypeDescription
StringThe browser's current URL.

Date From StringView on GitHub

Convert a string to a Date.

Arguments

NameTypeDescription
Date stringStringA String representing a date, for example "January 1, 1970".

Output

TypeDescription
DateThe input value converted to a Date.

Date From TimestampView on GitHub

Convert a timestamp (milliseconds) to a Date.

Arguments

NameTypeDescription
TimestampNumberA Number in milliseconds since 1st January, 1970 (EPOCH).

Output

TypeDescription
DateThe input value converted to a Date.

Decode URI ComponentView on GitHub

Decode a URI component that was previously encoded with the Encode URI Component formula.

Arguments

NameTypeDescription
EncodedURIStringThe encoded URI to decode.

Output

TypeDescription
StringThe decoded URI component.

Decode base64View on GitHub

Deocde a base64 string to utf-8.

Arguments

NameTypeDescription
Base64 valueStringThe input data encoded as base64.

Output

TypeDescription
StringThe decoded string.

Default toView on GitHub

Return the first value that is not False or Null.

Arguments

NameTypeDescription
0AnyThe inital value.
1AnyThe first fallback value to be used if the primary value is Null or False.

Output

TypeDescription
AnyReturns the first value that is not False or Null. Returns Null if no valid values is given.

Return a copy of the input Object or Array without the specified key.

Arguments

NameTypeDescription
ObjectArray | ObjectThe input record.
PathArray<Number | String> | Number | StringThe path can be either a Number (if the first argument is an array), a String, or an Array of strings. If an Array is given, the property at that path will be removed.

Output

TypeDescription
ObjectA copy of the record without the property specified in the Path.

Perform a division calculation.

Arguments

NameTypeDescription
DividendNumberThe number to be divided.
DivisorNumberThe number to divide by.

Output

TypeDescription
NumberThe result of dividing the dividend with the divisor.

Remove items from the beginning of an Array or String.

Arguments

NameTypeDescription
ArrayArray | StringThe input value.
CountNumberNumber of items to remove.

Output

TypeDescription
Array | StringA copy of the list without the first items.

Remove item(s) from the end of an Array or String.

Arguments

NameTypeDescription
ArrayArray | StringThe input value.
CountNumberNumber of items to remove.

Output

TypeDescription
Array | StringA copy of the list without the last item(s).

Encode JSONView on GitHub

Encode data as JSON.

Arguments

NameTypeDescription
DataAnyThe data to convert.
IndentNumberHow many characters the encoded value will be indented.

Output

TypeDescription
StringThe encoded JSON value.

Encode URI ComponentView on GitHub

Encode a URI component, escaping certain characters to their UTF-8 representation.

Arguments

NameTypeDescription
URIComponentStringThe URI component to encode.

Output

TypeDescription
StringThe encoded URI component.

Encode to base64View on GitHub

Encode a string to base64.

Arguments

NameTypeDescription
ValueStringThe input string to be encoded.

Output

TypeDescription
StringThe base 64 encoded string.

Get an Array of entries from a given Object.

Arguments

NameTypeDescription
ObjectObjectInput record

Output

TypeDescription
ArrayReturns an Array of entries for the given input record. The entries are Objects with a “key” and “value” property.

Compute if values are identical.

Arguments

NameTypeDescription
FirstAnyFirst Value
SecondAnySecond Value

Output

TypeDescription
BooleanReturns True if the input values are identical, otherwise False.

Run a formula returns for all items in an Array.

Arguments

NameTypeDescription
ArrayArrayThe array of items to evaluate.
FormulaFormulaPredicate formula for evaluating each item.

Output

TypeDescription
ArrayReturns True if the predicate formula returns true for all items in the Array, otherwise False.

Return a new Array containing only the elements for which the provided formula evaluates to True.

Arguments

NameTypeDescription
ArrayArrayThe array of items to be filtered.
FormulaFormulaPredicate formula for filtering items.

Output

TypeDescription
ArrayNew Array containing only the items for which the Formula evaluated to True.

Search through an Array of items and apply a formula to each item, to return the first item where the provided formula returns True.

Arguments

NameTypeDescription
ArrayArrayThe array to search through
FormulaFormulaThe predicate formula that each item in the array is passed to.

Output

TypeDescription
AnyThe first item in the Array where the formula returns True. Returns Null if the predicate formula did not return True for any item.

Search through an Array of items and apply a formula to each item, to return the last item where the formula returns True.

Arguments

NameTypeDescription
ArrayArrayThe array to search.
FormulaFormulaThe predicate formula that each item in the Array is passed to.

Output

TypeDescription
AnyThe last item in the Array where the formula returns True. Returns Null if the predicate formula did not return True for any item.

Find indexView on GitHub

Search through an Array of items and apply a formula to each item, to return the index of the first item where the formula returns True.

Arguments

NameTypeDescription
ArrayArrayThe array to search.
FormulaFormulaThe predicate formula that each item in the Array is passed to.

Output

TypeDescription
AnyThe index of the first item in the Array where the predicate formula returns True. Returns -1 if the predicate formula did not return True for any item.

Return the first item in an Array or the first character in a String.

Arguments

NameTypeDescription
ArrayArray | StringAn Array of items or a String.

Output

TypeDescription
AnyThe first item in the Array or the first character in the String.

Flatten a nested Array.

Arguments

NameTypeDescription
ArrayArrayAn Array containing one or more Arrays.

Output

TypeDescription
ArrayA flattened Array where all items in the original array are concatenated.

Format DateView on GitHub

Format a date using the Intl.DateTimeFormat API. See the DateTimeFormat docs on MDN.

Arguments

NameTypeDescription
DateDateDate to format
Locale(s)Array | StringOptional locale to use for formatting the Date, e.g. "en" or "fr". Multiple locales can be provided (as an Array of Strings) to provide a fallback locale. The default value is the runtime's locale.
OptionsObjectOptional Object for configuring the formatting of the output. See the DateTimeFormat syntax on MDN.

Output

TypeDescription
StringThe Date input formatted as a String.

Format NumberView on GitHub

Format a Number using the Intl.NumberFormat API. See the NumberFormat docs on MDN.

Arguments

NameTypeDescription
InputNumberNumber to format.
Locale(s)Array | StringOptional locale to use for formatting the Number, e.g. "en" or "fr". Multiple locales can be provided (as an Array of Strings) to provide a fallback locale. The default value is the runtime's locale.
OptionsObjectOptional Object for configuring the formatting of the output. See the NumberFormat locale options on MDN.

Output

TypeDescription
StringThe Number input formatted as a String.

From entriesView on GitHub

Transform an Array of key-value pairs into an Object. This formula is the reverse of Entries.

Arguments

NameTypeDescription
ArrayArrayAn Array of Objects. Each Object should have a key and value property named key and value respectively e.g. [{ key: 'yourKey', value: 'yourValue' }].

Output

TypeDescription
ObjectAn Object containing all entries from the input Array in the format {yourKey: yourValue}.

Extract a value from an Object, Array or String at the specified path.

Arguments

NameTypeDescription
ObjectArray | Object | StringThe Object, Array or String you want to extract an item from.
PathArray | Number | StringThe Path can be either a Number, a String, or an Array.

Output

TypeDescription
AnyThe value found at the Path. If no value is found, this value of the output is Null.

Get element by idView on GitHub

Return a DOM element with a given id.

Arguments

NameTypeDescription
IdStringThe id of the DOM element to return.

Output

TypeDescription
ElementThe DOM element with the given id. If no DOM element is found, this will return Null.

Get from Local StorageView on GitHub

Read a value from local storage with the provided key.

Arguments

NameTypeDescription
KeyStringThe key to read from local storage.

Output

TypeDescription
AnyThe value found in local storage. If no value is found, this will return Null.

Get from Session StorageView on GitHub

Read a value from session storage with the provided key.

Arguments

NameTypeDescription
KeyStringThe key to read from session storage.

Output

TypeDescription
AnyThe value found in session storage.

Greater or equalView on GitHub

Compute whether a value is larger than or equal to another value.

Arguments

NameTypeDescription
FirstNumberFirst value to be compared.
SecondNumberSecond value to be compared.

Output

TypeDescription
BooleanReturns True if the first Number is larger than or equal to the second Number.

Greater thanView on GitHub

Compute if a value is larger than another value.

Arguments

NameTypeDescription
FirstNumberFirst value to be compared.
SecondNumberSecond value to be compared.

Output

TypeDescription
BooleanReturns True if the first Number is larger than the second Number.

Group an Array of items into an Object based on a grouping formula.

Arguments

NameTypeDescription
ArrayArrayArray of items to be grouped.
FormulaFormulaThe grouping formula used to group the items. The String returned from the formula will match the key in the output Oject.

Output

TypeDescription
ObjectAn Object where each key matches a value returned by the grouping formula, and each value is the list of items that share the return value.

Test if an Array or String includes a specific item or value.and String.prototype.includes on MDN for more information.

Arguments

NameTypeDescription
ArrayArray | StringThe value to search.
ItemAnyThe item or value to search for.

Output

TypeDescription
BooleanReturns True if the item or value exists in the Array or string. Returns False if no match is found.

Find the index of a specific item in an Array or String.and String.prototype.indexOf on MDN for more information.

Arguments

NameTypeDescription
ArrayArray | StringThe value to search.
ItemAnyThe items to search for.

Output

TypeDescription
NumberIf the item exists in the Array, the index of that item is returned. If the item is not found, -1 is returned.

Get information about whether formulas are currently evaluated server-side or client-side.

Output

TypeDescription
BooleanReturns True if formulas are evaluated server-side, and False if formulas are evaluated client-side.

Convert a value into a JSON String.

Arguments

NameTypeDescription
InputAnyThe input value.
IndentationNumberThe number of spaces used for indentation in the JSON String.

Output

TypeDescription
StringThe JSON String.

Combine an Array of Strings into a single String.

Arguments

NameTypeDescription
ArrayArrayAn array of Strings.
SeparatorStringA separator String that is inserted in between each item in the Array to join.

Output

TypeDescription
StringA String combining each item in the input Array separated by the separator String, e.g. joining ["a", "b", "c"] with a "," separator will return "a,b,c".

Organize an Array of items into an Object based on a Key formula.

Arguments

NameTypeDescription
ArrayArrayArray of items.
FormulaFormulaThe key formula used to index the items. The String returned from the formula will match the key in the output Object.

Output

TypeDescription
ObjectAn Object where each key matches a value returned by the key formula, and each value is the item that String was returned for.

An array of the preferred languages for the user, based on the Navigator.languages property (on the client) or the Accept-Language header (on the server).

Output

TypeDescription
ArrayAn array with the preferred languages for the user.

Get the last item in an Array or the last character in a String.

Arguments

NameTypeDescription
ArrayArray | StringAn array of items or a String.

Output

TypeDescription
AnyThe last item in the Array or the last character in the String.

Last Index ofView on GitHub

Search an Array or String to find the index of the last occurrence of a specified item or substring.

Arguments

NameTypeDescription
ArrayArray | StringThe value to search.
ItemAnyThe item or substring to search for.

Output

TypeDescription
NumberIf the item or substring exists in the Array, the last index of that item is returned. If the item is not found, -1 is returned.

Less or equalView on GitHub

Compute if a value is smaller than or equal to another value.

Arguments

NameTypeDescription
FirstNumberFirst Number to be compared.
SecondNumberSecond Number to be compared.

Output

TypeDescription
BooleanReturns True if the First Number is smaller than or equal to the second Number, otherwise it returns False.

Compute if a value is smaller than another value.

Arguments

NameTypeDescription
FirstNumberFirst Number to be compared.
SecondNumberSecond Number to be compared.

Output

TypeDescription
BooleanReturns True if the First Number is smaller than the second Number, otherwise it returns False.

Return the logarithm of a Number.

Arguments

NameTypeDescription
NumberNumberA Number greater than or equal to 0.

Output

TypeDescription
NumberThe natural logarithm of the Number.

Lower caseView on GitHub

Convert a string to lowercase.

Arguments

NameTypeDescription
StringStringInput String

Output

TypeDescription
StringThe input String with all characters converted to lowercase.

Run a formula on each item of an Array to return a new Array.

Arguments

NameTypeDescription
ArrayArrayThe Array of items.
FormulaFormulaThe formula to run on each item of the Array.

Output

TypeDescription
ArrayA new Array containing all the values returned from running the provided formula on each item in the provided input Array.

Finds the (global) matches in a String based on a regular expression.

Arguments

NameTypeDescription
InputStringThe string to search for matches in.
Regular expressionStringThe regular expression to use for matching.
Global searchBooleanTest the regular expression against all possible matches in a string.
Case insensitiveBooleanIgnore case while attempting a match in a string.
Multi lineBooleanTreat multiline strings as multiple lines.

Output

TypeDescription
ArrayAn Array of Strings

Find the largest Number from a list of inputs.

Arguments

NameTypeDescription
0NumberInput Number.
1NumberInput Number.

Output

TypeDescription
NumberThe largest of the input Numbers.

Find the smallest Number from a list of inputs.

Arguments

NameTypeDescription
0NumberInput number
1NumberInput number

Output

TypeDescription
NumberThe smallest of the input Numbers.

Subtract a Number from a Number.

Arguments

NameTypeDescription
MinuendNumberThe number to subtract from.
SubstrahendNumberThe number to subtract.

Output

TypeDescription
NumberThe result of subtracting the Substrahend from the Minuend.

Get the remainder when dividing two Numbers.

Arguments

NameTypeDescription
DividendNumberThe number to be divided.
DividerNumberThe number to divide by.

Output

TypeDescription
NumberThe remainder when the Dividend is divided by the Divider.

Multiply two or more Numbers.

Arguments

NameTypeDescription
0NumberNumber to be multiplied.
1NumberNumber to be multiplied.

Output

TypeDescription
NumberThe product of multiplying the input Numbers.

Get the Boolean opposite of an input value.

Arguments

NameTypeDescription
InputBooleanThe input value.

Output

TypeDescription
BooleanReturns True if the input value is False, and False if the input value is True.

Compute if values are not identical.

Arguments

NameTypeDescription
FirstAnyFirst value.
SecondAnySecond value.

Output

TypeDescription
AnyReturns True if the values are not identical, otherwise False.

Get a Date representing "Now".

Output

TypeDescription
DateA Date object initialized at the current date/time.

Convert a value of any type to a Number.

Arguments

NameTypeDescription
InputAnyValue of any type

Output

TypeDescription
NumberThe input value converted to a Number.

Parse JSONView on GitHub

Parse a String to JSON.

Arguments

NameTypeDescription
JSON stringStringThe String to be parsed.

Output

TypeDescription
AnyThe parsed JSON value. If the input is not a valid String, this returns Null.

Parse a URL.

Arguments

NameTypeDescription
URLStringThe URL value to parse.
BaseStringAn optional base for the URL. Use this to resolve relative URLs.

Output

TypeDescription
ObjectAn object containing: "hostname", "searchParams", "path", "hash", "href", "protocol", "port", "origin"

Raise a number to a power.

Arguments

NameTypeDescription
BaseNumberThe number to be raised to the exponent.
ExponentNumberThe exponent to raise the base to.

Output

TypeDescription
NumberThe result of raising the base to the exponent.

Add an element to the start of an Array.

Arguments

NameTypeDescription
ArrayArrayThe Array to prepend to.
ItemAnyThe item to prepend to the Array.

Output

TypeDescription
ArrayA new Array containing the new item and all the elements from the input Array.

Random numberView on GitHub

Return a random Number between 0 and 1.

Output

TypeDescription
NumberA random Number between 0 and 1.

Create an Array of numbers between a Min and Max value.

Arguments

NameTypeDescription
MinNumberThe smallest value in the list.
MaxNumberThe largest value in the list.

Output

TypeDescription
ArrayAn Array containing all the numbers between Min and Max, inclusive.

Reduce a group of items to a single value by applying each item to a reducer formula.

Arguments

NameTypeDescription
ArrayArray | ObjectThe Array or Object of items to be reduced.
FormulaFormulaThe reducer formula. Each item in the Array is applied to the formula along with the accumulator. The result of this formula will be a new accumulator used for the next item.
AccumulatorAnyThe initial value of the accumulator. This value is passed to the reducer formula along with the first item in the Array, and the result is used as the accumulator for the next item.

Output

TypeDescription
AnyThe value returned from applying the last item to the reducer formula.

Replace allView on GitHub

Replace all occurrences of a substring in a String.

Arguments

NameTypeDescription
InputStringThe input String to search in.
SearchStringThe substring to search for.
Replace withStringThe replacement value.

Output

TypeDescription
StringThe resulting String.

Reverse the order of an Array.

Arguments

NameTypeDescription
ArrayArrayThe Array to be reversed.

Output

TypeDescription
ArrayThe reversed Array.

Round a Number to the nearest decimal point.

Arguments

NameTypeDescription
InputNumberNumber to round.
DecimalsNumberNumber of decimals to round to.

Output

TypeDescription
NumberThe rounded Number.

Round downView on GitHub

Round a Number down to the nearest decimal point.

Arguments

NameTypeDescription
InputNumberNumber to round down.
DecimalsNumberNumber of decimals to round to.

Output

TypeDescription
NumberThe rounded Number.

Round a Number up to the nearest decimal point.

Arguments

NameTypeDescription
InputNumberNumber to round up.
DecimalsNumberNumber of decimals to round to.

Output

TypeDescription
NumberThe rounded Number.

Set a value in an Object or Array based on a specified path.

Arguments

NameTypeDescription
ObjectObjectThe input Object.
PathArray | Number | StringThe Path can be either a Number, a String or an Array of Strings.
ValueAnyThe value to set.

Output

TypeDescription
ObjectThe input Object with the new field.

Shuffle items in an Array or String.

Arguments

NameTypeDescription
ArrayArray | StringThe input value.

Output

TypeDescription
Array | StringThe shuffled Array or String.

Get the size of an Array, Object or String.

Arguments

NameTypeDescription
CollectionArray | Object | StringThe collection to get the size of.

Output

TypeDescription
NumberThe size of the collection.

Run a formula on all items of an Array to determine if any item matches a set of conditions.

Arguments

NameTypeDescription
ArrayArrayThe Array of items to evaluate.
FormulaFormulaPredicate formula for evaluating each item.

Output

TypeDescription
BooleanReturns True if the predicate formula returns True for any items in the Array, otherwise False.

Sort an Array using a formula.

Arguments

NameTypeDescription
ArrayArrayThe input Array.
FormulaFormulaThe sorting formula. The output of this formula will determine the sort order of the items. If the formula returns an Array, the items will first be sorted by the first item, then the second, etc.
Ascending?BooleanShould the list be sorted in ascending order?

Output

TypeDescription
NumberThe input Array sorted by the value returned by the sorting formula.

Split a String into an Array of smaller strings each time a delimiter occurs. The delimiter will not be part of the output.

Arguments

NameTypeDescription
InputStringThe String to split.
DelimiterStringThe string to split by.

Output

TypeDescription
ArrayAn array of Strings.

Square rootView on GitHub

Get the square root of a Number.

Arguments

NameTypeDescription
NumberNumberThe input Number.

Output

TypeDescription
NumberThe square root of the input Number.

Starts withView on GitHub

Check if a String has a given prefix.

Arguments

NameTypeDescription
StringStringThe String to check.
PrefixStringThe prefix to check for.

Output

TypeDescription
BooleanReturns True if the input String starts with the prefix, otherwise False

Convert a value of any type to a String.

Arguments

NameTypeDescription
InputAnyValue of any type.

Output

TypeDescription
StringThe input value converted to a String

Return the sum of an Array of numbers.

Arguments

NameTypeDescription
ArrayArrayThe array of numbers to sum.

Output

TypeDescription
NumberThe total sum from adding all the numbers in the Array.

Take items from the start of an Array or String.

Arguments

NameTypeDescription
ArrayArray | StringInput Array or String.
CountNumberNumber of items to take.

Output

TypeDescription
Array | StringThe first items from the Array or String.

Take items from the end of an Array or String.

Arguments

NameTypeDescription
ArrayArray | StringThe input value.
CountNumberNumber of items to take.

Output

TypeDescription
Array | StringThe last items from the Array or String.

Get the timestamp from a Date, e.g. 1633462980000.

Arguments

NameTypeDescription
DateDateThe date to get the timestamp from.

Output

TypeDescription
NumberThe timestamp from the date input.

Remove any leading and trailing white spaces from a String.

Arguments

NameTypeDescription
StringStringThe String to trim.

Output

TypeDescription
StringThe trimmed String.

Get the type of a given input.

Arguments

NameTypeDescription
InputAnyThe input value.

Output

TypeDescription
AnyThe type of the input value. Types can be one of: String, Boolean, Number, Array, Object, or Null.

Remove duplicate values from an Array.

Arguments

NameTypeDescription
ArrayArrayThe input Array.

Output

TypeDescription
ArrayThe input Array with all duplicate values removed.

Convert a String to uppercase.

Arguments

NameTypeDescription
StringStringInput String.

Output

TypeDescription
StringThe input String with all characters converted to uppercase.

User AgentView on GitHub

Get the user agent for the browser or from the User-Agent header on the server. See User-Agent on MDN for more information.

Output

TypeDescription
StringThe user agent string.
08/15/2025
Edit article
Help Forum