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

hbl-urls

v0.1.0

Published

A helper for Handlebars that adds URL manipulation.

Downloads

1

Readme

hbl-urls

A helper for Handlebars that adds URL manipulation. Meant to supercede helpers/handlebars-helpers' URLs helpers.

Usage

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

const tpl = Handlebars.compile('{{escape https://neutralis.org/neu tral is.html}}');
console.log(tpl() // result : 'https%3A%2F%2Fneutralis.org%2Fneu%20tral%20is.html'

Package documentation

{{ decodeURI uri }}

Decode an URI.

Usage : {{ decodeURI "https%3A%2F%2Fneutralis.org" }}

Result : https://neutralis.org

{{ encodeURI uri }}

Encode an URI.

Usage : {{ encodeURI "https://neutralis.org" }}

Result : https%3A%2F%2Fneutralis.org

{{ escape url }}

Escape a URL.

Usage : {{ escape "https://neutralis.org/neu tral is.html" }}

Result : https%3A%2F%2Fneutralis.org%2Fneu%20tral%20is.html

{{ stripProtocol url }}

Remove the protocol from a URL. It removes only the protocol and the trailing colon — the two trailing slashes after persist. This is done to maintain compatibility with helpers/handlebars-helpers.

Usage : {{ stripProtocol "https://neutralis.org?q=neutralis&v=0.1.0" }}

Result : //neutralis.org?q=neutralis&v=0.1.0

{{ stripQuerystring url }}

Remove the query string from a URL.

Usage : {{ stripQuerystring "https://neutralis.org/page?q=neutralis&v=0.1.0" }}

Result : https://neutralis.org/page

{{ urlParse url }}

Parse a URL into a JSON object.

Usage : {{ urlParse "https://neutralis.org?q=neutralis" }}

Result (expanded) :

{
	"protocol": "https:",
	"href": "https://neutralis.org/?q=neutralis",
	"host": "neutralis.org",
	"hostname": "neutralis.org",
	"port": "",
	"pathname": "/",
	"search": "?q=neutralis",
	"searchParams": {"q":"neutralis"},
	"hash": "",
	"origin": "https://neutralis.org",
	"password":"",
	"username":""
}

{{ urlResolve url }}

Resolve a path to a URL.

Usage : {{ urlResolve "https://neutralis.org" "query" }}

Result : https://neutralis.org/query

{{ url_decode uri }}

Decode an URI. An alias of {{ decodeURI uri }}.

Usage : {{ decodeURI "https%3A%2F%2Fneutralis.org" }}

Result : https://neutralis.org

{{ url_encode uri }}

Encode an URI. An alias of {{ encodeURI uri }}.

Usage : {{ url_encode "https://neutralis.org" }}

Result : https%3A%2F%2Fneutralis.org

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.