Skip to content

rubix-code/string-format

Repository files navigation

String-Format

semantic-release: eslint codecov npm version License: MIT

A Highly functional and extensible string formatting library for JS.

Inspiration

This repo is inspired by the following libraries:

All of this libraries are great in their own way. But installing them individually can be tedious. Also, they are not extensible, and have not been maintained for quite some time.

This library aims to provide a single library that can be used to format strings in a variety of ways. It also aims to be extensible, so that you can add your own custom formatters.

Installation

npm install @rubix-code/string-format

Usage

Basic Usage

// Globally apply the default formatters
import "@rubix-code/string-format/register";

// Python style formatting
"My name is {name}".format({ name: "Slim Shady" }); // My name is Slim Shady

// C++ style formatting
"The answer to life, the universe and everything is %d".format(42); // The answer to life, the universe and everything is 42

TODO:

  • Fix CI/CD pipeline
  • Add complete documentation

About

An extensible string formatter for Node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published