mirror of
https://github.com/n8n-io/n8n-docs.git
synced 2026-03-27 09:28:43 +07:00
493 lines
18 KiB
YAML
493 lines
18 KiB
YAML
df_types:
|
|
- df_durationUnit: &df_durationUnit
|
|
- second
|
|
- minute
|
|
- hour
|
|
- day
|
|
- week
|
|
- month
|
|
- year
|
|
df_string:
|
|
- funcName: base64Encode
|
|
returns: A base64 encoded string.
|
|
description: Encode a string as base64.
|
|
- funcName: base64Decode
|
|
returns: A plain string.
|
|
description: Convert a base64 encoded string to a normal string.
|
|
- funcName: extractDomain
|
|
returns: String
|
|
description: Extracts a domain from a string containing a valid URL. Returns undefined if none is found.
|
|
- funcName: extractEmail
|
|
returns: String
|
|
description: Extracts an email from a string. Returns undefined if none is found.
|
|
- funcName: extractUrl
|
|
returns: String
|
|
description: Extracts a URL from a string. Returns undefined if none is found.
|
|
- funcName: extractUrlPath
|
|
returns: String
|
|
description: Extract the path but not the root domain from a URL. For example, <code>"https://example.com/orders/1/details".extractUrlPath()</code> returns <code>"/orders/1/details/"</code>.
|
|
- funcName: hash
|
|
args:
|
|
- argName: algo
|
|
optional: true
|
|
longName: Algorithm
|
|
type: String enum
|
|
description: Which hashing algorithm to use.
|
|
default: md5
|
|
options:
|
|
- md5
|
|
- base64
|
|
- sha1
|
|
- sha224
|
|
- sha256
|
|
- sha384
|
|
- sha512
|
|
- sha3
|
|
- ripemd160
|
|
returns: String
|
|
description: Returns a string hashed with the given algorithm.
|
|
- funcName: isDomain
|
|
returns: Boolean
|
|
description: Checks if a string is a domain.
|
|
- funcName: isEmail
|
|
returns: Boolean
|
|
description: Checks if a string is an email.
|
|
- funcName: isEmpty
|
|
returns: Boolean
|
|
description: Checks if a string is empty.
|
|
- funcName: isNotEmpty
|
|
returns: Boolean
|
|
description: Checks if a string has content.
|
|
- funcName: isNumeric
|
|
returns: Boolean
|
|
description: Checks if a string only contains digits.
|
|
- funcName: isUrl
|
|
returns: Boolean
|
|
description: Checks if a string is a valid URL.
|
|
- funcName: parseJson
|
|
returns: Object
|
|
description: Equivalent of <code>JSON.parse()</code>. Parses a string as a JSON object.
|
|
- funcName: quote
|
|
args:
|
|
- argName: mark
|
|
optional: true
|
|
longName: String
|
|
type: String
|
|
description: Which quote mark style to use.
|
|
default: >
|
|
"
|
|
returns: String
|
|
description: Returns a string wrapped in the quotation marks. Default quotation is <code>"</code>.
|
|
- funcName: removeMarkdown
|
|
returns: String
|
|
description: Removes Markdown formatting from a string.
|
|
- funcName: replaceSpecialChars
|
|
returns: String
|
|
description: Replaces non-ASCII characters in a string with an ASCII representation.
|
|
- funcName: removeTags
|
|
returns: String
|
|
description: Remove tags, such as HTML or XML, from a string.
|
|
- funcName: toBoolean
|
|
returns: Boolean
|
|
description: Convert a string to a boolean. <code>"false"</code>, <code>"0"</code>, <code>""</code>, and <code>"no"</code> convert to <code>false</code>.
|
|
- funcName: toDateTime
|
|
returns: Date
|
|
description: Converts a string to a <a href="https://docs.n8n.io/code/cookbook/luxon/">Luxon date object</a>.
|
|
- funcName: toDecimalNumber
|
|
returns: Number
|
|
description: See <a href="#string-toFloat">toFloat</a>
|
|
- funcName: toFloat
|
|
returns: Number
|
|
description: Converts a string to a decimal number.
|
|
- funcName: toInt
|
|
returns: Number
|
|
description: Converts a string to an integer.
|
|
- funcName: toSentenceCase
|
|
returns: String
|
|
description: Formats a string to sentence case.
|
|
- funcName: toSnakeCase
|
|
returns: String
|
|
description: Formats a string to snake case.
|
|
- funcName: toTitleCase
|
|
returns: String
|
|
description: Formats a string to title case. Will not change already uppercase letters to prevent losing information from acronyms and trademarks such as iPhone or FAANG.
|
|
- funcName: toWholeNumber
|
|
returns: Number
|
|
description: Converts a string to a whole number.
|
|
- funcName: urlDecode
|
|
args:
|
|
- argName: entireString
|
|
optional: true
|
|
longName: Boolean
|
|
type: Boolean
|
|
description: Whether to decode characters that are part of the URI syntax (true) or not (false).
|
|
default: false
|
|
returns: String
|
|
description: Decodes a URL-encoded string. It decodes any percent-encoded characters in the input string, and replaces them with their original characters.
|
|
- funcName: urlEncode
|
|
args:
|
|
- argName: entireString
|
|
optional: true
|
|
longName: Boolean
|
|
type: Boolean
|
|
description: Whether to encode characters that are part of the URI syntax (true) or not (false).
|
|
default: false
|
|
returns: String
|
|
description: Encodes a string to be used/included in a URL.
|
|
df_object:
|
|
- funcName: isEmpty
|
|
returns: Boolean
|
|
description: Checks if the Object has no key-value pairs.
|
|
- funcName: merge
|
|
args:
|
|
- argName: object
|
|
optional: false
|
|
longName: Object
|
|
type: Object
|
|
description: The Object to merge with the base Object.
|
|
returns: Object
|
|
description: Merges two Objects into a single Object using the first as the base Object. If a key exists in both Objects, the key in the base Object takes precedence.
|
|
- funcName: hasField
|
|
args:
|
|
- argName: fieldName
|
|
optional: false
|
|
longName: String
|
|
type: String
|
|
description: The field to search for.
|
|
returns: Boolean
|
|
description: Checks if the Object has a given field. Only top-level keys are supported.
|
|
- funcName: removeField
|
|
args:
|
|
- argName: key
|
|
optional: false
|
|
longName: String
|
|
type: String
|
|
description: The field key of the field to remove.
|
|
returns: Object
|
|
description: Removes a given field from the Object
|
|
- funcName: removeFieldsContaining
|
|
args:
|
|
- argName: value
|
|
optional: false
|
|
longName: String
|
|
type: String
|
|
description: The field value of the field to remove.
|
|
returns: Object
|
|
description: Removes fields with a given value from the Object.
|
|
- funcName: keepFieldsContaining
|
|
args:
|
|
- argName: value
|
|
optional: false
|
|
longName: String
|
|
type: String
|
|
description: The field value of the field to keep.
|
|
returns: Object
|
|
description: Removes fields that do not match the given value from the Object.
|
|
- funcName: compact
|
|
returns: Object
|
|
description: Removes empty values from an Object.
|
|
- funcName: toJsonString
|
|
returns: String
|
|
description: Convert an object to a JSON string. Equivalent of <code>JSON.stringify</code>.
|
|
- funcName: urlEncode
|
|
returns: String
|
|
description: Transforms an Object into a URL parameter list. Only top-level keys are supported.
|
|
df_number:
|
|
- funcName: ceil
|
|
returns: Number
|
|
description: Rounds up a number to a whole number.
|
|
- funcName: floor
|
|
returns: Number
|
|
description: Rounds down a number to a whole number.
|
|
- funcName: format
|
|
args:
|
|
- argName: locales
|
|
optional: true
|
|
longName: LanguageCode
|
|
type: String
|
|
description: An IETF BCP 47 language tag.
|
|
default: en-US
|
|
- argName: options
|
|
optional: true
|
|
longName: FormatOptions
|
|
type: Object
|
|
description: Configure options for number formatting. Refer to <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat" target=_blank>MDN | Intl.NumberFormat()</a> for more information.
|
|
returns: String
|
|
description: This is a wrapper around <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat" target=_blank>Intl.NumberFormat()</a>. Returns a formatted string of a number based on the given LanguageCode and FormatOptions. When no arguments are given, transforms the number in a like format 1.234.
|
|
- funcName: isEven
|
|
returns: Boolean
|
|
description: Returns true if the number is even. Only works on whole numbers.
|
|
- funcName: isOdd
|
|
returns: Boolean
|
|
description: Returns true if the number is odd. Only works on whole numbers.
|
|
- funcName: round
|
|
args:
|
|
- argName: decimalPlaces
|
|
optional: true
|
|
longName: Number
|
|
type: Number
|
|
default: "0"
|
|
description: How many decimal places to round to.
|
|
returns: Number
|
|
description: Returns the value of a number rounded to the nearest whole number, unless a decimal place is specified.
|
|
- funcName: toBoolean
|
|
returns: Boolean
|
|
description: Converts a number to a boolean. <code>0</code> converts to <code>false</code>. All other values convert to <code>true</code>.
|
|
- funcName: toDateTime
|
|
args:
|
|
- argName: format
|
|
optional: true
|
|
longName: String
|
|
type: String enum
|
|
description: Can be <code>ms</code> (milliseconds), <code>s</code> (seconds), or <code>excel</code> (Excel 1900). Defaults to milliseconds.
|
|
returns: Date
|
|
description: Converts a number to a <a href="https://docs.n8n.io/code/cookbook/luxon/">Luxon date object</a>.
|
|
df_date:
|
|
- funcName: beginningOf
|
|
args:
|
|
- argName: unit
|
|
optional: true
|
|
longName: DurationUnit
|
|
type: String enum
|
|
description: A valid string specifying the time unit.
|
|
default: week
|
|
options: *df_durationUnit
|
|
returns: Date
|
|
description: Transforms a Date to the start of the given time period. Returns either a JavaScript Date or Luxon Date, depending on input.
|
|
- funcName: endOfMonth
|
|
returns: Date
|
|
description: Transforms a Date to the end of the month.
|
|
- funcName: extract
|
|
args:
|
|
- argName: datePart
|
|
optional: true
|
|
longName: DurationUnit
|
|
type: String enum
|
|
description: A valid string specifying the time unit.
|
|
default: week
|
|
options: *df_durationUnit
|
|
returns: Number
|
|
description: Extracts the part defined in datePart from a Date. Returns either a JavaScript Date or Luxon Date, depending on input.
|
|
- funcName: format
|
|
args:
|
|
- argName: fmt
|
|
optional: false
|
|
longName: TimeFormat
|
|
type: String enum
|
|
description: A valid string specifying the time format. Refer to <a href="https://moment.github.io/luxon/#/formatting?id=table-of-tokens" target=_blank>Luxon | Table of tokens</a> for formats.
|
|
returns: String
|
|
description: Formats a Date in the given structure
|
|
- funcName: isBetween
|
|
args:
|
|
- argName: date1
|
|
optional: false
|
|
longName: Date | DateTime
|
|
type: Date or DateTime
|
|
description: The first date in the range.
|
|
- argName: date2
|
|
optional: false
|
|
longName: Date | DateTime
|
|
type: Date or DateTime
|
|
description: The last date in the range.
|
|
returns: Boolean
|
|
description: Checks if a Date is between two given dates.
|
|
- funcName: isDst
|
|
returns: Boolean
|
|
description: Checks if a Date is within Daylight Savings Time.
|
|
- funcName: isInLast
|
|
args:
|
|
- argName: n
|
|
optional: true
|
|
longName: Number
|
|
type: Number
|
|
description: The number of units. For example, to check if the date is in the last nine weeks, enter 9.
|
|
default: "0"
|
|
- argName: unit
|
|
optional: true
|
|
longName: DurationUnit
|
|
type: String enum
|
|
description: A valid string specifying the time unit.
|
|
default: minutes
|
|
options: *df_durationUnit
|
|
returns: Boolean
|
|
description: Checks if a Date is within a given time period.
|
|
- funcName: isWeekend
|
|
returns: Boolean
|
|
description: Checks if the Date falls on a Saturday or Sunday.
|
|
- funcName: minus
|
|
args:
|
|
- argName: n
|
|
optional: false
|
|
longName: Number
|
|
type: Number
|
|
description: The number of units. For example, to subtract nine seconds, enter 9 here.
|
|
- argName: unit
|
|
optional: true
|
|
longName: DurationUnit
|
|
type: String enum
|
|
description: A valid string specifying the time unit.
|
|
default: milliseconds
|
|
options: *df_durationUnit
|
|
returns: Date
|
|
description: Subtracts a given time period from a Date. Returns either a JavaScript Date or Luxon Date, depending on input.
|
|
- funcName: plus
|
|
args:
|
|
- argName: n
|
|
optional: false
|
|
longName: Number
|
|
type: Number
|
|
description: The number of units. For example, to add nine seconds, enter 9 here.
|
|
- argName: unit
|
|
optional: true
|
|
longName: DurationUnit
|
|
type: String enum
|
|
description: A valid string specifying the time unit.
|
|
default: milliseconds
|
|
options: *df_durationUnit
|
|
returns: Date
|
|
description: Adds a given time period to a Date. Returns either a JavaScript Date or Luxon Date, depending on input.
|
|
- funcName: toDateTime
|
|
returns: Date
|
|
description: Converts a JavaScript date to a <a href="https://docs.n8n.io/code/cookbook/luxon/">Luxon date object</a>.
|
|
df_array:
|
|
- funcName: average
|
|
returns: Number
|
|
description: Returns the value of elements in an array
|
|
- funcName: chunk
|
|
args:
|
|
- argName: size
|
|
optional: false
|
|
longName: Number
|
|
type: Number
|
|
description: The size of each chunk.
|
|
returns: Array
|
|
description: Splits arrays into chunks with a length of size
|
|
- funcName: compact
|
|
returns: Array
|
|
description: Removes empty values from the array.
|
|
- funcName: difference
|
|
args:
|
|
- argName: arr
|
|
optional: false
|
|
longName: Array
|
|
type: Array
|
|
description: The array to compare to the base array.
|
|
returns: Array
|
|
description: Compares two arrays. Returns all elements in the base array that aren't present in arr.
|
|
- funcName: intersection
|
|
args:
|
|
- argName: arr
|
|
optional: false
|
|
longName: Array
|
|
type: Array
|
|
description: The array to compare to the base array.
|
|
returns: Array
|
|
description: Compares two arrays. Returns all elements in the base array that are present in arr.
|
|
- funcName: first
|
|
returns: Array item
|
|
description: Returns the first element of the array.
|
|
- funcName: isEmpty
|
|
returns: Boolean
|
|
description: Checks if the array doesn't have any elements.
|
|
- funcName: isNotEmpty
|
|
returns: Boolean
|
|
description: Checks if the array has elements.
|
|
- funcName: last
|
|
returns: Array item
|
|
description: Returns the last element of the array.
|
|
- funcName: max
|
|
returns: Number
|
|
description: Returns the highest value in an array.
|
|
- funcName: merge
|
|
args:
|
|
- argName: arr
|
|
optional: false
|
|
longName: Array
|
|
type: Array
|
|
description: The array to merge into the base array.
|
|
returns: Array
|
|
description: Merges two Object-arrays into one array by merging the key-value pairs of each element.
|
|
- funcName: min
|
|
returns: Number
|
|
description: Gets the minimum value from a number-only array.
|
|
- funcName: pluck
|
|
args:
|
|
- argName: fieldName
|
|
optional: false,
|
|
longName: String
|
|
type: String
|
|
description: The key(s) you want to retrieve. You can enter as many keys as you want, as comma-separated strings.
|
|
returns: Array
|
|
description: Returns an array of Objects where keys equal the given field names.
|
|
- funcName: randomItem
|
|
returns: Array item
|
|
description: Returns a random element from an array.
|
|
- funcName: removeDuplicates
|
|
args:
|
|
- argName: key
|
|
optional: true
|
|
longName: String
|
|
type: String
|
|
description: A key, or comma-separated list of keys, to check for duplicates.
|
|
returns: Array
|
|
description: Removes duplicates from an array.
|
|
- funcName: renameKeys
|
|
args:
|
|
- argName: from
|
|
optional: false
|
|
longName: String
|
|
type: String
|
|
description: The key you want to rename.
|
|
- argName: to
|
|
optional: false
|
|
longName: String
|
|
type: String
|
|
description: The new name.
|
|
returns: Array
|
|
description: Renames all matching keys in the array. You can rename more than one key by entering a series of comma separated strings, in the pattern oldKeyName, newKeyName.
|
|
- funcName: smartJoin
|
|
args:
|
|
- argName: keyField
|
|
optional: false
|
|
longName: String
|
|
type: String
|
|
description: The key to join.
|
|
- argName: nameField
|
|
optional: false
|
|
longName: String
|
|
type: String
|
|
description: The value to join.
|
|
returns: Array
|
|
description: Operates on an array of objects where each object contains key-value pairs. Creates a new object containing key-value pairs, where the key is the value of the first pair, and the value is the value of the second pair. Removes non-matching and empty values and trims any whitespace before joining.
|
|
examples:
|
|
- exampleName: Basic usage
|
|
code: smartjoin
|
|
- funcName: sum
|
|
returns: Number
|
|
description: Returns the total sum all the values in an array of parsable numbers.
|
|
- funcName: toJsonString
|
|
returns: String
|
|
description: Convert an array to a JSON string. Equivalent of <code>JSON.stringify</code>.
|
|
- funcName: union
|
|
args:
|
|
- argName: arr
|
|
optional: false
|
|
longName: Array
|
|
type: Array
|
|
description: The array to compare to the base array.
|
|
returns: Array
|
|
description: Concatenates two arrays and then removes duplicate.
|
|
- funcName: unique
|
|
args:
|
|
- argName: key
|
|
optional: true
|
|
longName: String
|
|
type: String
|
|
description: A key, or comma-separated list of keys, to check for duplicates.
|
|
returns: Array
|
|
description: Remove duplicates from an array.
|
|
df_boolean:
|
|
- funcName: toInt
|
|
returns: Number
|
|
description: Convert a boolean to a number. <code>false</code> converts to <code>0</code>, <code>true</code> converts to <code>1</code>.
|