highlight-es

WebJar for highlight-es

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

highlight-es
Last Version

Last Version

1.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

highlight-es
WebJar for highlight-es
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/inikulin/highlight-es

Download highlight-es

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/highlight-es/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>highlight-es</artifactId>
    <version>1.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/highlight-es/
implementation 'org.webjars.npm:highlight-es:1.0.3'
// https://jarcasting.com/artifacts/org.webjars.npm/highlight-es/
implementation ("org.webjars.npm:highlight-es:1.0.3")
'org.webjars.npm:highlight-es:jar:1.0.3'
<dependency org="org.webjars.npm" name="highlight-es" rev="1.0.3">
  <artifact name="highlight-es" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='highlight-es', version='1.0.3')
)
libraryDependencies += "org.webjars.npm" % "highlight-es" % "1.0.3"
[org.webjars.npm/highlight-es "1.0.3"]

Dependencies

compile (3)

Group / Artifact Type Version
org.webjars.npm : chalk jar [2.4.0,3)
org.webjars.npm : is-es2016-keyword jar [1.0.0,2)
org.webjars.npm : js-tokens jar [3.0.0,4)

Project Modules

There are no modules declared in this project.

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 => ...
});

Related

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

Author

Ivan Nikulin ([email protected])

Versions

Version
1.0.3