diff --git a/packages/builder/src/components/backend/DataTable/formula.js b/packages/builder/src/components/backend/DataTable/formula.js index 9ec75b52c0..8dcda83c27 100644 --- a/packages/builder/src/components/backend/DataTable/formula.js +++ b/packages/builder/src/components/backend/DataTable/formula.js @@ -2,6 +2,7 @@ import { FieldType } from "@budibase/types" import { FIELDS } from "@/constants/backend" import { tables } from "@/stores/builder" import { get as svelteGet } from "svelte/store" +import { makeReadableKeyPropSafe } from "@/dataBinding" // currently supported level of relationship depth (server side) const MAX_DEPTH = 1 @@ -26,7 +27,7 @@ export function getBindings({ if (!table) { return bindings } - for (let [column, schema] of Object.entries(table.schema)) { + for (const [column, schema] of Object.entries(table.schema)) { const isRelationship = schema.type === FieldType.LINK // skip relationships after a certain depth and types which // can't bind to @@ -62,6 +63,10 @@ export function getBindings({ const label = path == null ? column : `${path}.0.${column}` const binding = path == null ? `[${column}]` : `[${path}].0.[${column}]` + const readableBinding = (path == null ? [column] : [path, "0", column]) + .map(makeReadableKeyPropSafe) + .join(".") + // only supply a description for relationship paths const description = path == null @@ -75,7 +80,7 @@ export function getBindings({ description, // don't include path, it messes things up, relationship path // will be replaced by the main array binding - readableBinding: label, + readableBinding, runtimeBinding: binding, display: { name: label, diff --git a/packages/builder/src/components/common/CodeEditor/validator/hbs.ts b/packages/builder/src/components/common/CodeEditor/validator/hbs.ts index c2b3b464da..1fca3967fc 100644 --- a/packages/builder/src/components/common/CodeEditor/validator/hbs.ts +++ b/packages/builder/src/components/common/CodeEditor/validator/hbs.ts @@ -45,7 +45,10 @@ export function validateHbsTemplate( ) { const ignoreMissing = options?.ignoreMissing || false nodes.forEach(node => { - if (isMustacheStatement(node) && isPathExpression(node.path)) { + if ( + (isMustacheStatement(node) || isBlockStatement(node)) && + isPathExpression(node.path) + ) { const helperName = node.path.original const from = @@ -75,21 +78,64 @@ export function validateHbsTemplate( message: `Helper "${helperName}" requires a body:\n{{#${helperName} ...}} [body] {{/${helperName}}}`, }) return + } else if (!requiresBlock && isBlockStatement(node)) { + diagnostics.push({ + from, + to, + severity: "error", + message: `Helper "${helperName}" should not contain a body.`, + }) + return } - const providedParams = node.params + let providedParamsCount = node.params.length + if (isBlockStatement(node)) { + // Block body counts as a parameter + providedParamsCount++ + } - if (providedParams.length !== expectedArguments.length) { + const optionalArgMatcher = new RegExp(/^\[(.+)\]$/) + const optionalArgs = expectedArguments.filter(a => + optionalArgMatcher.test(a) + ) + + if ( + !optionalArgs.length && + providedParamsCount !== expectedArguments.length + ) { diagnostics.push({ from, to, severity: "error", message: `Helper "${helperName}" expects ${ expectedArguments.length - } parameters (${expectedArguments.join(", ")}), but got ${ - providedParams.length - }.`, + } parameters (${expectedArguments.join( + ", " + )}), but got ${providedParamsCount}.`, }) + } else if (optionalArgs.length) { + const maxArgs = expectedArguments.length + const minArgs = maxArgs - optionalArgs.length + if ( + minArgs > providedParamsCount || + maxArgs < providedParamsCount + ) { + const parameters = expectedArguments + .map(a => { + const test = optionalArgMatcher.exec(a) + if (!test?.[1]) { + return a + } + return `${test[1]} (optional)` + }) + .join(", ") + diagnostics.push({ + from, + to, + severity: "error", + message: `Helper "${helperName}" expects between ${minArgs} to ${expectedArguments.length} parameters (${parameters}), but got ${providedParamsCount}.`, + }) + } } } diff --git a/packages/builder/src/components/common/CodeEditor/validator/tests/hbs.spec.ts b/packages/builder/src/components/common/CodeEditor/validator/tests/hbs.spec.ts index 9484c7a4a5..5d2cfa06c2 100644 --- a/packages/builder/src/components/common/CodeEditor/validator/tests/hbs.spec.ts +++ b/packages/builder/src/components/common/CodeEditor/validator/tests/hbs.spec.ts @@ -2,7 +2,7 @@ import { validateHbsTemplate } from "../hbs" import { CodeValidator } from "@/types" describe("hbs validator", () => { - it("validate empty strings", () => { + it("validates empty strings", () => { const text = "" const validators = {} @@ -10,7 +10,7 @@ describe("hbs validator", () => { expect(result).toHaveLength(0) }) - it("validate strings without hbs expressions", () => { + it("validates strings without hbs expressions", () => { const text = "first line\nand another one" const validators = {} @@ -23,7 +23,7 @@ describe("hbs validator", () => { fieldName: {}, } - it("validate valid expressions", () => { + it("validates valid expressions", () => { const text = "{{ fieldName }}" const result = validateHbsTemplate(text, validators) @@ -98,45 +98,193 @@ describe("hbs validator", () => { }) describe("expressions with parameters", () => { - const validators: CodeValidator = { - helperFunction: { - arguments: ["a", "b", "c"], - }, - } + describe("basic expression", () => { + const validators: CodeValidator = { + helperFunction: { + arguments: ["a", "b", "c"], + }, + } - it("validate valid params", () => { - const text = "{{ helperFunction 1 99 'a' }}" + it("validates valid params", () => { + const text = "{{ helperFunction 1 99 'a' }}" - const result = validateHbsTemplate(text, validators) - expect(result).toHaveLength(0) + const result = validateHbsTemplate(text, validators) + expect(result).toHaveLength(0) + }) + + it("throws on too few params", () => { + const text = "{{ helperFunction 100 }}" + + const result = validateHbsTemplate(text, validators) + expect(result).toEqual([ + { + from: 0, + message: `Helper "helperFunction" expects 3 parameters (a, b, c), but got 1.`, + severity: "error", + to: 24, + }, + ]) + }) + + it("throws on too many params", () => { + const text = "{{ helperFunction 1 99 'a' 100 }}" + + const result = validateHbsTemplate(text, validators) + expect(result).toEqual([ + { + from: 0, + message: `Helper "helperFunction" expects 3 parameters (a, b, c), but got 4.`, + severity: "error", + to: 34, + }, + ]) + }) }) - it("throws on too few params", () => { - const text = "{{ helperFunction 100 }}" - - const result = validateHbsTemplate(text, validators) - expect(result).toEqual([ - { - from: 0, - message: `Helper "helperFunction" expects 3 parameters (a, b, c), but got 1.`, - severity: "error", - to: 24, + describe("body expressions", () => { + const validators: CodeValidator = { + bodyFunction: { + arguments: ["a", "b", "c"], + requiresBlock: true, }, - ]) + nonBodyFunction: { + arguments: ["a", "b"], + }, + } + + it("validates valid params", () => { + const text = "{{#bodyFunction 1 99 }}body{{/bodyFunction}}" + + const result = validateHbsTemplate(text, validators) + expect(result).toHaveLength(0) + }) + + it("validates empty bodies", () => { + const text = "{{#bodyFunction 1 99 }}{{/bodyFunction}}" + + const result = validateHbsTemplate(text, validators) + expect(result).toHaveLength(0) + }) + + it("validates too little parameters", () => { + const text = "{{#bodyFunction 1 }}{{/bodyFunction}}" + + const result = validateHbsTemplate(text, validators) + expect(result).toEqual([ + { + from: 0, + message: `Helper "bodyFunction" expects 3 parameters (a, b, c), but got 2.`, + severity: "error", + to: 37, + }, + ]) + }) + + it("validates too many parameters", () => { + const text = "{{#bodyFunction 1 99 'a' 0 }}{{/bodyFunction}}" + + const result = validateHbsTemplate(text, validators) + expect(result).toEqual([ + { + from: 0, + message: `Helper "bodyFunction" expects 3 parameters (a, b, c), but got 5.`, + severity: "error", + to: 46, + }, + ]) + }) + + it("validates non-supported body usages", () => { + const text = "{{#nonBodyFunction 1 99}}{{/nonBodyFunction}}" + + const result = validateHbsTemplate(text, validators) + expect(result).toEqual([ + { + from: 0, + message: `Helper "nonBodyFunction" should not contain a body.`, + severity: "error", + to: 45, + }, + ]) + }) }) - it("throws on too many params", () => { - const text = "{{ helperFunction 1 99 'a' 100 }}" + describe("optional parameters", () => { + it("supports empty parameters", () => { + const validators: CodeValidator = { + helperFunction: { + arguments: ["a", "b", "[c]"], + }, + } + const text = "{{ helperFunction 1 99 }}" - const result = validateHbsTemplate(text, validators) - expect(result).toEqual([ - { - from: 0, - message: `Helper "helperFunction" expects 3 parameters (a, b, c), but got 4.`, - severity: "error", - to: 34, - }, - ]) + const result = validateHbsTemplate(text, validators) + expect(result).toHaveLength(0) + }) + + it("supports valid parameters", () => { + const validators: CodeValidator = { + helperFunction: { + arguments: ["a", "b", "[c]"], + }, + } + const text = "{{ helperFunction 1 99 'a' }}" + + const result = validateHbsTemplate(text, validators) + expect(result).toHaveLength(0) + }) + + it("returns a valid message on missing parameters", () => { + const validators: CodeValidator = { + helperFunction: { + arguments: ["a", "b", "[c]"], + }, + } + const text = "{{ helperFunction 1 }}" + + const result = validateHbsTemplate(text, validators) + expect(result).toEqual([ + { + from: 0, + message: `Helper "helperFunction" expects between 2 to 3 parameters (a, b, c (optional)), but got 1.`, + severity: "error", + to: 22, + }, + ]) + }) + + it("returns a valid message on too many parameters", () => { + const validators: CodeValidator = { + helperFunction: { + arguments: ["a", "b", "[c]"], + }, + } + const text = "{{ helperFunction 1 2 3 4 }}" + + const result = validateHbsTemplate(text, validators) + expect(result).toEqual([ + { + from: 0, + message: `Helper "helperFunction" expects between 2 to 3 parameters (a, b, c (optional)), but got 4.`, + severity: "error", + to: 28, + }, + ]) + }) }) }) + + it("validates wrong hbs code", () => { + const text = "{{#fieldName}}{{/wrong}}" + + const result = validateHbsTemplate(text, {}) + expect(result).toEqual([ + { + from: 0, + message: `The handlebars code is not valid:\nfieldName doesn't match wrong - 1:3`, + severity: "error", + to: text.length, + }, + ]) + }) }) diff --git a/packages/builder/src/dataBinding.js b/packages/builder/src/dataBinding.js index 739ecc9494..c6171c72a4 100644 --- a/packages/builder/src/dataBinding.js +++ b/packages/builder/src/dataBinding.js @@ -373,6 +373,18 @@ const getContextBindings = (asset, componentId) => { .flat() } +export const makeReadableKeyPropSafe = key => { + if (!key.includes(" ")) { + return key + } + + if (new RegExp(/^\[(.+)\]$/).test(key.test)) { + return key + } + + return `[${key}]` +} + /** * Generates a set of bindings for a given component context */ @@ -457,11 +469,11 @@ const generateComponentContextBindings = (asset, componentContext) => { const runtimeBinding = `${safeComponentId}.${safeKey}` // Optionally use a prefix with readable bindings - let readableBinding = component._instanceName + let readableBinding = makeReadableKeyPropSafe(component._instanceName) if (readablePrefix) { readableBinding += `.${readablePrefix}` } - readableBinding += `.${fieldSchema.name || key}` + readableBinding += `.${makeReadableKeyPropSafe(fieldSchema.name || key)}` // Determine which category this binding belongs in const bindingCategory = getComponentBindingCategory( @@ -473,7 +485,7 @@ const generateComponentContextBindings = (asset, componentContext) => { bindings.push({ type: "context", runtimeBinding, - readableBinding: `${readableBinding}`, + readableBinding, // Field schema and provider are required to construct relationship // datasource options, based on bindable properties fieldSchema, @@ -1354,13 +1366,14 @@ const bindingReplacement = ( } // work from longest to shortest const convertFromProps = bindableProperties + // TODO check whitespaces .map(el => el[convertFrom]) .sort((a, b) => { return b.length - a.length }) const boundValues = textWithBindings.match(regex) || [] let result = textWithBindings - for (let boundValue of boundValues) { + for (const boundValue of boundValues) { let newBoundValue = boundValue // we use a search string, where any time we replace something we blank it out // in the search, working from longest to shortest so always use best match first diff --git a/packages/string-templates/scripts/gen-collection-info.ts b/packages/string-templates/scripts/gen-collection-info.ts index f7df88ee85..d231908a05 100644 --- a/packages/string-templates/scripts/gen-collection-info.ts +++ b/packages/string-templates/scripts/gen-collection-info.ts @@ -17,7 +17,6 @@ type BudibaseAnnotation = Annotation & { type Helper = { args: string[] - numArgs: number example?: string description: string requiresBlock?: boolean @@ -34,15 +33,13 @@ const outputJSON: Manifest = {} const ADDED_HELPERS = { date: { date: { - args: ["datetime", "format"], - numArgs: 2, + args: ["[datetime]", "[format]", "[options]"], example: '{{date now "DD-MM-YYYY" "America/New_York" }} -> 21-01-2021', description: "Format a date using moment.js date formatting - the timezone is optional and uses the tz database.", }, duration: { args: ["time", "durationType"], - numArgs: 2, example: '{{duration 8 "seconds"}} -> a few seconds', description: "Produce a humanized duration left/until given an amount of time and the type of time measurement.", @@ -53,7 +50,6 @@ const ADDED_HELPERS = { function fixSpecialCases(name: string, obj: Helper) { if (name === "ifNth") { obj.args = ["a", "b", "options"] - obj.numArgs = 3 } if (name === "eachIndex") { obj.description = "Iterates the array, listing an item and the index of it." @@ -163,7 +159,6 @@ function run() { .map(tag => tag.description!.replace(/`/g, "").split(" ")[0].trim()) collectionInfo[name] = fixSpecialCases(name, { args, - numArgs: args.length, example: jsDocInfo.example || undefined, description: jsDocInfo.description, requiresBlock: jsDocInfo.acceptsBlock && !jsDocInfo.acceptsInline, diff --git a/packages/string-templates/src/helpers/date.ts b/packages/string-templates/src/helpers/date.ts index 589cb3d978..8b52fb61e2 100644 --- a/packages/string-templates/src/helpers/date.ts +++ b/packages/string-templates/src/helpers/date.ts @@ -71,7 +71,7 @@ function getContext(thisArg: any, locals: any, options: any) { function initialConfig(str: any, pattern: any, options?: any) { if (isOptions(pattern)) { options = pattern - pattern = null + pattern = DEFAULT_FORMAT } if (isOptions(str)) { @@ -93,13 +93,15 @@ function setLocale(this: any, str: any, pattern: any, options?: any) { dayjs.locale(opts.lang || opts.language) } +const DEFAULT_FORMAT = "MMMM DD, YYYY" + export const date = (str: any, pattern: any, options: any) => { const config = initialConfig(str, pattern, options) // if no args are passed, return a formatted date if (config.str == null && config.pattern == null) { dayjs.locale("en") - return dayjs().format("MMMM DD, YYYY") + return dayjs().format(DEFAULT_FORMAT) } setLocale(config.str, config.pattern, config.options) diff --git a/packages/string-templates/src/manifest.json b/packages/string-templates/src/manifest.json index 7931c60641..e399dbff94 100644 --- a/packages/string-templates/src/manifest.json +++ b/packages/string-templates/src/manifest.json @@ -4,7 +4,6 @@ "args": [ "a" ], - "numArgs": 1, "example": "{{ abs 12012.1000 }} -> 12012.1", "description": "

