JSPM

@ultraq/string-utils

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2148
  • Score
    100M100P100Q122841F
  • License Apache-2.0

A collection of utilities for JavaScript strings

Package Exports

  • @ultraq/string-utils

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ultraq/string-utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

string-utils

Build Status Coverage Status npm

A collection of utilities for JavaScript strings.

Installation

Via npm:

npm install @ultraq/string-utils --save

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.