npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bullhorn-handlebars-helpers

v0.5.0

Published

A collection of handlebars helpers

Downloads

3

Readme

Bullhorn Handlebars Helpers

Bower version NPM version Dependency Status devDependency Status

A collection of handlebars helpers to be used with Handlebars templating.

Install

Bower

bower install bullhorn-handlebars-helpers

NPM

npm install bullhorn-handlebars-helpers

Usage

Node

In Node.js environment, require the helper as a standard module and pass an instance of the Handlebars object to the required function.

var Handlebars = require( 'handlebars' );
var join = require( 'bullhorn/src/array/join' )( Handlebars );

The helper will be registered on the handlebars object inside of the required module. The helper is also returned as a standalone function incase it is required outside of a handlebars template. Usually you won't need to use the standalone function.

Alternatively you can register all helpers at once by requiring the bullhorn object and passing in the instance of Handlebars. This will also give you an object with all the functions on it for use outside of Handlebars templates.

var Handlebars = require( 'handlebars' );
var Bullhorn = require( 'bullhorn' )( Handlebars );
// Can now use Bullhorn.join( /* ARGS */ ); 

Browser

In a browser environment, just include the script to the helper as a script tag after the inclusion of the Handlebars script tag. (Some helpers require other libraries to be included before the helpers inclusion)

<script src="bower_components/handlebars/handlebars.js"></script>
<script src="bower_components/bullhorn/src/array/join.js"></script>

The helper will be registered on the handlebars object inside the script and a standalone function will be attached to a global Bullhorn object incase it is required outside of a handlebars template. The above script tag would be accessible from Bullhorn.join.

AMD

In an AMD environment, load the helper as you would any other AMD module. You'll need to configure a 'handlebars' path in your requirejs config as all the helpers load 'handlebars' in their definition. The helper will be registered on the handlebars object inside the module script and the standalone function is returned as the module export value incase it is required outside of a handlebars template. The standalone function is also attached to the global Bullhorn object the same as the standard browser environment.

requirejs.config({
    paths: {
        "handlebars": "path/to/handlebars"
    }
});

// My Module
define( [ 'bower_components/src/array/join' ], function( join ) {
    // Do something
});

Helpers

Detailed description of each helper can be found in their corresponding directory README under the src directory.

Array

  • Join

Collection

  • Limit
  • Reverse Each
  • Where

Comparison

  • Contains
  • Ends With
  • If Equal
  • If Equal Or
  • If Greater Than
  • If Greater Than Or Equal
  • If Less Than
  • If Less Than Or Equal
  • If Not Equal
  • Starts With

Date

  • Ago
  • Format Date
  • From Now
  • Now

Form

  • Options List

Format

  • To Fixed

HTML

  • List
  • Ordered List
  • Unordered List

Math

  • Add
  • Ceil
  • Divide
  • Floor
  • Multiply
  • Round
  • Subtract

Misc

  • Debug

String

  • Capitalize
  • Encode URI Component
  • Lowercase
  • Markdown
  • Truncate
  • Uppercase

License

Licensed under the MIT license.