Return the magnitude of a.

\n", "requiresBlock": false @@ -14,7 +13,6 @@ "a", "b" ], - "numArgs": 2, "example": "{{ add 1 2 }} -> 3", "description": "

Return the sum of a plus b.

\n", "requiresBlock": false @@ -23,7 +21,6 @@ "args": [ "array" ], - "numArgs": 1, "example": "{{ avg 1 2 3 4 5 }} -> 3", "description": "

Returns the average of all numbers in the given array.

\n", "requiresBlock": false @@ -32,7 +29,6 @@ "args": [ "value" ], - "numArgs": 1, "example": "{{ ceil 1.2 }} -> 2", "description": "

Get the Math.ceil() of the given value.

\n", "requiresBlock": false @@ -42,7 +38,6 @@ "a", "b" ], - "numArgs": 2, "example": "{{ divide 10 5 }} -> 2", "description": "

Divide a by b

\n", "requiresBlock": false @@ -51,7 +46,6 @@ "args": [ "value" ], - "numArgs": 1, "example": "{{ floor 1.2 }} -> 1", "description": "

Get the Math.floor() of the given value.

\n", "requiresBlock": false @@ -61,7 +55,6 @@ "a", "b" ], - "numArgs": 2, "example": "{{ subtract 10 5 }} -> 5", "description": "

