initial
This commit is contained in:
14
node_modules/is-expression/.npmignore
generated
vendored
Normal file
14
node_modules/is-expression/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
pids
|
||||
logs
|
||||
results
|
||||
npm-debug.log
|
||||
node_modules
|
||||
coverage
|
||||
17
node_modules/is-expression/.travis.yml
generated
vendored
Normal file
17
node_modules/is-expression/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
language: node_js
|
||||
sudo: false
|
||||
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
- "4"
|
||||
- "5"
|
||||
|
||||
after_success:
|
||||
- npm run coverage
|
||||
- npm i coveralls
|
||||
- cat ./coverage/lcov.info | coveralls
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
38
node_modules/is-expression/CHANGELOG.md
generated
vendored
Normal file
38
node_modules/is-expression/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# Change Log
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 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-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.
|
||||
66
node_modules/is-expression/README.md
generated
vendored
Normal file
66
node_modules/is-expression/README.md
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
# is-expression
|
||||
|
||||
Validates a string as a JavaScript expression
|
||||
|
||||
[](https://travis-ci.org/pugjs/is-expression)
|
||||
[](https://david-dm.org/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;
|
||||
}
|
||||
90
node_modules/is-expression/package.json
generated
vendored
Normal file
90
node_modules/is-expression/package.json
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"is-expression@^2.0.1",
|
||||
"C:\\Users\\Tom\\Documents\\Development\\bitsy-image-to-room\\node_modules\\constantinople"
|
||||
]
|
||||
],
|
||||
"_from": "is-expression@>=2.0.1 <3.0.0",
|
||||
"_id": "is-expression@2.1.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/is-expression",
|
||||
"_nodeVersion": "6.2.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/is-expression-2.1.0.tgz_1469558631250_0.5454726330935955"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "timothygu99@gmail.com",
|
||||
"name": "timothygu"
|
||||
},
|
||||
"_npmVersion": "3.9.6",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "is-expression",
|
||||
"raw": "is-expression@^2.0.1",
|
||||
"rawSpec": "^2.0.1",
|
||||
"scope": null,
|
||||
"spec": ">=2.0.1 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/constantinople"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/is-expression/-/is-expression-2.1.0.tgz",
|
||||
"_shasum": "91be9d47debcfef077977e9722be6dcfb4465ef0",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "is-expression@^2.0.1",
|
||||
"_where": "C:\\Users\\Tom\\Documents\\Development\\bitsy-image-to-room\\node_modules\\constantinople",
|
||||
"author": {
|
||||
"email": "timothygu99@gmail.com",
|
||||
"name": "Timothy Gu"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/pugjs/is-expression/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": "~3.3.0",
|
||||
"object-assign": "^4.0.1"
|
||||
},
|
||||
"description": "Check if a string is a valid JavaScript expression",
|
||||
"devDependencies": {
|
||||
"istanbul": "*",
|
||||
"testit": "^2.0.2"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "91be9d47debcfef077977e9722be6dcfb4465ef0",
|
||||
"tarball": "https://registry.npmjs.org/is-expression/-/is-expression-2.1.0.tgz"
|
||||
},
|
||||
"gitHead": "28810ef58c4993deb7700ecb4e577401b2b1444c",
|
||||
"homepage": "https://github.com/pugjs/is-expression#readme",
|
||||
"keywords": [
|
||||
"expression",
|
||||
"javascript"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "forbeslindesay",
|
||||
"email": "forbes@lindesay.co.uk"
|
||||
},
|
||||
{
|
||||
"name": "timothygu",
|
||||
"email": "timothygu99@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "is-expression",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/pugjs/is-expression.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "istanbul cover test.js",
|
||||
"test": "node test && npm run coverage"
|
||||
},
|
||||
"version": "2.1.0"
|
||||
}
|
||||
48
node_modules/is-expression/test.js
generated
vendored
Normal file
48
node_modules/is-expression/test.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var testit = require('testit');
|
||||
var isExpression = require('./');
|
||||
|
||||
function passes(src, options) {
|
||||
testit(JSON.stringify(src, options), function () {
|
||||
options = options || {};
|
||||
assert(isExpression(src, options));
|
||||
});
|
||||
}
|
||||
|
||||
testit('passes', function () {
|
||||
passes('myVar');
|
||||
passes('["an", "array", "\'s"].indexOf("index")');
|
||||
passes('\npublic');
|
||||
passes('abc // my comment', {lineComment: true});
|
||||
passes('() => a');
|
||||
passes('function (a = "default") {"use strict";}');
|
||||
});
|
||||
|
||||
function error(src, line, col, options) {
|
||||
testit(JSON.stringify(src), function () {
|
||||
options = options || {};
|
||||
assert(!isExpression(src, options));
|
||||
options.throw = true;
|
||||
assert.throws(function () {
|
||||
isExpression(src, options);
|
||||
}, function (err) {
|
||||
assert.equal(err.loc.line, line);
|
||||
assert.equal(err.loc.column, col);
|
||||
assert(err.message);
|
||||
return true;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
testit('fails', function () {
|
||||
error('', 1, 0);
|
||||
error('var', 1, 0);
|
||||
error('weird error', 1, 6);
|
||||
error('asdf}', 1, 4);
|
||||
error('\npublic', 2, 0, {strict: true});
|
||||
error('abc // my comment', 1, 4);
|
||||
error('() => a', 1, 1, {ecmaVersion: 5});
|
||||
error('function (a = "default") {"use strict";}', 1, 26, {ecmaVersion: 7});
|
||||
});
|
||||
Reference in New Issue
Block a user