is-expression

WebJar for is-expression

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

is-expression
Last Version

Last Version

3.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

is-expression
WebJar for is-expression
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/pugjs/is-expression

Download is-expression

How to add to project

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

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : acorn jar [4.0.2,4.1)
org.webjars.npm : object-assign jar [4.0.1,5)

Project Modules

There are no modules declared in this project.

is-expression

Validates a string as a JavaScript expression

Build Status Dependency Status Rolling Versions npm version

Installation

npm install is-expression

Usage

isExpression(src[, options])

Validates a string as a JavaScript expression.

src contains the source.

options can contain any Acorn options (since we use Acorn under-the-hood), or any of the following:

  • throw: Throw an error if the string is not an expression. The error can be an Acorn error, with location information in err.loc and err.pos. Defaults to false.
  • strict: Use strict mode when trying to parse the string. Defaults to false. Even if this option is false, if you have provided options.sourceType === 'module' which imples strict mode under ES2015, strict mode will be used.
  • lineComment: When true, allows line comments in the expression. Defaults to false for safety.

See the examples below for usage.

Examples

var isExpression = require('is-expression')

isExpression('myVar')
//=> true
isExpression('var')
//=> false
isExpression('["an", "array", "\'s"].indexOf("index")')
//=> true

isExpression('var', {throw: true})
// SyntaxError: Unexpected token (1:0)
//     at Parser.pp.raise (acorn/dist/acorn.js:940:13)
//     at ...

isExpression('public')
//=> true
isExpression('public', {strict: true})
//=> false

isExpression('abc // my comment')
//=> false
isExpression('abc // my comment', {lineComment: true})
//=> true

License

MIT

org.webjars.npm

Pug

Versions

Version
3.0.0