{"id":20390450,"url":"https://github.com/checkly/handlebars","last_synced_at":"2025-06-22T19:37:53.343Z","repository":{"id":36965124,"uuid":"258199792","full_name":"checkly/handlebars","owner":"checkly","description":"A simple wrapper for Handlebars that can be used as a drop-in replacement","archived":false,"fork":false,"pushed_at":"2023-07-18T21:57:17.000Z","size":1483,"stargazers_count":5,"open_issues_count":14,"forks_count":3,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-06-13T11:56:30.208Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/checkly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-23T12:48:11.000Z","updated_at":"2024-01-17T11:03:31.000Z","dependencies_parsed_at":"2024-11-15T03:25:41.799Z","dependency_job_id":"59c0ab92-5026-486b-b646-ef58bccc97f7","html_url":"https://github.com/checkly/handlebars","commit_stats":{"total_commits":28,"total_committers":7,"mean_commits":4.0,"dds":0.6071428571428572,"last_synced_commit":"b010f673866dddf60e566b573751ebe16a7c0297"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/checkly/handlebars","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Fhandlebars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Fhandlebars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Fhandlebars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Fhandlebars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/checkly","download_url":"https://codeload.github.com/checkly/handlebars/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Fhandlebars/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259783240,"owners_count":22910313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T03:24:57.357Z","updated_at":"2025-06-22T19:37:48.318Z","avatar_url":"https://github.com/checkly.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Checkly Handlebars\n\nThis library is a very simple wrapper around the templating library Handlebars that bundles additional helpers. It can be used as a drop-in replacement.  At Checkly, we use Handlebars to provide a powerful flexibility in some of our features like creating custom bodies for alerting webhooks.\n\n## What is Checkly?\nCheckly is an active reliability platform that brings together the best of end-to-end testing and active monitoring to serve modern, cross-functional DevOps teams. With a focus on JavaScript-based Open Source tech stacks, Checkly is easy to get started with and seamlessly integrates into your development workflow.\n\n## Usage\n\nInstall via NPM:\n\n```shell script\n$ npm install @checkly/handlebars --save # or yarn add @checkly/handlebars\n```\n\nYou can use it as a drop-in replacement for Handlebars:\n```javascript\n// replaced the following\nconst Handlebars = require('handlebars')\n\n// with\nconst Handlebars = require('@checkly/handlebars')\n```\n\n### Helpers\n[Built-in helpers](https://handlebarsjs.com/guide/builtin-helpers.html) provided by the vanilla Handlebars package can still be used. If you are using this library for your own project, you can couple it with other libraries that adds functionality such as [`handlebars-extra`](https://github.com/helpers/handlebars-helpers).\n\n#### {{$RANDOM_NUMBER}}\n\nProduces a random number between 0 and 1000.\n\n**Example**\n\n```handlebars\nYour lucky number is {{$RANDOM_NUMBER}}\n\u003c!-- results in: '345' --\u003e\n```\n\n#### {{$UUID}}\n\nProvides a UUID string from cryptographically-strong random values, compliant with RFC4122's Version 4.\n\n```handlebars\nSessionId: {{$UUID}}\n\u003c!-- results in: '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d' --\u003e\n```\n\n### {{split}}\n\nSplits a given string and return an element from the split array. \n\n**Params**\n\n* `string` **{String}**\n* `separator` **{String}**\n* `index` **{Number}**: defaults to -1\n* `returns` **{Array|String}**\n\n**Example**\n\n```handlebars\n{{split \"somekey:somevalue\" \":\" 1}}\n\u003c!-- results in: 'somevalue' --\u003e\n```\n\n```handlebars\n{{split \"a long sentence\" \" \" -1}}\n\u003c!-- results in: ['a', 'long', 'sentence'] --\u003e\n```\n\n#### {{moment}} (date helper)\n\nAllows [moment](http://momentjs.com) to be used as a helper. [helper-date](https://github.com/helpers/helper-date) is used behind the scenes for this helper.\n\n```handlebars\n{{moment \"5 years ago\" \"YYYY\"}}\n//=\u003e 2015\n```\n\n#### {{and}}\n\nHelper 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\n**Params**\n\n* `a` **{any}**\n* `b` **{any}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**\n\n**Example**\n\n```handlebars\n\u003c!-- {great: true, magnificent: true} --\u003e\n{{#and great magnificent}}A{{else}}B{{/and}}\n\u003c!-- results in: 'A' --\u003e\n```\n\n#### {{compare}}\n\nRender a block when a comparison of the first and third\narguments returns true. The second argument is\nthe [arithemetic operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators) to use. You may also\noptionally specify an inverse block to render when falsy.\n\n**Params**\n\n* `a` **{}**\n* `operator` **{}**: The operator to use. Operators must be enclosed in quotes: `\"\u003e\"`, `\"=\"`, `\"\u003c=\"`, and so on.\n* `b` **{}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Block, or if specified the inverse block is rendered if falsey.\n\n#### {{contains}}\n\nBlock 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\n**Params**\n\n* `collection` **{Array|Object|String}**: The collection to iterate over.\n* `value` **{any}**: The value to check for.\n* `[startIndex=0]` **{Number}**: Optionally define the starting index.\n* `options` **{Object}**: Handlebars provided options object.\n\n**Example**\n\n```handlebars\n\u003c!-- array = ['a', 'b', 'c'] --\u003e\n{{#contains array \"d\"}}\n  This will not be rendered.\n{{else}}\n  This will be rendered.\n{{/contains}}\n```\n\n#### {{default}}\n\nReturns the first value that is not undefined, otherwise the \"default\" value is returned.\n\n**Params**\n\n* `value` **{any}**\n* `defaultValue` **{any}**\n* `returns` **{String}**\n\n#### {{eq}}\n\nBlock helper that renders a block if `a` is **equal to** `b`.\nIf an inverse block is specified it will be rendered when falsy.\nYou may optionally use the `compare=\"\"` hash argument for the\nsecond value.\n\n**Params**\n\n* `a` **{String}**\n* `b` **{String}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Block, or inverse block if specified and falsey.\n\n#### {{gt}}\n\nBlock helper that renders a block if `a` is **greater than** `b`.\n\nIf an inverse block is specified it will be rendered when falsy.\nYou may optionally use the `compare=\"\"` hash argument for the\nsecond value.\n\n**Params**\n\n* `a` **{String}**\n* `b` **{String}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Block, or inverse block if specified and falsey.\n\n#### {{gte}}\n\nBlock helper that renders a block if `a` is **greater than or equal to** `b`.\n\nIf an inverse block is specified it will be rendered when falsy.\nYou may optionally use the `compare=\"\"` hash argument for the\nsecond value.\n\n**Params**\n\n* `a` **{String}**\n* `b` **{String}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Block, or inverse block if specified and falsey.\n\n#### {{has}}\n\nBlock helper that renders a block if `value` has `pattern`.\nIf an inverse block is specified it will be rendered when falsy.\n\n**Params**\n\n* `val` **{any}**: The value to check.\n* `pattern` **{any}**: The pattern to check for.\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**\n\n#### {{isFalsey}}\n\nReturns true if the given `value` is falsey. Uses the [falsey](https://github.com/jonschlinkert/falsey)\nlibrary for comparisons. Please see that library for more information\nor to report bugs with this helper.\n\n**Params**\n\n* `val` **{any}**\n* `options` **{Options}**\n* `returns` **{Boolean}**\n\n#### {{isTruthy}}\n\nReturns true if the given `value` is truthy. Uses the [falsey](https://github.com/jonschlinkert/falsey)\nlibrary for comparisons. Please see that library for more information\nor to report bugs with this helper.\n\n**Params**\n\n* `val` **{any}**\n* `options` **{Options}**\n* `returns` **{Boolean}**\n\n#### {{ifEven}}\n\nReturn true if the given value is an even number.\n\n**Params**\n\n* `number` **{Number}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Block, or inverse block if specified and falsey.\n\n**Example**\n\n```handlebars\n{{#ifEven value}}\n  render A\n{{else}}\n  render B\n{{/ifEven}}\n```\n\n#### {{ifNth}}\n\nConditionally renders a block if the remainder is zero when\n`a` operand is divided by `b`. If an inverse block is specified\nit will be rendered when the remainder is **not zero**.\n\n**Params**\n\n* **{}**: {Number}\n* **{}**: {Number}\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Block, or inverse block if specified and falsey.\n\n#### {{ifOdd}}\n\nBlock helper that renders a block if `value` is **an odd number**. If an inverse block is specified it will be rendered when falsy.\n\n**Params**\n\n* `value` **{Object}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Block, or inverse block if specified and falsey.\n\n**Example**\n\n```handlebars\n{{#ifOdd value}}\n  render A\n{{else}}\n  render B\n{{/ifOdd}}\n```\n\n#### {{is}}\n\nBlock helper that renders a block if `a` is **equal to** `b`.\nIf an inverse block is specified it will be rendered when falsy.\nSimilar to [eq](#eq) but does not do strict equality.\n\n**Params**\n\n* `a` **{any}**\n* `b` **{any}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**\n\n#### {{isnt}}\n\nBlock helper that renders a block if `a` is **not equal to** `b`.\nIf an inverse block is specified it will be rendered when falsy.\nSimilar to [unlessEq](#unlesseq) but does not use strict equality for\ncomparisons.\n\n**Params**\n\n* `a` **{String}**\n* `b` **{String}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**\n\n#### {{lt}}\n\nBlock helper that renders a block if `a` is **less than** `b`.\n\nIf an inverse block is specified it will be rendered when falsy.\nYou may optionally use the `compare=\"\"` hash argument for the\nsecond value.\n\n**Params**\n\n* `context` **{Object}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Block, or inverse block if specified and falsey.\n\n#### {{lte}}\n\nBlock helper that renders a block if `a` is **less than or equal to** `b`.\n\nIf an inverse block is specified it will be rendered when falsy.\nYou may optionally use the `compare=\"\"` hash argument for the\nsecond value.\n\n**Params**\n\n* `a` **{Sring}**\n* `b` **{Sring}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Block, or inverse block if specified and falsey.\n\n#### {{neither}}\n\nBlock helper that renders a block if **neither of** the given values\nare truthy. If an inverse block is specified it will be rendered\nwhen falsy.\n\n**Params**\n\n* `a` **{any}**\n* `b` **{any}**\n* `options` **{}**: Handlebars options object\n* `returns` **{String}**: Block, or inverse block if specified and falsey.\n\n#### {{not}}\n\nReturns true if `val` is falsey. Works as a block or inline helper.\n\n**Params**\n\n* `val` **{String}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**\n\n#### {{or}}\n\nBlock 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\n**Params**\n\n* `arguments` **{...any}**: Variable number of arguments\n* `options` **{Object}**: Handlebars options object\n* `returns` **{String}**: Block, or inverse block if specified and falsey.\n\n**Example**\n\n```handlebars\n{{#or a b c}}\n  If any value is true this will be rendered.\n{{/or}}\n```\n\n#### {{unlessEq}}\n\nBlock helper that always renders the inverse block **unless `a` is\nis equal to `b`**.\n\n**Params**\n\n* `a` **{String}**\n* `b` **{String}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Inverse block by default, or block if falsey.\n\n#### {{unlessGt}}\n\nBlock helper that always renders the inverse block **unless `a` is\nis greater than `b`**.\n\n**Params**\n\n* `a` **{Object}**: The default value\n* `b` **{Object}**: The value to compare\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Inverse block by default, or block if falsey.\n\n#### {{unlessLt}}\n\nBlock helper that always renders the inverse block **unless `a` is\nis less than `b`**.\n\n**Params**\n\n* `a` **{Object}**: The default value\n* `b` **{Object}**: The value to compare\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Block, or inverse block if specified and falsey.\n\n#### {{unlessGteq}}\n\nBlock helper that always renders the inverse block **unless `a` is\nis greater than or equal to `b`**.\n\n**Params**\n\n* `a` **{any}**\n* `b` **{any}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Block, or inverse block if specified and falsey.\n\n#### {{unlessLteq}}\n\nBlock helper that always renders the inverse block **unless `a` is\nis less than or equal to `b`**.\n\n**Params**\n\n* `a` **{any}**\n* `b` **{any}**\n* `options` **{Object}**: Handlebars provided options object\n* `returns` **{String}**: Block, or inverse block if specified and falsey.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckly%2Fhandlebars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheckly%2Fhandlebars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckly%2Fhandlebars/lists"}