Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
handlebars-helper-repeat
Advanced tools
Handlebars block helper for repeating whatever is inside the block `n` number of times.
Handlebars block helper for repeating whatever is inside the block
n
number of times.
If you find a bug or have a feature request, please create an issue.
npm i handlebars-helper-repeat --save
var helper = require('handlebars-helper-repeat');
var handlebars = require('handlebars');
// 2. register the helper, name it whatever you want
handlebars.registerHelper('repeat', helper);
// 3. register some partials
handlebars.registerPartial('button', '<button>{{text}}</button>');
// 4. use in templates
handlebars.compile('{{repeat 2}}{{> button }}{{/repeat}}')({text: 'Click me!'});
//=> '<button>Click me!</button><button>Click me!</button>'
Private variables
A few private variables are exposed to blocks:
count
the total number of blocks being generatedindex
the index of the current blockstart
the start number to use instead of zero. Basically index + start
Example:
{{#repeat count=2 start=17}}
{{> button }}<span>{{@index}}</span>
{{else}}
Nothing :(
{{/repeat}}
Results in something like:
<button>Click me!</button><span>17</span>
<button>Click me!</button><span>18</span>
Index
Output the index of the current block:
{{#repeat '2'}}
<div id="{{@index}}">
{{> button }}
</div>
{{/repeat}}
Results in something like:
<div id="0">
<button>Click me</button>
</div>
<div id="1">
<button>Click me</button>
</div>
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Install dev dependencies.
npm i -d && npm test
Jon Schlinkert
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on March 15, 2015.
FAQs
Handlebars block helper for repeating whatever is inside the block _n_ times.
The npm package handlebars-helper-repeat receives a total of 818 weekly downloads. As such, handlebars-helper-repeat popularity was classified as not popular.
We found that handlebars-helper-repeat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.