Initial commit
This commit is contained in:
48
node_modules/is-expression/CHANGELOG.md
generated
vendored
Normal file
48
node_modules/is-expression/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
# Change Log
|
||||
|
||||
Version 4.0.0 onwards are documented in [Releases](https://github.com/pugjs/is-expression/releases).
|
||||
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 3.0.0 - 2016-09-11
|
||||
### Added
|
||||
- Updated to acorn ~4.0.0
|
||||
- ES2016 has been made the default `ecmaVersion`.
|
||||
- Async functions are now implemented for `{ecmaVersion: 8}`.
|
||||
- See [acorn's CHANGELOG][acorn-4.0.0] for a full list of changes.
|
||||
|
||||
## 2.1.0 - 2016-07-27
|
||||
### Added
|
||||
- Updated to acorn ~3.3.0
|
||||
- The ES2016 check for strict mode in function parameters is now implemented
|
||||
for `{ecmaVersion: 7}`.
|
||||
- See [acorn's CHANGELOG][acorn-3.3.0] for a full list of changes.
|
||||
|
||||
## 2.0.1 - 2016-06-04
|
||||
### Added
|
||||
- Updated to acorn ~3.1.0
|
||||
- See [acorn's CHANGELOG][acorn-3.1.0] for a list of changes.
|
||||
- Even though it is a minor version bump for acorn, the new features are not
|
||||
in parts of acorn we are using, and thus a patch level bump is warranted.
|
||||
|
||||
## 2.0.0 - 2016-02-12
|
||||
### Added
|
||||
- Updated to acorn ~3.0.2
|
||||
- See [acorn's CHANGELOG][acorn-3.0.0] for a list of breaking changes.
|
||||
|
||||
## 1.0.2 - 2016-01-06
|
||||
### Added
|
||||
- Updated to acorn ~2.7.0
|
||||
|
||||
## 1.0.1 - 2015-11-12
|
||||
### Fixed
|
||||
- Use a stricter version range for Acorn since we depend on Acorn internals.
|
||||
|
||||
## 1.0.0 - 2015-11-11
|
||||
### Added
|
||||
- Initial release
|
||||
|
||||
[acorn-4.0.0]: https://github.com/ternjs/acorn/blob/master/CHANGELOG.md#400-2016-08-07
|
||||
[acorn-3.3.0]: https://github.com/ternjs/acorn/blob/master/CHANGELOG.md#330-2016-07-25
|
||||
[acorn-3.1.0]: https://github.com/ternjs/acorn/blob/master/CHANGELOG.md#310-2016-04-18
|
||||
[acorn-3.0.0]: https://github.com/ternjs/acorn/blob/master/CHANGELOG.md#300-2016-02-10
|
19
node_modules/is-expression/LICENSE.md
generated
vendored
Normal file
19
node_modules/is-expression/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2015 Tiancheng “Timothy” Gu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
67
node_modules/is-expression/README.md
generated
vendored
Normal file
67
node_modules/is-expression/README.md
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
# is-expression
|
||||
|
||||
Validates a string as a JavaScript expression
|
||||
|
||||
[](https://travis-ci.org/pugjs/is-expression)
|
||||
[](https://david-dm.org/pugjs/is-expression)
|
||||
[](https://rollingversions.com/pugjs/is-expression)
|
||||
[](https://www.npmjs.org/package/is-expression)
|
||||
|
||||
## 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
|
||||
|
||||
```js
|
||||
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
|
45
node_modules/is-expression/index.js
generated
vendored
Normal file
45
node_modules/is-expression/index.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
var acorn = require('acorn');
|
||||
var objectAssign = require('object-assign');
|
||||
|
||||
module.exports = isExpression;
|
||||
|
||||
var DEFAULT_OPTIONS = {
|
||||
throw: false,
|
||||
strict: false,
|
||||
lineComment: false
|
||||
};
|
||||
|
||||
function isExpression(src, options) {
|
||||
options = objectAssign({}, DEFAULT_OPTIONS, options);
|
||||
|
||||
try {
|
||||
var parser = new acorn.Parser(options, src, 0);
|
||||
|
||||
if (options.strict) {
|
||||
parser.strict = true;
|
||||
}
|
||||
|
||||
if (!options.lineComment) {
|
||||
parser.skipLineComment = function (startSkip) {
|
||||
this.raise(this.pos, 'Line comments not allowed in an expression');
|
||||
};
|
||||
}
|
||||
|
||||
parser.nextToken();
|
||||
parser.parseExpression();
|
||||
|
||||
if (parser.type !== acorn.tokTypes.eof) {
|
||||
parser.unexpected();
|
||||
}
|
||||
} catch (ex) {
|
||||
if (!options.throw) {
|
||||
return false;
|
||||
}
|
||||
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
30
node_modules/is-expression/package.json
generated
vendored
Normal file
30
node_modules/is-expression/package.json
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "is-expression",
|
||||
"version": "4.0.0",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"description": "Check if a string is a valid JavaScript expression",
|
||||
"keywords": [
|
||||
"javascript",
|
||||
"expression"
|
||||
],
|
||||
"dependencies": {
|
||||
"acorn": "^7.1.1",
|
||||
"object-assign": "^4.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nyc": "^15.0.1",
|
||||
"testit": "^3.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test && npm run coverage",
|
||||
"coverage": "nyc node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pugjs/is-expression.git"
|
||||
},
|
||||
"author": "Timothy Gu <timothygu99@gmail.com>",
|
||||
"license": "MIT"
|
||||
}
|
Reference in New Issue
Block a user