hatsyjs / httongue

Hypertext tongue

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Hypertext tongue

License:MIT License


Languages

Language:TypeScript 96.8%Language:JavaScript 3.2%