Return the product of a minus b.

\n", "requiresBlock": false @@ -71,7 +64,6 @@ "a", "b" ], - "numArgs": 2, "example": "{{ modulo 10 5 }} -> 0", "description": "

Get the remainder of a division operation.

\n", "requiresBlock": false @@ -81,7 +73,6 @@ "a", "b" ], - "numArgs": 2, "example": "{{ multiply 10 5 }} -> 50", "description": "

Multiply number a by number b.

\n", "requiresBlock": false @@ -91,7 +82,6 @@ "a", "b" ], - "numArgs": 2, "example": "{{ plus 10 5 }} -> 15", "description": "

Add a by b.

\n", "requiresBlock": false @@ -101,7 +91,6 @@ "min", "max" ], - "numArgs": 2, "example": "{{ random 0 20 }} -> 10", "description": "

Generate a random number between two values

\n", "requiresBlock": false @@ -111,7 +100,6 @@ "a", "b" ], - "numArgs": 2, "example": "{{ remainder 10 6 }} -> 4", "description": "

Get the remainder when a is divided by b.

\n", "requiresBlock": false @@ -120,7 +108,6 @@ "args": [ "number" ], - "numArgs": 1, "example": "{{ round 10.3 }} -> 10", "description": "

Round the given number.

\n", "requiresBlock": false @@ -130,7 +117,6 @@ "a", "b" ], - "numArgs": 2, "example": "{{ subtract 10 5 }} -> 5", "description": "

