httongue
TypeScript icon, indicating that this package has built-in type declarations

3.1.0 • Public • Published

Hypertext Tongue

NPM Build Status Code Quality Coverage GitHub Project API Documentation

Hypertext and other web-related codecs.

HTML and XML

CSS

JavaScript

  • escapeJsString(string): string - Escapes a string to be included into JavaScript string literal.

    Handles all kinds of quotes (', ", and ```) and special chars. Converts non-ASCII chars to corresponding Unicode escapes.

  • jsPropertyAccessor(string, quote?): string - Creates JavaScript property accessor expression.

    If accessed property key is valid JavaScript identifier, then creates a .${key} accessor. Otherwise, creates an accessor like ['${key}'] with key properly quoted.

  • jsStringLiteral(string, quote?): string - Creates JavaScript string literal.

    Encloses the string into quotes and properly escapes it.

  • quoteJsKey(string, quote?): string - Conditionally quotes JavaScript key.

    If the given key is valid JavaScript identifier, then leaves it as is. Otherwise, encloses it into quotes and properly escapes if necessary.

URI

Other

Package Sidebar

Install

npm i httongue

Weekly Downloads

10

Version

3.1.0

License

MIT

Unpacked Size

41.1 kB

Total Files

7

Last publish

Collaborators

  • lorus