JSPM

highlight-es

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 634308
  • Score
    100M100P100Q170151F
  • License MIT

Highlight ECMAScript syntax for the console or any other medium.

Package Exports

  • highlight-es

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 (highlight-es) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

highlight-es

Build Status

Highlight ECMAScript syntax for the console or any other medium.

Install

npm install highlight-es

Usage

const highlight = require('highlight-es');

function testFunc () {
    const re    = /(.+) awesome$/;
    const match = 'You are awesome'.match(re);

    return match[1];
}

const code = testFunc.toString();

console.log('\n' + highlight(code));

example

You can pass custom renderer to target other medium, e.g.:

highlight(code, {
    string:     str => ...,
    punctuator: str => ...,
    keyword:    str => ...,
    number:     str => ...,
    regex:      str => ...,
    comment:    str => ...,
    invalid:    str => ...
});

is-es2016-keyword - Determine if string is an ES2016 keyword.

Author

Ivan Nikulin (ifaaan@gmail.com)