syntax-error

WebJar for syntax-error

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

syntax-error
Последняя версия

Последняя версия

1.4.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

syntax-error
WebJar for syntax-error
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/browserify/syntax-error

Скачать syntax-error

Как подключить последнюю версию

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

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : acorn-node jar [1.2.0,2)

Модули Проекта

Данный проект не имеет модулей.

syntax-error

Detect and report syntax errors in source code strings.

build status

When you type node src.js you get a friendly error report about exactly where the syntax error is. This module lets you check for syntax errors and report them in a similarly friendly format that wrapping a try/catch around Function() or vm.runInNewContext() doesn't get you.

example

var fs = require('fs');
var check = require('syntax-error');

var file = __dirname + '/src.js';
var src = fs.readFileSync(file);

var err = check(src, file);
if (err) {
    console.error('ERROR DETECTED' + Array(62).join('!'));
    console.error(err);
    console.error(Array(76).join('-'));
}

$ node check.js
ERROR DETECTED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

/home/substack/projects/node-syntax-error/example/src.js:5
        if (Array.isArray(x) res.push.apply(res, x);
                             ^
ParseError: Unexpected identifier
---------------------------------------------------------------------------

methods

var check = require('syntax-error')

var err = check(src, file, opts={})

Check the source code string src for syntax errors. Optionally you can specify a filename file that will show up in the output.

If src has a syntax error, return an error object err that can be printed or stringified.

If there are no syntax errors in src, return undefined.

Options will be passed through to acorn-node. acorn-node defaults to options that match the most recent Node versions.

err.toString()

Return the long string description with a source snippet and a ^ under pointing exactly where the error was detected.

attributes

err.message

short string description of the error type

err.line

line number of the error in the original source (indexing starts at 1)

err.column

column number of the error in the original source (indexing starts at 1)

install

With npm do:

npm install syntax-error

license

MIT

org.webjars.npm

Версии библиотеки

Версия
1.4.0
1.1.4