Return the product of a minus b.

\n", "requiresBlock": false @@ -139,7 +125,6 @@ "args": [ "array" ], - "numArgs": 1, "example": "{{ sum [1, 2, 3] }} -> 6", "description": "

Returns the sum of all numbers in the given array.

\n", "requiresBlock": false @@ -151,7 +136,6 @@ "array", "n" ], - "numArgs": 2, "example": "{{ after ['a', 'b', 'c', 'd'] 2}} -> ['c', 'd']", "description": "

Returns all of the items in an array after the specified index. Opposite of before.

\n", "requiresBlock": false @@ -160,7 +144,6 @@ "args": [ "value" ], - "numArgs": 1, "example": "{{ arrayify 'foo' }} -> ['foo']", "description": "

Cast the given value to an array.

\n", "requiresBlock": false @@ -170,7 +153,6 @@ "array", "n" ], - "numArgs": 2, "example": "{{ before ['a', 'b', 'c', 'd'] 3}} -> ['a', 'b']", "description": "

Return all of the items in the collection before the specified count. Opposite of after.

\n", "requiresBlock": false @@ -180,7 +162,6 @@ "array", "options" ], - "numArgs": 2, "example": "{{#eachIndex [1, 2, 3]}} {{item}} is {{index}} {{/eachIndex}} -> ' 1 is 0 2 is 1 3 is 2 '", "description": "

Iterates the array, listing an item and the index of it.

\n", "requiresBlock": true @@ -191,7 +172,6 @@ "value", "options" ], - "numArgs": 3, "example": "{{#filter [1, 2, 3] 2}}2 Found{{else}}2 not found{{/filter}} -> 2 Found", "description": "

Block helper that filters the given array and renders the block for values that evaluate to true, otherwise the inverse block is returned.

\n", "requiresBlock": true @@ -201,7 +181,6 @@ "array", "n" ], - "numArgs": 2, "example": "{{first [1, 2, 3, 4] 2}} -> 1,2", "description": "

Returns the first item, or first n items of an array.

\n", "requiresBlock": false @@ -211,7 +190,6 @@ "array", "options" ], - "numArgs": 2, "example": "{{#forEach [{ 'name': 'John' }] }} {{ name }} {{/forEach}} -> ' John '", "description": "

Iterates over each item in an array and exposes the current item in the array as context to the inner block. In addition to the current array item, the helper exposes the following variables to the inner block: - index - total - isFirst - isLast Also, @index is exposed as a private variable, and additional private variables may be defined as hash arguments.

\n", "requiresBlock": true @@ -222,7 +200,6 @@ "value", "options" ], - "numArgs": 3, "example": "{{#inArray [1, 2, 3] 2}} 2 exists {{else}} 2 does not exist {{/inArray}} -> ' 2 exists '", "description": "

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.

\n", "requiresBlock": true @@ -231,7 +208,6 @@ "args": [ "value" ], - "numArgs": 1, "example": "{{isArray [1, 2]}} -> true", "description": "

Returns true if value is an es5 array.

\n", "requiresBlock": false @@ -241,7 +217,6 @@ "array", "idx" ], - "numArgs": 2, "example": "{{itemAt [1, 2, 3] 1}} -> 2", "description": "

Returns the item from array at index idx.

\n", "requiresBlock": false @@ -251,7 +226,6 @@ "array", "separator" ], - "numArgs": 2, "example": "{{join [1, 2, 3]}} -> 1, 2, 3", "description": "

Join all elements of array into a string, optionally using a given separator.

\n", "requiresBlock": false @@ -261,7 +235,6 @@ "value", "length" ], - "numArgs": 2, "example": "{{equalsLength [1, 2, 3] 3}} -> true", "description": "

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.

\n", "requiresBlock": false @@ -271,7 +244,6 @@ "value", "n" ], - "numArgs": 2, "example": "{{last [1, 2, 3]}} -> 3", "description": "

Returns the last item, or last n items of an array or string. Opposite of first.

\n", "requiresBlock": false @@ -280,7 +252,6 @@ "args": [ "value" ], - "numArgs": 1, "example": "{{length [1, 2, 3]}} -> 3", "description": "

Returns the length of the given string or array.

\n", "requiresBlock": false @@ -290,7 +261,6 @@ "value", "length" ], - "numArgs": 2, "example": "{{equalsLength [1, 2, 3] 3}} -> true", "description": "

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.

\n", "requiresBlock": false @@ -300,7 +270,6 @@ "array", "fn" ], - "numArgs": 2, "example": "{{map [1, 2, 3] double}} -> [2, 4, 6]", "description": "

Returns a new array, created by calling function on each element of the given array. For example,

\n", "requiresBlock": false @@ -310,7 +279,6 @@ "collection", "prop" ], - "numArgs": 2, "example": "{{pluck [{ 'name': 'Bob' }] 'name' }} -> ['Bob']", "description": "

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.

\n", "requiresBlock": false @@ -319,7 +287,6 @@ "args": [ "value" ], - "numArgs": 1, "example": "{{reverse [1, 2, 3]}} -> [3, 2, 1]", "description": "

Reverse the elements in an array, or the characters in a string.

\n", "requiresBlock": false @@ -330,7 +297,6 @@ "iter", "provided" ], - "numArgs": 3, "example": "{{#some [1, \"b\", 3] isString}} string found {{else}} No string found {{/some}} -> ' string found '", "description": "

Block helper that returns the block if the callback returns true for some value in the given array.

\n", "requiresBlock": true @@ -340,7 +306,6 @@ "array", "key" ], - "numArgs": 2, "example": "{{ sort ['b', 'a', 'c'] }} -> ['a', 'b', 'c']", "description": "

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.

\n", "requiresBlock": false @@ -350,7 +315,6 @@ "array", "props" ], - "numArgs": 2, "example": "{{ sortBy [{'a': 'zzz'}, {'a': 'aaa'}] 'a' }} -> [{'a':'aaa'},{'a':'zzz'}]", "description": "

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.

\n", "requiresBlock": false @@ -361,7 +325,6 @@ "idx", "options" ], - "numArgs": 3, "example": "{{#withAfter [1, 2, 3] 1 }} {{this}} {{/withAfter}} -> ' 2 3 '", "description": "

Use the items in the array after the specified index as context inside a block. Opposite of withBefore.

\n", "requiresBlock": true @@ -372,7 +335,6 @@ "idx", "options" ], - "numArgs": 3, "example": "{{#withBefore [1, 2, 3] 2 }} {{this}} {{/withBefore}} -> ' 1 '", "description": "

Use the items in the array before the specified index as context inside a block. Opposite of withAfter.

\n", "requiresBlock": true @@ -383,7 +345,6 @@ "idx", "options" ], - "numArgs": 3, "example": "{{#withFirst [1, 2, 3] }}{{this}}{{/withFirst}} -> 1", "description": "

Use the first item in a collection inside a handlebars block expression. Opposite of withLast.

\n", "requiresBlock": true @@ -394,7 +355,6 @@ "size", "options" ], - "numArgs": 3, "example": "{{#withGroup [1, 2, 3, 4] 2}}{{#each this}}{{.}}{{/each}}
{{/withGroup}} -> 12
34
", "description": "

Block helper that groups array elements by given group size.

\n", "requiresBlock": true @@ -405,7 +365,6 @@ "idx", "options" ], - "numArgs": 3, "example": "{{#withLast [1, 2, 3, 4]}}{{this}}{{/withLast}} -> 4", "description": "

Use the last item or n items in an array as context inside a block. Opposite of withFirst.

\n", "requiresBlock": true @@ -416,7 +375,6 @@ "prop", "options" ], - "numArgs": 3, "example": "{{#withSort ['b', 'a', 'c']}}{{this}}{{/withSort}} -> abc", "description": "

Block helper that sorts a collection and exposes the sorted collection as context inside the block.

\n", "requiresBlock": true @@ -426,7 +384,6 @@ "array", "options" ], - "numArgs": 2, "example": "{{#each (unique ['a', 'a', 'c', 'b', 'e', 'e']) }}{{.}}{{/each}} -> acbe", "description": "

Block helper that return an array with all duplicate values removed. Best used along with a each helper.

\n", "requiresBlock": true @@ -437,7 +394,6 @@ "args": [ "number" ], - "numArgs": 1, "example": "{{ bytes 1386 1 }} -> 1.4 kB", "description": "

Format a number to it's equivalent in bytes. If a string is passed, it's length will be formatted and returned. Examples: - 'foo' => 3 B - 13661855 => 13.66 MB - 825399 => 825.39 kB - 1396 => 1.4 kB

\n", "requiresBlock": false @@ -446,7 +402,6 @@ "args": [ "num" ], - "numArgs": 1, "example": "{{ addCommas 1000000 }} -> 1,000,000", "description": "

Add commas to numbers

\n", "requiresBlock": false @@ -455,7 +410,6 @@ "args": [ "num" ], - "numArgs": 1, "example": "{{ phoneNumber 8005551212 }} -> (800) 555-1212", "description": "

Convert a string or number to a formatted phone number.

\n", "requiresBlock": false @@ -465,7 +419,6 @@ "number", "precision" ], - "numArgs": 2, "example": "{{ toAbbr 10123 2 }} -> 10.12k", "description": "

Abbreviate numbers to the given number of precision. This for general numbers, not size in bytes.

\n", "requiresBlock": false @@ -475,7 +428,6 @@ "number", "fractionDigits" ], - "numArgs": 2, "example": "{{ toExponential 10123 2 }} -> 1.01e+4", "description": "

Returns a string representing the given number in exponential notation.

\n", "requiresBlock": false @@ -485,7 +437,6 @@ "number", "digits" ], - "numArgs": 2, "example": "{{ toFixed 1.1234 2 }} -> 1.12", "description": "

Formats the given number using fixed-point notation.

\n", "requiresBlock": false @@ -494,7 +445,6 @@ "args": [ "number" ], - "numArgs": 1, "description": "

Convert input to a float.

\n", "requiresBlock": false }, @@ -502,7 +452,6 @@ "args": [ "number" ], - "numArgs": 1, "description": "

Convert input to an integer.

\n", "requiresBlock": false }, @@ -511,7 +460,6 @@ "number", "precision" ], - "numArgs": 2, "example": "{{toPrecision '1.1234' 2}} -> 1.1", "description": "

Returns a string representing the Number object to the specified precision.

\n", "requiresBlock": false @@ -522,7 +470,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{ encodeURI 'https://myurl?Hello There' }} -> https%3A%2F%2Fmyurl%3FHello%20There", "description": "

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.

\n", "requiresBlock": false @@ -531,7 +478,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{ escape 'https://myurl?Hello+There' }} -> https%3A%2F%2Fmyurl%3FHello%2BThere", "description": "

Escape the given string by replacing characters with escape sequences. Useful for allowing the string to be used in a URL, etc.

\n", "requiresBlock": false @@ -540,7 +486,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{ decodeURI 'https://myurl?Hello%20There' }} -> https://myurl?Hello There", "description": "

Decode a Uniform Resource Identifier (URI) component.

\n", "requiresBlock": false @@ -550,7 +495,6 @@ "base", "href" ], - "numArgs": 2, "example": "{{ urlResolve 'https://myurl' '/api/test' }} -> https://myurl/api/test", "description": "

Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag.

\n", "requiresBlock": false @@ -559,7 +503,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{ urlParse 'https://myurl/api/test' }}", "description": "

Parses a url string into an object.

\n", "requiresBlock": false @@ -568,7 +511,6 @@ "args": [ "url" ], - "numArgs": 1, "example": "{{ stripQuerystring 'https://myurl/api/test?foo=bar' }} -> 'https://myurl/api/test'", "description": "

Strip the query string from the given url.

\n", "requiresBlock": false @@ -577,7 +519,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{ stripProtocol 'https://myurl/api/test' }} -> '//myurl/api/test'", "description": "

Strip protocol from a url. Useful for displaying media that may have an 'http' protocol on secure connections.

\n", "requiresBlock": false @@ -589,7 +530,6 @@ "str", "suffix" ], - "numArgs": 2, "example": "{{append 'index' '.html'}} -> index.html", "description": "

Append the specified suffix to the given string.

\n", "requiresBlock": false @@ -598,7 +538,6 @@ "args": [ "string" ], - "numArgs": 1, "example": "{{camelcase 'foo bar baz'}} -> fooBarBaz", "description": "

camelCase the characters in the given string.

\n", "requiresBlock": false @@ -607,7 +546,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{capitalize 'foo bar baz'}} -> Foo bar baz", "description": "

Capitalize the first word in a sentence.

\n", "requiresBlock": false @@ -616,7 +554,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{ capitalizeAll 'foo bar baz'}} -> Foo Bar Baz", "description": "

Capitalize all words in a string.

\n", "requiresBlock": false @@ -626,7 +563,6 @@ "str", "spaces" ], - "numArgs": 2, "example": "{{ center 'test' 1}} -> ' test '", "description": "

Center a string using non-breaking spaces

\n", "requiresBlock": false @@ -635,7 +571,6 @@ "args": [ "string" ], - "numArgs": 1, "example": "{{ chop ' ABC '}} -> ABC", "description": "

Like trim, but removes both extraneous whitespace and non-word characters from the beginning and end of a string.

\n", "requiresBlock": false @@ -644,7 +579,6 @@ "args": [ "string" ], - "numArgs": 1, "example": "{{dashcase 'a-b-c d_e'}} -> a-b-c-d-e", "description": "

dash-case the characters in string. Replaces non-word characters and periods with hyphens.

\n", "requiresBlock": false @@ -653,7 +587,6 @@ "args": [ "string" ], - "numArgs": 1, "example": "{{dotcase 'a-b-c d_e'}} -> a.b.c.d.e", "description": "

dot.case the characters in string.

\n", "requiresBlock": false @@ -662,7 +595,6 @@ "args": [ "string" ], - "numArgs": 1, "example": "{{downcase 'aBcDeF'}} -> abcdef", "description": "

Lowercase all of the characters in the given string. Alias for lowercase.

\n", "requiresBlock": false @@ -672,7 +604,6 @@ "str", "length" ], - "numArgs": 2, "example": "{{ellipsis 'foo bar baz' 7}} -> foo bar…", "description": "

Truncates a string to the specified length, and appends it with an elipsis, .

\n", "requiresBlock": false @@ -681,7 +612,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{hyphenate 'foo bar baz qux'}} -> foo-bar-baz-qux", "description": "

Replace spaces in a string with hyphens.

\n", "requiresBlock": false @@ -690,7 +620,6 @@ "args": [ "value" ], - "numArgs": 1, "example": "{{isString 'foo'}} -> true", "description": "

Return true if value is a string.

\n", "requiresBlock": false @@ -699,7 +628,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{lowercase 'Foo BAR baZ'}} -> foo bar baz", "description": "

Lowercase all characters in the given string.

\n", "requiresBlock": false @@ -709,7 +637,6 @@ "str", "substring" ], - "numArgs": 2, "example": "{{occurrences 'foo bar foo bar baz' 'foo'}} -> 2", "description": "

Return the number of occurrences of substring within the given string.

\n", "requiresBlock": false @@ -718,7 +645,6 @@ "args": [ "string" ], - "numArgs": 1, "example": "{{pascalcase 'foo bar baz'}} -> FooBarBaz", "description": "

PascalCase the characters in string.

\n", "requiresBlock": false @@ -727,7 +653,6 @@ "args": [ "string" ], - "numArgs": 1, "example": "{{pathcase 'a-b-c d_e'}} -> a/b/c/d/e", "description": "

path/case the characters in string.

\n", "requiresBlock": false @@ -736,7 +661,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{plusify 'foo bar baz'}} -> foo+bar+baz", "description": "

Replace spaces in the given string with pluses.

\n", "requiresBlock": false @@ -746,7 +670,6 @@ "str", "prefix" ], - "numArgs": 2, "example": "{{prepend 'bar' 'foo-'}} -> foo-bar", "description": "

Prepends the given string with the specified prefix.

\n", "requiresBlock": false @@ -756,7 +679,6 @@ "str", "substring" ], - "numArgs": 2, "example": "{{remove 'a b a b a b' 'a '}} -> b b b", "description": "

Remove all occurrences of substring from the given str.

\n", "requiresBlock": false @@ -766,7 +688,6 @@ "str", "substring" ], - "numArgs": 2, "example": "{{removeFirst 'a b a b a b' 'a'}} -> ' b a b a b'", "description": "

Remove the first occurrence of substring from the given str.

\n", "requiresBlock": false @@ -777,7 +698,6 @@ "a", "b" ], - "numArgs": 3, "example": "{{replace 'a b a b a b' 'a' 'z'}} -> z b z b z b", "description": "

Replace all occurrences of substring a with substring b.

\n", "requiresBlock": false @@ -788,7 +708,6 @@ "a", "b" ], - "numArgs": 3, "example": "{{replaceFirst 'a b a b a b' 'a' 'z'}} -> z b a b a b", "description": "

Replace the first occurrence of substring a with substring b.

\n", "requiresBlock": false @@ -797,7 +716,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{sentence 'hello world. goodbye world.'}} -> Hello world. Goodbye world.", "description": "

Sentence case the given string

\n", "requiresBlock": false @@ -806,7 +724,6 @@ "args": [ "string" ], - "numArgs": 1, "example": "{{snakecase 'a-b-c d_e'}} -> a_b_c_d_e", "description": "

snake_case the characters in the given string.

\n", "requiresBlock": false @@ -815,7 +732,6 @@ "args": [ "string" ], - "numArgs": 1, "example": "{{split 'a,b,c'}} -> ['a', 'b', 'c']", "description": "

Split string by the given character.

\n", "requiresBlock": false @@ -826,7 +742,6 @@ "testString", "options" ], - "numArgs": 3, "example": "{{#startsWith 'Goodbye' 'Hello, world!'}}Yep{{else}}Nope{{/startsWith}} -> Nope", "description": "

Tests whether a string begins with the given prefix.

\n", "requiresBlock": true @@ -835,7 +750,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{titleize 'this is title case' }} -> This Is Title Case", "description": "

Title case the given string.

\n", "requiresBlock": false @@ -844,7 +758,6 @@ "args": [ "string" ], - "numArgs": 1, "example": "{{trim ' ABC ' }} -> ABC", "description": "

Removes extraneous whitespace from the beginning and end of a string.

\n", "requiresBlock": false @@ -853,7 +766,6 @@ "args": [ "string" ], - "numArgs": 1, "example": "{{trimLeft ' ABC ' }} -> 'ABC '", "description": "

Removes extraneous whitespace from the beginning of a string.

\n", "requiresBlock": false @@ -862,7 +774,6 @@ "args": [ "string" ], - "numArgs": 1, "example": "{{trimRight ' ABC ' }} -> ' ABC'", "description": "

Removes extraneous whitespace from the end of a string.

\n", "requiresBlock": false @@ -873,7 +784,6 @@ "limit", "suffix" ], - "numArgs": 3, "example": "{{truncate 'foo bar baz' 7 }} -> foo bar", "description": "

Truncate a string to the specified length. Also see ellipsis.

\n", "requiresBlock": false @@ -884,7 +794,6 @@ "limit", "suffix" ], - "numArgs": 3, "example": "{{truncateWords 'foo bar baz' 1 }} -> foo…", "description": "

Truncate a string to have the specified number of words. Also see truncate.

\n", "requiresBlock": false @@ -893,7 +802,6 @@ "args": [ "string" ], - "numArgs": 1, "example": "{{upcase 'aBcDef'}} -> ABCDEF", "description": "

Uppercase all of the characters in the given string. Alias for uppercase.

\n", "requiresBlock": false @@ -903,7 +811,6 @@ "str", "options" ], - "numArgs": 2, "example": "{{uppercase 'aBcDef'}} -> ABCDEF", "description": "

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.

\n", "requiresBlock": false @@ -912,7 +819,6 @@ "args": [ "num" ], - "numArgs": 1, "example": "{{lorem 11}} -> Lorem ipsum", "description": "

Takes a number and returns that many charaters of Lorem Ipsum

\n", "requiresBlock": false @@ -925,7 +831,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#and great magnificent}}both{{else}}no{{/and}} -> no", "description": "

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.

\n", "requiresBlock": true @@ -937,7 +842,6 @@ "b", "options" ], - "numArgs": 4, "example": "{{compare 10 '<' 5 }} -> false", "description": "

Render a block when a comparison of the first and third arguments returns true. The second argument is the [arithemetic operator][operators] to use. You may also optionally specify an inverse block to render when falsy.

\n", "requiresBlock": false @@ -949,7 +853,6 @@ "[startIndex=0]", "options" ], - "numArgs": 4, "example": "{{#contains ['a', 'b', 'c'] 'd'}} This will not be rendered. {{else}} This will be rendered. {{/contains}} -> ' This will be rendered. '", "description": "

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.

\n", "requiresBlock": true @@ -959,7 +862,6 @@ "value", "defaultValue" ], - "numArgs": 2, "example": "{{default null null 'default'}} -> default", "description": "

Returns the first value that is not undefined, otherwise the 'default' value is returned.

\n", "requiresBlock": false @@ -970,7 +872,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#eq 3 3}}equal{{else}}not equal{{/eq}} -> equal", "description": "

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.

\n", "requiresBlock": true @@ -981,7 +882,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#gt 4 3}} greater than{{else}} not greater than{{/gt}} -> ' greater than'", "description": "

Block helper that renders a block if a is greater than 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.

\n", "requiresBlock": true @@ -992,7 +892,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#gte 4 3}} greater than or equal{{else}} not greater than{{/gte}} -> ' greater than or equal'", "description": "

Block helper that renders a block if a is greater than or 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.

\n", "requiresBlock": true @@ -1003,7 +902,6 @@ "pattern", "options" ], - "numArgs": 3, "example": "{{#has 'foobar' 'foo'}}has it{{else}}doesn't{{/has}} -> has it", "description": "

Block helper that renders a block if value has pattern. If an inverse block is specified it will be rendered when falsy.

\n", "requiresBlock": true @@ -1013,7 +911,6 @@ "val", "options" ], - "numArgs": 2, "example": "{{isFalsey '' }} -> true", "description": "

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.

\n", "requiresBlock": false @@ -1023,7 +920,6 @@ "val", "options" ], - "numArgs": 2, "example": "{{isTruthy '12' }} -> true", "description": "

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.

\n", "requiresBlock": false @@ -1033,7 +929,6 @@ "number", "options" ], - "numArgs": 2, "example": "{{#ifEven 2}} even {{else}} odd {{/ifEven}} -> ' even '", "description": "

Return true if the given value is an even number.

\n", "requiresBlock": true @@ -1044,7 +939,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#ifNth 2 10}}remainder{{else}}no remainder{{/ifNth}} -> remainder", "description": "

Conditionally renders a block if the remainder is zero when b operand is divided by a. If an inverse block is specified it will be rendered when the remainder is not zero.

\n", "requiresBlock": true @@ -1054,7 +948,6 @@ "value", "options" ], - "numArgs": 2, "example": "{{#ifOdd 3}}odd{{else}}even{{/ifOdd}} -> odd", "description": "

Block helper that renders a block if value is an odd number. If an inverse block is specified it will be rendered when falsy.

\n", "requiresBlock": true @@ -1065,7 +958,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#is 3 3}} is {{else}} is not {{/is}} -> ' is '", "description": "

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.

\n", "requiresBlock": true @@ -1076,7 +968,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#isnt 3 3}} isnt {{else}} is {{/isnt}} -> ' is '", "description": "

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.

\n", "requiresBlock": true @@ -1086,7 +977,6 @@ "context", "options" ], - "numArgs": 2, "example": "{{#lt 2 3}} less than {{else}} more than or equal {{/lt}} -> ' less than '", "description": "

Block helper that renders a block if a is less than 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.

\n", "requiresBlock": true @@ -1097,7 +987,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#lte 2 3}} less than or equal {{else}} more than {{/lte}} -> ' less than or equal '", "description": "

Block helper that renders a block if a is less than or 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.

\n", "requiresBlock": true @@ -1108,7 +997,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#neither null null}}both falsey{{else}}both not falsey{{/neither}} -> both falsey", "description": "

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.

\n", "requiresBlock": true @@ -1118,7 +1006,6 @@ "val", "options" ], - "numArgs": 2, "example": "{{#not undefined }}falsey{{else}}not falsey{{/not}} -> falsey", "description": "

Returns true if val is falsey. Works as a block or inline helper.

\n", "requiresBlock": true @@ -1128,7 +1015,6 @@ "arguments", "options" ], - "numArgs": 2, "example": "{{#or 1 2 undefined }} at least one truthy {{else}} all falsey {{/or}} -> ' at least one truthy '", "description": "

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.

\n", "requiresBlock": true @@ -1139,7 +1025,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#unlessEq 2 1 }} not equal {{else}} equal {{/unlessEq}} -> ' not equal '", "description": "

Block helper that always renders the inverse block unless a is equal to b.

\n", "requiresBlock": true @@ -1150,7 +1035,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#unlessGt 20 1 }} not greater than {{else}} greater than {{/unlessGt}} -> ' greater than '", "description": "

Block helper that always renders the inverse block unless a is greater than b.

\n", "requiresBlock": true @@ -1161,7 +1045,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#unlessLt 20 1 }}greater than or equal{{else}}less than{{/unlessLt}} -> greater than or equal", "description": "

Block helper that always renders the inverse block unless a is less than b.

\n", "requiresBlock": true @@ -1172,7 +1055,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#unlessGteq 20 1 }} less than {{else}}greater than or equal to{{/unlessGteq}} -> greater than or equal to", "description": "

Block helper that always renders the inverse block unless a is greater than or equal to b.

\n", "requiresBlock": true @@ -1183,7 +1065,6 @@ "b", "options" ], - "numArgs": 3, "example": "{{#unlessLteq 20 1 }} greater than {{else}} less than or equal to {{/unlessLteq}} -> ' greater than '", "description": "

Block helper that always renders the inverse block unless a is less than or equal to b.

\n", "requiresBlock": true @@ -1194,7 +1075,6 @@ "args": [ "objects" ], - "numArgs": 1, "description": "

Extend the context with the properties of other objects. A shallow merge is performed to avoid mutating the context.

\n", "requiresBlock": false }, @@ -1203,7 +1083,6 @@ "context", "options" ], - "numArgs": 2, "description": "

Block helper that iterates over the properties of an object, exposing each key and value on the context.

\n", "requiresBlock": true }, @@ -1212,7 +1091,6 @@ "obj", "options" ], - "numArgs": 2, "description": "

Block helper that iterates over the own properties of an object, exposing each key and value on the context.

\n", "requiresBlock": true }, @@ -1220,7 +1098,6 @@ "args": [ "prop" ], - "numArgs": 1, "description": "

Take arguments and, if they are string or number, convert them to a dot-delineated object property path.

\n", "requiresBlock": false }, @@ -1230,7 +1107,6 @@ "context", "options" ], - "numArgs": 3, "description": "

Use property paths (a.b.c) to get a value or nested value from the context. Works as a regular helper or block helper.

\n", "requiresBlock": true }, @@ -1239,7 +1115,6 @@ "prop", "context" ], - "numArgs": 2, "description": "

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.

\n", "requiresBlock": false }, @@ -1248,7 +1123,6 @@ "key", "context" ], - "numArgs": 2, "description": "

Return true if key is an own, enumerable property of the given context object.

\n", "requiresBlock": false }, @@ -1256,7 +1130,6 @@ "args": [ "value" ], - "numArgs": 1, "description": "

Return true if value is an object.

\n", "requiresBlock": false }, @@ -1264,7 +1137,6 @@ "args": [ "string" ], - "numArgs": 1, "description": "

Parses the given string using JSON.parse.

\n", "requiresBlock": true }, @@ -1272,7 +1144,6 @@ "args": [ "obj" ], - "numArgs": 1, "description": "

Stringify an object using JSON.stringify.

\n", "requiresBlock": false }, @@ -1281,7 +1152,6 @@ "object", "objects" ], - "numArgs": 2, "description": "

Deeply merge the properties of the given objects with the context object.

\n", "requiresBlock": false }, @@ -1289,7 +1159,6 @@ "args": [ "string" ], - "numArgs": 1, "description": "

Parses the given string using JSON.parse.

\n", "requiresBlock": true }, @@ -1299,7 +1168,6 @@ "context", "options" ], - "numArgs": 3, "description": "

Pick properties from the context object.

\n", "requiresBlock": true }, @@ -1307,7 +1175,6 @@ "args": [ "obj" ], - "numArgs": 1, "description": "

Stringify an object using JSON.stringify.

\n", "requiresBlock": false } @@ -1317,7 +1184,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{toRegex 'foo'}} -> /foo/", "description": "

Convert the given string to a regular expression.

\n", "requiresBlock": false @@ -1326,7 +1192,6 @@ "args": [ "str" ], - "numArgs": 1, "example": "{{test 'foobar' (toRegex 'foo')}} -> true", "description": "

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.

\n", "requiresBlock": false @@ -1335,7 +1200,6 @@ "uuid": { "uuid": { "args": [], - "numArgs": 0, "example": "{{ uuid }} -> f34ebc66-93bd-4f7c-b79b-92b5569138bc", "description": "

Generates a UUID, using the V4 method (identical to the browser crypto.randomUUID function).

\n", "requiresBlock": false @@ -1344,10 +1208,10 @@ "date": { "date": { "args": [ - "datetime", - "format" + "[datetime]", + "[format]", + "[options]" ], - "numArgs": 2, "example": "{{date now \"DD-MM-YYYY\" \"America/New_York\" }} -> 21-01-2021", "description": "

Format a date using moment.js date formatting - the timezone is optional and uses the tz database.

\n" }, @@ -1356,7 +1220,6 @@ "time", "durationType" ], - "numArgs": 2, "example": "{{duration 8 \"seconds\"}} -> a few seconds", "description": "

Produce a humanized duration left/until given an amount of time and the type of time measurement.

\n" }