@ultraq/string-utils

A collection of utilities for JavaScript strings

Stats

StarsIssuesVersionUpdatedCreatedSize
@ultraq/string-utils
002.1.0a year ago4 years agoMinified + gzip package size for @ultraq/string-utils in KB

Readme

string-utils

Build Status Coverage Status npm Bundlephobia minified size

A collection of utilities for JavaScript strings.

Installation

Via npm:

npm install @ultraq/string-utils

API

escapeHtml(string)

Escapes special HTML characters in a string with their entity code equivalents. Returns a string safe to use as text within an HTML document.

  • string: string to escape.

format(template, ...values)

Returns the replacement of each placeholder in a template string with a corresponding replacement value.

  • template: template string containing placeholders in the format or {n} where n is the corresponding index value to have filled-in.
  • ...values: argument list of values to fill in the placeholders in the template string with.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.