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

liquidless

v1.3.4

Published

Shopify's Liquid template engine, but less powerful

Downloads

14,036

Readme

liquidless

Shopify's Liquid template engine, but less powerful. Perfect for configuration files

Get Started

Install the dependency from npm:

npm i liquidless

Import the renderString function

import { renderString } from 'liquidless'

Usage

Example: Rendering a string

renderString('Hello, {{ world }}', { world: 'world!' })

Outputs:

Hello, world!

Example: Using filters

renderString('Hello, {{ world | upcase }}', { world: 'world!' })

Outputs:

Hello, WORLD!

Example: Supplying custom filters

renderString('Hello, {{ world | something: 1, 2, 3 }}', { world: 'world!' }, {
  filters: {
    something: (value, args, variable) => `${value} ${args.join(', ')} (${variable})`
  }
})

Outputs:

Hello, world! 1, 2, 3 (world)

Example: Rending values in an object

import { renderObject } from 'liquidless'
renderObject([{hello: {world: '{{ world }}'}}], { world: 'world!' })

Outputs

[{hello: {world: 'world!'}}]

Filters

  • append - Adds a given string to the end of a string.
  • base64_decode - Decodes a string in Base64 format.
  • base64_encode - Encodes a string to Base64 format.
  • camelize - Converts a string to CamelCase.
  • capitalize - Capitalizes the first word in a string and downcases the remaining characters.
  • downcase - Converts a string to all lowercase characters.
  • escape - Escapes special characters in HTML, such as <>, ', and &, and converts characters into escape sequences.
  • hmac_sha1 - Converts a string into an SHA-1 hash using a hash message authentication code (HMAC).
  • hmac_sha256 - Converts a string into an SHA-256 hash using a hash message authentication code (HMAC).
  • lstrip - Strips all whitespace from the left of a string.
  • md5 - Converts a string into an MD5 hash.
  • newline_to_br - Converts newlines (\n) in a string to HTML line breaks (<br>).
  • pluralize - Outputs the singular or plural version of a string based on a given number.
  • prepend - Adds a given string to the beginning of a string.
  • remove - Removes any instance of a substring inside a string.
  • remove_first - Removes the first instance of a substring inside a string.
  • remove_last - Removes the last instance of a substring inside a string.
  • replace - Replaces any instance of a substring inside a string with a given string.
  • replace_first - Replaces the first instance of a substring inside a string with a given string.
  • replace_last - Replaces the last instance of a substring inside a string with a given string.
  • rstrip - Strips all whitespace from the right of a string.
  • sha1 - Converts a string into an SHA-1 hash using a hash message authentication code (HMAC).
  • sha256 - Converts a string into an SHA-256 hash using a hash message authentication code (HMAC).
  • slice - Returns a substring or series of array items, starting at a given 0-based index.
  • split - Splits a string into an array of substrings based on a given separator.
  • strip - Strips all whitespace from the left and right of a string.
  • strip_html - Strips all HTML tags from a string.
  • strip_newlines - Strips all newline characters (line breaks) from a string.
  • toInt - Converts a value to Int
  • toFloat - Converts a value to Float
  • toString - Converts a value to String
  • upcase - Converts a string to all uppercase characters.
  • url_decode - Decodes a string to URL-safe format by converting percent-encoded characters to special characters.
  • url_encode - Encodes a string to URL-safe format by converting special characters to percent-encoded characters.