Hypertext Tongue

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

Generated using TypeDoc