Merge pull request #1692 from Budibase/fix/length-helper
Quick fixes for length handlebars helper
This commit is contained in:
commit
efb2fee346
|
@ -245,7 +245,7 @@
|
|||
"options"
|
||||
],
|
||||
"numArgs": 3,
|
||||
"example": "{{equalsLength [1, 2, 3] 3}} -> true",
|
||||
"example": "{{equalsLength '[1,2,3]' 3}} -> true",
|
||||
"description": "<p>Returns true if the the length of the given <code>value</code> is equal to the given <code>length</code>. Can be used as a block or inline helper.</p>\n"
|
||||
},
|
||||
"last": {
|
||||
|
@ -262,7 +262,7 @@
|
|||
"value"
|
||||
],
|
||||
"numArgs": 1,
|
||||
"example": "{{length [1, 2, 3]}} -> 3",
|
||||
"example": "{{length '[1, 2, 3]'}} -> 3",
|
||||
"description": "<p>Returns the length of the given string or array.</p>\n"
|
||||
},
|
||||
"lengthEqual": {
|
||||
|
@ -272,7 +272,7 @@
|
|||
"options"
|
||||
],
|
||||
"numArgs": 3,
|
||||
"example": "{{equalsLength [1, 2, 3] 3}} -> true",
|
||||
"example": "{{equalsLength '[1,2,3]' 3}} -> true",
|
||||
"description": "<p>Returns true if the the length of the given <code>value</code> is equal to the given <code>length</code>. Can be used as a block or inline helper.</p>\n"
|
||||
},
|
||||
"map": {
|
||||
|
@ -1097,8 +1097,8 @@
|
|||
"format"
|
||||
],
|
||||
"numArgs": 2,
|
||||
"example": "{{date now \"DD-MM-YYYY\"}} -> 21-01-2021",
|
||||
"description": "<p>Format a date using moment.js date formatting.</p>\n"
|
||||
"example": "{{date now \"DD-MM-YYYY\" \"America/New_York\" }} -> 21-01-2021",
|
||||
"description": "<p>Format a date using moment.js date formatting - the timezone is optional and uses the tz database.</p>\n"
|
||||
},
|
||||
"duration": {
|
||||
"args": [
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"manifest": "node ./scripts/gen-collection-info.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/handlebars-helpers": "^0.11.3",
|
||||
"@budibase/handlebars-helpers": "^0.11.4",
|
||||
"dayjs": "^1.10.4",
|
||||
"handlebars": "^4.7.6",
|
||||
"handlebars-utils": "^1.0.6",
|
||||
|
|
|
@ -305,6 +305,17 @@ describe("Test the object/array helper", () => {
|
|||
const output = await processString("{{ literal ( sum ( pluck items 'price' ) ) }}", context)
|
||||
expect(output).toBe(50)
|
||||
})
|
||||
|
||||
it("should allow use of the length helper", async () => {
|
||||
const array = [1, 2, 3]
|
||||
const output = await processString("{{ length array }}", { array })
|
||||
expect(output).toBe("3")
|
||||
})
|
||||
|
||||
it("should allow use of the length helper inline", async () => {
|
||||
const output = await processString(`{{ length '[1, 2, 3]' }}`, {})
|
||||
expect(output).toBe("3")
|
||||
})
|
||||
})
|
||||
|
||||
describe("Test the literal helper", () => {
|
||||
|
|
|
@ -270,10 +270,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@budibase/handlebars-helpers@^0.11.3":
|
||||
version "0.11.3"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/handlebars-helpers/-/handlebars-helpers-0.11.3.tgz#b6e5c91b83e8906e7d7ff10ddde277a3d561016e"
|
||||
integrity sha512-MS1ptZEYq8o9J3tNLM7cZ2RGSSJIer4GiMIUHtbBI3sC9UKqZebao1JYNfmZKpNjntuqhZKgjqc5GfnVIEjsYQ==
|
||||
"@budibase/handlebars-helpers@^0.11.4":
|
||||
version "0.11.4"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/handlebars-helpers/-/handlebars-helpers-0.11.4.tgz#8acfa2ee84134f7be4b2906e710fce6d25c5d000"
|
||||
integrity sha512-AJNJYlJnxZmn9QJ8tBl8nrm4YxbwHP4AR0pbiVGK+EoOylkNBlUnZ/QDL1VyqM5fTkAE/Z2IZVLKrrG3kxuWLA==
|
||||
dependencies:
|
||||
arr-flatten "^1.1.0"
|
||||
array-sort "^0.1.4"
|
||||
|
|
Loading…
Reference in New Issue