{"id":13513084,"url":"https://github.com/leapfrogtechnology/just-handlebars-helpers","last_synced_at":"2025-05-16T13:07:38.088Z","repository":{"id":38419875,"uuid":"51920899","full_name":"leapfrogtechnology/just-handlebars-helpers","owner":"leapfrogtechnology","description":"A package with common Handlebars helpers.","archived":false,"fork":false,"pushed_at":"2024-11-01T13:31:48.000Z","size":3451,"stargazers_count":70,"open_issues_count":4,"forks_count":21,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-04-12T10:57:41.910Z","etag":null,"topics":["hacktoberfest","handlebars","handlebars-helpers","javascript","just-handlebars-helpers","template","templating"],"latest_commit_sha":null,"homepage":"https://yarn.pm/just-handlebars-helpers","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leapfrogtechnology.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2016-02-17T12:26:47.000Z","updated_at":"2025-01-30T17:10:43.000Z","dependencies_parsed_at":"2023-01-23T04:46:18.000Z","dependency_job_id":"7bd84046-9aef-49ab-8965-dbf1c39fe677","html_url":"https://github.com/leapfrogtechnology/just-handlebars-helpers","commit_stats":{"total_commits":291,"total_committers":11,"mean_commits":"26.454545454545453","dds":0.6563573883161512,"last_synced_commit":"b06ae13536fc044f7e2662c645c0fee34d734bd6"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leapfrogtechnology%2Fjust-handlebars-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leapfrogtechnology%2Fjust-handlebars-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leapfrogtechnology%2Fjust-handlebars-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leapfrogtechnology%2Fjust-handlebars-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leapfrogtechnology","download_url":"https://codeload.github.com/leapfrogtechnology/just-handlebars-helpers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254535829,"owners_count":22087399,"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":["hacktoberfest","handlebars","handlebars-helpers","javascript","just-handlebars-helpers","template","templating"],"created_at":"2024-08-01T04:00:37.579Z","updated_at":"2025-05-16T13:07:38.069Z","avatar_url":"https://github.com/leapfrogtechnology.png","language":"JavaScript","funding_links":[],"categories":["Helpers","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Just Handlebars Helpers\n\n[![NPM Version](https://img.shields.io/npm/v/just-handlebars-helpers.svg?style=flat-square)](https://www.npmjs.com/package/just-handlebars-helpers)\n[![NPM Downloads](https://img.shields.io/npm/dm/just-handlebars-helpers.svg?style=flat-square)](https://www.npmjs.com/package/just-handlebars-helpers)\n[![Travis](https://img.shields.io/travis/leapfrogtechnology/just-handlebars-helpers.svg?style=flat-square)](https://travis-ci.org/leapfrogtechnology/just-handlebars-helpers)\n[![Codecov](https://img.shields.io/codecov/c/github/leapfrogtechnology/just-handlebars-helpers.svg?style=flat-square)](https://codecov.io/github/leapfrogtechnology/just-handlebars-helpers?branch=master)\n\nA package with common [Handlebars](https://github.com/wycats/handlebars.js) helpers.\n\n## Installation\n\n```bash\nnpm install just-handlebars-helpers --save\n```\n\n```bash\nyarn add just-handlebars-helpers\n```\n\n## Usage\n\n### Browser\n\n#### General Usage\n\n```html\n\u003c!-- Load handlebars --\u003e\n\u003cscript src=\"/path/to/handlebars/dist/handlebars.min.js\"\u003e\u003c/script\u003e\n\u003c!-- Load just-handlebars-helpers --\u003e\n\u003cscript src=\"/path/to/just-handlebars-helpers/dist/h.min.js\"\u003e\u003c/script\u003e\n\n\u003cscript type=\"text/javascript\"\u003e\n  // Register just-handlebars-helpers with handlebars\n  H.registerHelpers(Handlebars);\n\u003c/script\u003e\n```\n\n#### Recommended Usage (CDN)\n\n```html\n\u003c!-- Load handlebars --\u003e\n\u003cscript src=\"https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.1.2/handlebars.min.js\"\u003e\u003c/script\u003e\n\u003c!-- Load just-handlebar-helpers --\u003e\n\u003cscript src=\"https://unpkg.com/just-handlebars-helpers@1.0.19/dist/h.min.js\"\u003e\u003c/script\u003e\n\n\u003cscript type=\"text/javascript\"\u003e\n  // Register just-handlebars-helpers with handlebars\n  H.registerHelpers(Handlebars);\n\u003c/script\u003e\n```\n\n### Node\n\n```js\n// Require handlebars and just-handlebars-helpers\nconst Handlebars = require(\"handlebars\");\nconst H = require(\"just-handlebars-helpers\");\n\n// Register just-handlebars-helpers with handlebars\nH.registerHelpers(Handlebars);\n```\n\n## Helpers\n\n| Helper                              | Description                                           |\n| ----------------------------------- | ----------------------------------------------------- |\n| [eq](#eq)                           | Strict equality `===`                                 |\n| [eqw](#eqw)                         | Equality `==`                                         |\n| [neq](#neq)                         | Strict inequality `!==`                               |\n| [neqw](#neqw)                       | Inequality `!=`                                       |\n| [lt](#lt)                           | Less than `\u003c`                                         |\n| [lte](#lte)                         | Less than or equal `\u003c=`                               |\n| [gt](#gt)                           | Greater than `\u003e`                                      |\n| [gte](#gte)                         | Greater than or equal `\u003e=`                            |\n| [not](#not)                         | Not `!`                                               |\n| [ifx](#ifx)                         | Imitates conditional operator `?:`                    |\n| [empty](#empty)                     | Check if an array is empty                            |\n| [count](#count)                     | Length of an array                                    |\n| [and](#and)                         | Logical AND operation                                 |\n| [or](#or)                           | Logical OR operation                                  |\n| [coalesce](#coalesce)               | Returns first non-falsy value from list of parameters |\n| [includes](#includes)               | Check for a value inside an array                     |\n| [excerpt](#excerpt)                 | Extract a sub-string from a string                    |\n| [sanitize](#sanitize)               | Sanitize a string to url friendly dash/kebab case     |\n| [newLineToBr](#newlinetobr)         | Replace new line with line breaks `\u003cbr\u003e` of a string  |\n| [capitalizeEach](#capitalizeeach)   | Capitalize the first letter of each word in a string  |\n| [capitalizeFirst](#capitalizefirst) | Capitalize the first letter of a string               |\n| [sprintf](#sprintf)                 | String produced according to the formatting format    |\n| [lowercase](#lowercase)             | String to lowercase                                   |\n| [uppercase](#uppercase)             | String to uppercase                                   |\n| [first](#first)                     | First element of an array                             |\n| [last](#last)                       | Last element of an array                              |\n| [concat](#concat)                   | Concatenate two or more strings                       |\n| [join](#join)                       | Join elements of an array using a delimeter           |\n| [sum](#sum)                         | Sum of two numbers                                    |\n| [difference](#difference)           | Difference of two numbers                             |\n| [multiplication](#multiplication)   | Multiplication of two numbers                         |\n| [division](#division)               | Division of two numbers                               |\n| [remainder](#remainder)             | Remainder of two numbers                              |\n| [ceil](#ceil)                       | Round a number upward to its nearest integer          |\n| [floor](#floor)                     | Round a number downward to its nearest integer        |\n| [abs](#abs)                         | Find the absolute value of a number                   |\n| [formatDate](#formatdate)           | Format date to specified format                       |\n| [showIf](#showif)                   | Show HTML element if expression is true               |\n| [hideIf](#hideif)                   | Hide HTML element if expression is true               |\n| [selectedIf](#selectedif)           | Select `\u003coption\u003e` if expression is true               |\n| [checkedIf](#checkedif)             | Check the `\u003cinput\u003e` checkbox if expression is true    |\n| [options](#options)                 | Generate `\u003coption\u003e` list for `\u003cselect\u003e`               |\n| [formatCurrency](#formatcurrency)   | Format currency value according to country            |\n\n### ⚠️\n\n\u003e Helpers [formatDate](#datetime), [formatCurrency](#formatcurrency) and [sprintf](#sprintf) depend on an external dependency and it is up to the user to install these dependencies. Check the helper documentation for what dependencies to install.\n\n### Conditional\n\n#### eq\n\nDetermine whether or not two values are equal (===).\n\nParameters:\n\n```\nvalue1 [any] First value to be compared with second. (Required)\nvalue2 [any] Second value to be compared with first. (Required)\n```\n\nReturns `boolean`\n\nUsage:\n\n```\n{{eq '3' 3}}    =\u003e false\n\n{{#if (eq foo 'bar')}}\n\tHello\n{{/if}}\n```\n\n#### eqw\n\nDetermine whether or not two values are equal (==) i.e. weak checking.\n\nParameters:\n\n```\nvalue1 [any] First value to be compared with second. (Required)\nvalue2 [any] Second value to be compared with first. (Required)\n```\n\nReturns `boolean`\n\nUsage:\n\n```\n{{eqw '3' 3}}   =\u003e true\n\n{{#if (eqw foo 'bar')}}\n\tHello\n{{/if}}\n```\n\n#### neq\n\nDetermine whether or not two values are not equal (!==).\n\nParameters:\n\n```\nvalue1 [any] First value to be compared with second. (Required)\nvalue2 [any] Second value to be compared with first. (Required)\n```\n\nReturns `boolean`\n\nUsage:\n\n```\n{{neq 4 3}}    =\u003e true\n\n{{#if (neq foo 'bar')}}\n\tHello\n{{/if}}\n```\n\n#### neqw\n\nDetermine whether or not two values are not equal (!=) weak checking.\n\nParameters:\n\n```\nvalue1 [any] First value to be compared with second. (Required)\nvalue2 [any] Second value to be compared with first. (Required)\n```\n\nReturns `boolean`\n\nUsage:\n\n```\n{{neqw '3' 3}}    =\u003e false\n\n{{#if (neqw foo 'bar')}}\n\tHello\n{{/if}}\n```\n\n#### lt\n\nCheck for less than condition (a \u003c b).\n\nParameters:\n\n```\nvalue1 [any] First value to be compared with second. (Required)\nvalue2 [any] Second value to be compared with first. (Required)\n```\n\nReturns `boolean`\n\nUsage:\n\n```\n{{lt 2 3}}   =\u003e true\n\n{{#if (lt 2 5)}}\n\tHello\n{{/if}}\n```\n\n#### lte\n\nCheck for less than or equals condition (a \u003c= b).\n\nParameters:\n\n```\nvalue1 [any] First value to be compared with second. (Required)\nvalue2 [any] Second value to be compared with first. (Required)\n```\n\nReturns `boolean`\n\nUsage:\n\n```\n{{lte 2 3}}   =\u003e true\n\n{{#if (lte 5 6)}}\n\tHello\n{{/if}}\n```\n\n#### gt\n\nCheck for greater than condition (a \u003e b).\n\nParameters:\n\n```\nvalue1 [any] First value to be compared with second. (Required)\nvalue2 [any] Second value to be compared with first. (Required)\n```\n\nReturns `boolean`\n\nUsage:\n\n```\n{{gt 2 3}}   =\u003e false\n\n{{#if (gt 10 7)}}\n\tHello\n{{/if}}\n```\n\n#### gte\n\nCheck for greater than or equals condition (a \u003e= b).\n\nParameters:\n\n```\nvalue1 [any] First value to be compared with second. (Required)\nvalue2 [any] Second value to be compared with first. (Required)\n```\n\nReturns `boolean`\n\nUsage:\n\n```\n{{gte 3 3}}   =\u003e true\n\n{{#if (gte 10 2)}}\n\tHello\n{{/if}}\n```\n\n#### not\n\nLogical NOT of any expression. Equivalent to `!` operator.\n\nParameters:\n\n```\nexpression [any] Any expression.\n```\n\nReturns `boolean`\n\nUsage:\n\n```\n{{not true}}    =\u003e false\n{{not false}}   =\u003e true\n\n{{#if (not (eq foo 'bar'))}}\n\tHello\n{{/if}}\n```\n\n#### ifx\n\nHelper to imitate the ternary conditional operator ?:. E.g. `5 \u003e 7 ? 'foo' : 'bar'`.\n\nParameters:\n\n```\ncondition [boolean] Satisfying condition for getting first value. Either true of false. (Required)\nvalue1 [any] First value to be displayed as result. (Required)\nvalue2 [any] Second value to be displayed as result. Defaults to an empty string (Optional)\n```\n\nReturns `any`\n\nUsage:\n\n```\n{{ifx true 'Foo' 'Bar'}}        =\u003e Foo  // return (true) ? 'Foo' : 'Bar'\n{{ifx false 'Foo' 'Bar'}}       =\u003e Foo  // return (false) ? 'Foo' : 'Bar'\n{{ifx (eq value 1) 5 6}}        =\u003e 6    // return (value === 1) ? 5 : 6\n{{ifx (not (eq value 1)) 5 6}}  =\u003e 6    // return (value !== 1) ? 5 : 6\n\n\u003c!-- The third parameter is optional, and by default it will be blank string ('') --\u003e\n{{ifx true 'active'}}  =\u003e 'active'\n{{ifx false 'active'}}  =\u003e ''\n```\n\n#### empty\n\nCheck if an array is empty.\n\nParameters:\n\n```\narray [array] Array/object to be checked. (Required)\n```\n\nReturns `boolean`\n\nUsage:\n\n```\nvar array = [5, 6];     // An array.\n{{empty array}} =\u003e false\n\n{{#if (empty array)}}\n\tHello\n{{/if}}\n```\n\n#### count\n\nDetermine the length of an array. Equivalent to `array.length` operator in JavaScript.\n\nParameters:\n\n```\narray [array] Array whose elements to be counted. (Required)\n```\n\nReturns `number|false`\n\nUsage:\n\n```\nvar array = [5, 6];    // An array.\n{{count array}} =\u003e  2;\n```\n\n#### and\n\nReturns the logical AND of two or more parameters passed i.e\nit is true iff all the parameters are true.\n\nParameters:\n\n```\nparams [any] Any number of boolean parameters. (Required)\n```\n\nReturns `boolean`\n\nUsage:\n\n```\nvar value1 = value2 = true;\n{{and value1 value2}}    =\u003e true\n\nvar value1 = false, value2 = true;\n{{and value1 value2}}    =\u003e false\n\n{{#if (and value1 value2)}}\n    // do something\n{{else}}\n    // do something else\n{{/if}}\n```\n\n#### or\n\nReturns the logical OR of two or more parameters passed i.e\nit is true if any of the parameters is true.\n\nParameters:\n\n```\nparams [any] Any number of boolean parameters. (Required)\n```\n\nReturns `boolean`\n\nUsage:\n\n```\nvar value1 = true, value2 = false;\n{{or value1 value2}}    =\u003e true\n\nvar value = value2 = false;\n{{or value1 value2}}    =\u003e false\n\n{{#if (or value1 value2)}}\n    // do something\n{{else}}\n    // do something else\n{{/if}}\n```\n\n#### coalesce\n\nReturns the first non-falsy value from the parameter list.\nWorks quite similar to the SQL's COALESCE() function, but unlike this\nchecks for the first non-false parameter.\n\nParameters:\n\n```\nparams [any] Any number of parameters. (Required)\n```\n\nReturns `any`\n\nUsage:\n\n```\nvar fullName = 'Foo Bar', nickName = 'foob';\n{{coalesce fullName nickName 'Unknown'}}    =\u003e 'Foo Bar'\n\nvar fullName = '', nickName = 'foob';\n{{coalesce fullName nickName 'Unknown'}}    =\u003e 'foob'\n```\n\n#### includes\n\nReturns true if an array includes a value.\nIt checks for the existence of the value in array strictly(value + data type) by default.\nCan check non-strictly(value only) by sending third argument as false.\n\nParameters:\n\n```\nparams [array] The array. (Required)\nparams [any] The value to be checked for existence in the array. (Required)\nparams [boolean] FALSE for non-strict checking. TRUE by default. (Optional)\n```\n\nReturns `boolean`\n\nUsage:\n\n```\nvar array = [1, 2, 3];\nvar value = 2;\n\n{{includes array value}}        =\u003e true\n\nvar value = '2'\n{{includes array value}}        =\u003e false\n{{includes array value true}}   =\u003e false\n{{includes array value false}}  =\u003e true\n\n{{#if (includes array value)}}\n   \u003c!-- Do something --\u003e\n{{/if}}\n\n{{ifx (includes array value) 'Yes' 'No'}}\n```\n\n### Strings\n\n#### excerpt\n\nExtract a sub-string from a string.\n\nParameters:\n\n```\nstring [string] The string from which characters are to be extracted. (Required)\nlength [int] Number of characters to be extracted from string. Default value is 50. (Optional)\n```\n\nReturns `string`\n\nUsage:\n\n```\n{{excerpt 'Just Wow' 4}} =\u003e 'Just...'\n```\n\n#### sanitize\n\nConverts a string to URL friendly dash-case string removing special characters.\n\nParameters\n\n```\nstring [string] The string to be converted to URL. (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\n{{sanitize 'JuSt #Wow'}} =\u003e 'just-wow'\n```\n\n#### newLineToBr\n\nReplace `\\n` with `\u003cbr\u003e` tags.\n\nParameters:\n\n```\nstring [string] The string that needs replacement of \\n by \u003cbr\u003e tags. (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\n{{{newLineToBr 'newLineToBr helper \\n is very \\n useful.'}}}    =\u003e newLineToBr helper \u003cbr\u003e is very \u003cbr\u003e useful.\n```\n\n#### capitalizeEach\n\nCapitalize the first letter of each word in a string.\n\nParameters\n\n```\nstring [string] The sentence/string to be capitalized. (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\n{{capitalizeEach 'just wow'}} =\u003e 'Just Wow'\n```\n\n#### capitalizeFirst\n\nCapitalize the first letter of a string.\n\nParameters:\n\n```\nstring [string] The sentence/string to be capitalized. (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\n{{capitalizeFirst 'just wow'}} =\u003e 'Just wow'\n```\n\n#### sprintf\n\n`sprintf` helper sends formatted data as string output.\n\n**Note:** To use `sprintf` helper install [sprintf-js](https://www.npmjs.com/package/sprintf-js).\n\n`npm install sprintf-js --save`\n\nParameters:\n\n```\nformat [string] The message/string that uses different formats of variables. (Required)\nargs [arbitrary arguments] Any number of parameters/values. (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\n{{sprintf '%s %s!' 'Hello' 'Kabir' }}\n{{sprintf '%s %s %d %s %d' 'Foo' 'Bar' 55 'Baz' '20'}}\n{{sprintf '%(greeting)s %(name)s! How are you?' obj }}\n{{sprintf '%(greeting)s %(name)s! ' greeting='Hello' name='Kabir'}}\n```\n\n#### lowercase\n\nChanges the string to lowercase.\n\nParameters:\n\n```\nparam [string] The string to be converted to lower case. (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\n{{lowercase 'JUST WOW!!!'}} =\u003e 'just wow!!!'\n```\n\n#### uppercase\n\nChanges the string to uppercase.\n\nParameters:\n\n```\nparam [string] The string to be converted to upper case. (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\n{{uppercase 'just wow!!!'}} =\u003e 'JUST WOW!!!'\n```\n\n#### first\n\nGet the first element of a collection/array.\n\nParameters:\n\n```\ncollection [array] The collection/array of objects(strings, integers). (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\nsomeArray = ['David', 'Miller', 'Jones'];\n{{first someArray}} =\u003e 'David'\n```\n\n#### last\n\nGet the last element of a collection/array.\n\nParameters:\n\n```\ncollection [array] The collection/array of objects(strings, integers). (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\nsomeArray = ['David', 'Miller', 'Jones'];\n{{last someArray}} =\u003e 'Jones'\n```\n\n#### concat\n\nConcat two or more strings.\n\nParameters:\n\n```\nparams [arguments] Any number of arguments. (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\n{{concat 'Hello' ' world' '!!!'}} =\u003e 'Hello world!!!'\n```\n\n#### join\n\nJoin the elements of an array using a delimeter.\n\nParameters:\n\n```\narray [array] An array of elements to be joined. (Required)\ndelimeter [string] The delimeter using which the elements of array are to be joined. (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\nsomeArray = ['Hands', 'legs', 'feet'];\n{{join someArray ' \u0026 '}}   =\u003e 'Hands \u0026 legs \u0026 feet'\n```\n\n### Math\n\n#### sum\n\nA `sum` helper calculating the sum of two numbers.\n\nParameters:\n\n```\nvalue1 [number] First number. (Required)\nvalue2 [number] Second number. (Required)\n```\n\nReturns `number`\n\nUsage:\n\n```\n{{sum 1 2}}     =\u003e 3\n{{sum 5.6 6.7}} =\u003e 12.3\n```\n\n#### difference\n\nA `difference` helper calculating the difference of two numbers.\n\nParameters:\n\n```\nvalue1 [number] First number. (Required)\nvalue2 [number] Second number. (Required)\n```\n\nReturns `number`\n\nUsage:\n\n```\n{{difference 5 2}}      =\u003e 3\n{{difference 7.2 3.4}}  =\u003e 3.8\n```\n\n#### multiplication\n\nA `multiplication` helper calculating the multiplication of two numbers.\n\nParameters:\n\n```\nvalue1 [number] First number. (Required)\nvalue2 [number] Second number. (Required)\n```\n\nReturns `number`\n\nUsage:\n\n```\n{{multiplication 5 2}}      =\u003e 10\n{{multiplication 5.2 6.4}}  =\u003e 33.28\n```\n\n#### division\n\nA `division` helper calculating the division of two numbers.\n\nParameters:\n\n```\nvalue1 [number] First number. (Required)\nvalue2 [number] Second number. (Required)\n```\n\nReturns `number`\n\nUsage:\n\n```\n{{division 4 2}}      =\u003e 2\n{{division 5.2 1.6}}  =\u003e 3.25\n```\n\n#### remainder\n\nA `remainder` helper calculating the remainder of two numbers.\n\nParameters:\n\n```\nvalue1 [number] First number. (Required)\nvalue2 [number] Second number. (Required)\n```\n\nReturns `number`\n\nUsage:\n\n```\n{{remainder 5 3}}      =\u003e 2\n{{remainder 5.2 2.5}}  =\u003e 0.20000000000000018\n```\n\n#### ceil\n\nA `ceil` helper to find the ceil value of the number. Equivalent to `Math.ceil()` in JavaScript.\n\nParameters:\n\n```\nvalue1 [number] Number to be rounded to nearest greater integer. (Required)\n```\n\nReturns `integer`\n\nUsage:\n\n```\n{{ceil 5.6}}    =\u003e 6\n```\n\n#### floor\n\nA `floor` helper to find the floor value of the number. Equivalent to `Math.floor()` in JavaScript.\n\nParameters:\n\n```\nvalue [number] Number to be rounded to nearest lower integer. (Required)\n```\n\nReturns `integer`\n\nUsage:\n\n```\n{{floor 5.6}}   =\u003e 5\n```\n\n#### abs\n\nAn `abs` helper to find the absolute value of the number. Equivalent to `Math.abs()` in JavaScript.\n\nParameters:\n\n```\nvalue [number] Number to perform absolute value operation on. (Required)\n```\n\nReturns `number`\n\nUsage:\n\n```\n{{abs -5.6}}   =\u003e 5.6\n```\n\n### DateTime\n\n**Note:** To use DateTime helpers install [moment](https://www.npmjs.com/package/moment).\n\n`npm install moment --save`\n\n#### formatDate\n\nA `formatDate` helper to format date using moment.js\n\nParameters:\n\n```\nformatString [string] Format string based on moment.js (Required)\ndate [date] The date/date-time that needs to be formatted. (set to current Date() if not provided)\nlocaleString [string] ISO 3166-1 locale code represented in https://github.com/moment/moment/tree/develop/locale\nor an array of possible locale codes, of which moment will use the first one it has a localization for.\n```\n\nReturns `string`\n\nUsage:\n\n```\nvar date = new Date();      // Date | Date-time\n{{formatDate 'MM/DD/YYYY' date}}\n\nvar date = new Date('01/22/2016');\nvar possibleI8nCodes = ['xy', 'aa', 'de'];\n{{formatDate 'YYYY-MM-DD' date}}    =\u003e 2016-01-22\n{{formatDate 'LLLL', date, 'es'}}    =\u003e 'viernes, 22 de enero de 2016 0:00'\n{{formatDate 'LLLL', date, possibleI8nCodes}}    =\u003e 'Freitag, 22. Januar 2016 00:00'\n```\n\n### HTML\n\n#### showIf\n\nA `showIf` helper for showing any HTML element.\n\nParameters:\n\n```\nexpression [boolean] Condition to be checked. (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\n{{showIf true}}     =\u003e ''\n{{showIf false}}    =\u003e 'hidden'\n```\n\n#### hideIf\n\nA `hideIf` helper for hiding any HTML element.\n\nParameters:\n\n```\nexpression [boolean] Condition to be checked. (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\n{{hideIf true}}     =\u003e 'hidden'\n{{hideIf false}}    =\u003e ''\n```\n\n#### selectedIf\n\nA `selectedIf` helper for dropdown and radio boxes.\n\nParameters:\n\n```\nexpression [boolean] Condition to be checked. (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\n{{selectedIf true}}     =\u003e 'selected'\n```\n\n#### checkedIf\n\nA `checkedIf` helper for checkboxes.\n\nParameters:\n\n```\nexpression [boolean] Condition to be checked. (Required)\n```\n\nReturns `string`\n\nUsage:\n\n```\n{{checkedIf true}}      =\u003e 'checked'\n```\n\n#### options\n\nAn `options` helper for generating `\u003coption\u003e` list for `\u003cselect\u003e` dropdowns.\n\nParameters:\n\n```\ndata [array] List of data (Required)\nid [string] Name of identifier key from the data list, defaults to id (Optional)\ntext [string] Name of description key from the data list, defaults to description (Optional)\nselected [string] Id to be set as selected (Optional)\n```\n\nUsage:\n\n```\n{{{options data}}}\n{{{options data selected=\"value\"}}}\n{{{options data id=\"id\" text=\"description\"}}}\n```\n\nA simple example:\n\n```\nconst data = [\n    {\n        id: 1,\n        description: 'Foo'\n    },\n    {\n        id: 2,\n        description: 'Bar'\n    },\n    {\n        id: 3,\n        description: 'Foo Bar'\n    }\n];\n```\n\n```\n{{{options data selected=\"2\"}}}\n```\n\nwill generate HTML:\n\n```\n\u003coption value=\"1\"\u003eFoo\u003c/option\u003e\n\u003coption value=\"2\" selected\u003eBar\u003c/option\u003e\n\u003coption value=\"3\"\u003eFoo Bar\u003c/option\u003e\n```\n\nYou can also override the default key names for `id` \u0026 `description` using the `id` \u0026 `text` options in the helper.\n\n```\nconst data = [\n    {\n        value: 1,\n        text: 'New York'\n    },\n    {\n        value: 2,\n        text: 'London'\n    }\n];\n```\n\n```\n{{{options data selected=\"1\" id=\"value\" text=\"text\"}}}\n```\n\nwill generate HTML:\n\n```\n\u003coption value=\"1\" selected\u003eNew York\u003c/option\u003e\n\u003coption value=\"2\"\u003eLondon\u003c/option\u003e\n```\n\n### Formatters\n\n#### formatCurrency\n\nFormat the currency value according to country code and locale.\n\n**Note:** To use the `formatCurrency` helper install [currencyformatter.js](https://www.npmjs.com/package/currencyformatter.js).\n\n`npm install currencyformatter.js --save`\n\nParameters:\n\n```\nvalue [number] The numerical value of currency. (Required)\nargs [arbitrary arguments] The currency formatting parameters. (Optional)\n```\n\nReturns: `string`\n\nUsage:\n\n```\n{{formatCurrency 1234567.89 code='USD'}}  =\u003e $1,234,567.89\n{{formatCurrency 1234567.89 code='EUR'}}  =\u003e 1.234.567,89 €\n{{formatCurrency 1234567.89 code='EUR' locale=\"en\"}}  =\u003e €1,234,567.89\n```\n\nNote: The currency formatting parameters are used from [https://github.com/osrec/currencyFormatter.js](https://github.com/osrec/currencyFormatter.js).\n\n## Contributing\n\nProject participants should adhere to the [Code of Conduct](CODE_OF_CONDUCT.md). If you are unsure about how to contribute please file an [issue](https://github.com/leapfrogtechnology/just-handlebars-helpers/issues/new).\n\nStart here: [src/H.js](src/H.js)\n\n```bash\n# Install dependencies\n$ yarn\n\n# Lint source code\n$ yarn lint\n\n# Compile everything\n$ gulp\n\n# Run all the tests\n$ yarn test\n```\n\n## Inspired by\n\n- [Swag](https://github.com/elving/swag)\n- [Dashbars](https://github.com/pismute/dashbars)\n- [Assemble](https://github.com/assemble/handlebars-helpers)\n\n## Change Log\n\nCheck the [CHANGELOG](CHANGELOG.md) for change log and release history.\n\n## License\n\nLicensed under [The MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleapfrogtechnology%2Fjust-handlebars-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleapfrogtechnology%2Fjust-handlebars-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleapfrogtechnology%2Fjust-handlebars-helpers/lists"}