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 🙏

© 2025 – Pkg Stats / Ryan Hefner

hbl-strings

v0.1.0

Published

A helper for Handlebars that adds string manipulation.

Downloads

3

Readme

hbl-strings

A helper for Handlebars that adds string manipulation. Meant to superseed helpers/handlebars-helpers' string helpers.

It omits a few helpers, namely :

  • {{ dashcase str }}
  • {{ dotcase str }}
  • {{ pascalcase str }}
  • {{ pathcase str }}
  • {{ sentence str }}
  • {{ snakecase str }}
  • {{ titleize str }}

These helpers are/were broken in the original package ; a string like this it title case would become This Is Title Case instead of This is Title Case when using {{titleize str}}, or would take I Like TV and make it I like tv when using {{ sentence str }}. If you need these helpers, you will need to still use helpers/handlebars-helpers or a different helper package.

Usage

const Handlebars = require('handlebars');
require('hbl-strings').default();

const tpl = Handlebars.compile('{{trim x}}');
console.log(tpl({x: '   Neutralis   '})) // result : 'Neutralis'

Package documentation

{{ append str suffix }}

Append a substring to a string.

Usage : {{ append "Neu" "tralis" }}

Result : Neutralis

{{ camelcase str }}

Converts a string to camelcase.

Usage : {{ camelcase "neutralis maintains packages" }}

Result : neutralis_maintains_packages

{{ capitalize str }}

Capitalise a string. Aliased to {{ capitalise str }}.

Usage : {{ capitalize "neutralis" }}

Result : Neutralis

{{ capitalizeAll str }}

Capitalise every word in a string. Aliased to {{ capitaliseAll str }}.

Usage : {{ capitalizeAll "neutralis maintains packages" }}

Result : Neutralis Maintains Packages

{{ center str spaces }}

Centres a string using a pre-defined (spaces parameter) number of "invisible", non-breaking spaces.

Usage : {{ center "Neutralis" 3 }}

Result : Neutralis

{{ contains str substr }}

Checks if a substring is within a string.

Usage : {{ contains "tralis" "Neutralis" }}

Result : true

{{ ellipsis str limit }}

Truncates a string and appends an ellipsis character ().

Usage : {{ ellipsis "Neutralis 3" }}

Result : Neu…

{{ endsWith str suffix }}

Checks if a string ends with a suffix.

Usage : {{ endsWith "tralis" "Neutralis" }}

Result : true

{{ hyphenate str }}

Replaces the spaces within a string to hyphens.

Usage : {{ hyphenate "Neutralis maintains packages" }}

Result : Neutralis-maintains-packages

{{ isString var }}

Checks if a passed variable is a string or not.

Usage : {{ isString "Neutralis maintains packages" }}

Result : true

{{ lowercase str }}

Converts string to all lowercase variables. Aliased with {{ downcase str }}.

Usage : {{ lowercase "Neutralis Maintains PACKAGES" }}

Result : neutralis maintains packages

{{ occurrences str substr}}

Counts the amount of occurrences of a substring within a string.

Usage : {{ occurrences "Neutralis" "Neu" }}

Result : 3

{{ prepend str substr}}

Prepends a substring to a string.

Usage : {{ prepend "tralis" "neu" }}

Result : neutralis

{{ plusify str }}

Replaces the spaces within a string to pluses.

Usage : {{ plusify "Neutralis maintains packages" }}

Result : Neutralis+maintains+packages

{{{{ raw }}}}

Prevents contents of block from being compiled/rendered.

Usage : {{{{raw}}}} {{neutralis}} {{{{/raw}}}}

Result : {{neutralis}}

{{ remove str substr }}

Remove all instances of a substring within a string.

Usage : {{ remove "Neutralis maintains packages and packages" "packages" }}

Result : Neutralis maintains and

{{ removeFirst str substr }}

Remove the first instance of a subtring within a string.

Usage : {{ removeFirst "Neutralis maintains packages and packages" }}

Result : Neutralis maintains and packages

{{ replace str substr replacement }}

Replace all instances of a substring within a string.

Usage : {{ replace "Neutralis maintains packages and packages" "packages" "pACKages" }}

Result : Neutralis maintains pACKages and pACKages

{{ replaceFirst str substr replacement }}

Replace the first instance of a subtring within a string.

Usage : {{ replaceFirst "Neutralis maintains packages and packages" "packages" "pACKages" }}

Result : Neutralis maintains pACKages and packages

{{ reverse str }}

Reverse a string.

Usage : {{ reverse "Neutralis" }}

Result : silartueN

{{ split str substr }}

Checks if a string starts with a prefix.

Usage : {{ split "Neutralis maintains packages and packages" "packages" }}

Result : TODO

{{ startsWith prefix str }}

Checks if a string starts with a prefix.

Usage : {{ startsWith "Neu" "Neutralis" }}

Result : true

{{ trim str }}

Trims whitespace from a string.

Usage : {{ trim " Neutralis " }}

Result : Neutralis

{{ trimLeft str }}

Trims whitespace from the start of a string.

Usage : {{ trimLeft " Neutralis " }}

Result : Neutralis

{{ trimRight str }}

Trims whitespace from the end of a string.

Usage : {{ trimRight " Neutralis " }}

Result : Neutralis

{{ truncate str limit }}

Truncate a string to a limit of characters, ending with an ellipsis (preserves compatibility with helpers/handlebars-helpers).

Usage : {{ truncate "Neutralis maintains packages" 3 }}

Result : Neu…

{{ truncateWords str limit }}

Truncate a string to a limit of words, ending with an ellipsis (preserves compatibility with helpers/handlebars-helpers).

Usage : {{ truncateWords "Neutralis maintains packages" 2 }}

Result : Neutralis maintains…

{{ uppercase str }}

Uppercase all characters within a string. Aliased with {{ upcase str }}.

Usage : {{ uppercase "Neutralis Maintains PACKAGES" }}

Result : NEUTRALIS MAINTAINS PACKAGES

Acknowledgements

This package is licensed under the 3-Clause BSD licence. A copy of it can be found in the LICENSE file in the root of the source repository and in the root of the package directory.