first
This commit is contained in:
21
node_modules/regjsparser/LICENSE.BSD
generated
vendored
Normal file
21
node_modules/regjsparser/LICENSE.BSD
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
Copyright (c) Julian Viereck and Contributors, All Rights Reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
47
node_modules/regjsparser/README.md
generated
vendored
Normal file
47
node_modules/regjsparser/README.md
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
# RegJSParser
|
||||
|
||||
Parsing the JavaScript's RegExp in JavaScript.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install regjsparser
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var parse = require('regjsparser').parse;
|
||||
|
||||
var parseTree = parse('^a'); // /^a/
|
||||
console.log(parseTree);
|
||||
|
||||
// Toggle on/off additional features:
|
||||
var parseTree = parse('^a', '', {
|
||||
// SEE: https://github.com/jviereck/regjsparser/pull/78
|
||||
unicodePropertyEscape: true,
|
||||
|
||||
// SEE: https://github.com/jviereck/regjsparser/pull/83
|
||||
namedGroups: true,
|
||||
|
||||
// SEE: https://github.com/jviereck/regjsparser/pull/89
|
||||
lookbehind: true
|
||||
});
|
||||
console.log(parseTree);
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
To run the tests, run the following command:
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
To create a new reference file, execute…
|
||||
|
||||
```bash
|
||||
node test/update-fixtures.js
|
||||
```
|
||||
|
||||
…from the repo top directory.
|
63
node_modules/regjsparser/bin/parser
generated
vendored
Normal file
63
node_modules/regjsparser/bin/parser
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env node
|
||||
(function() {
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var parse = require('../parser').parse;
|
||||
var jsesc = require('jsesc');
|
||||
var regexes = process.argv.splice(2);
|
||||
var first = regexes[0];
|
||||
var data;
|
||||
var log = console.log;
|
||||
var flags = '';
|
||||
var main = function() {
|
||||
if (/^(?:-h|--help|undefined)$/.test(first)) {
|
||||
log([
|
||||
'\nUsage:\n',
|
||||
'\tregjsparser [regex ...]',
|
||||
'\tregjsparser [-f | --flags] u [regex ...]',
|
||||
'\tregjsparser [-v | --version]',
|
||||
'\tregjsparser [-h | --help]',
|
||||
'\nExamples:\n',
|
||||
'\tregjsparser \'^foo.bar$\'',
|
||||
'\tregjsparser \'[a-zA-Z0-9]\''
|
||||
].join('\n'));
|
||||
return process.exit(1);
|
||||
}
|
||||
|
||||
if (/^(?:-v|--version)$/.test(first)) {
|
||||
log('v%s', require(path.resolve(__dirname, '../package.json')).version);
|
||||
return process.exit(1);
|
||||
}
|
||||
|
||||
if (/^(?:-f|--flags)$/.test(first)) {
|
||||
flags = regexes[1];
|
||||
regexes = regexes.slice(2);
|
||||
}
|
||||
|
||||
regexes.forEach(function(snippet) {
|
||||
try {
|
||||
result = parse(snippet, flags);
|
||||
log(jsesc(result, {
|
||||
'json': true,
|
||||
'compact': false,
|
||||
'indent': '\t'
|
||||
}));
|
||||
} catch(error) {
|
||||
log(error.message + '\n');
|
||||
log('Error: failed to parse. Make sure the regular expression is valid.');
|
||||
log('If you think this is a bug in regjsparser, please report it:');
|
||||
log('\thttps://github.com/jviereck/regjsparser/issues/new');
|
||||
log('\nStack trace:\n');
|
||||
log(error.stack);
|
||||
return process.exit(1);
|
||||
}
|
||||
});
|
||||
// Return with exit status 0 outside of the `forEach` loop, in case
|
||||
// multiple regular expressions were passed in.
|
||||
return process.exit(0);
|
||||
};
|
||||
|
||||
main();
|
||||
|
||||
}());
|
15
node_modules/regjsparser/node_modules/.bin/jsesc
generated
vendored
Normal file
15
node_modules/regjsparser/node_modules/.bin/jsesc
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../jsesc/bin/jsesc" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../jsesc/bin/jsesc" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
17
node_modules/regjsparser/node_modules/.bin/jsesc.cmd
generated
vendored
Normal file
17
node_modules/regjsparser/node_modules/.bin/jsesc.cmd
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\jsesc\bin\jsesc" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/regjsparser/node_modules/.bin/jsesc.ps1
generated
vendored
Normal file
18
node_modules/regjsparser/node_modules/.bin/jsesc.ps1
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../jsesc/bin/jsesc" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../jsesc/bin/jsesc" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
20
node_modules/regjsparser/node_modules/jsesc/LICENSE-MIT.txt
generated
vendored
Normal file
20
node_modules/regjsparser/node_modules/jsesc/LICENSE-MIT.txt
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright Mathias Bynens <http://mathiasbynens.be/>
|
||||
|
||||
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.
|
375
node_modules/regjsparser/node_modules/jsesc/README.md
generated
vendored
Normal file
375
node_modules/regjsparser/node_modules/jsesc/README.md
generated
vendored
Normal file
@ -0,0 +1,375 @@
|
||||
# jsesc [](https://travis-ci.org/mathiasbynens/jsesc) [](https://coveralls.io/r/mathiasbynens/jsesc) [](https://gemnasium.com/mathiasbynens/jsesc)
|
||||
|
||||
This is a JavaScript library for [escaping JavaScript strings](http://mathiasbynens.be/notes/javascript-escapes) while generating the shortest possible valid ASCII-only output. [Here’s an online demo.](http://mothereff.in/js-escapes)
|
||||
|
||||
This can be used to avoid [mojibake](http://en.wikipedia.org/wiki/Mojibake) and other encoding issues, or even to [avoid errors](https://twitter.com/annevk/status/380000829643571200) when passing JSON-formatted data (which may contain U+2028 LINE SEPARATOR, U+2029 PARAGRAPH SEPARATOR, or [lone surrogates](http://esdiscuss.org/topic/code-points-vs-unicode-scalar-values#content-14)) to a JavaScript parser or an UTF-8 encoder, respectively.
|
||||
|
||||
Feel free to fork if you see possible improvements!
|
||||
|
||||
## Installation
|
||||
|
||||
Via [Bower](http://bower.io/):
|
||||
|
||||
```bash
|
||||
bower install jsesc
|
||||
```
|
||||
|
||||
Via [Component](https://github.com/component/component):
|
||||
|
||||
```bash
|
||||
component install mathiasbynens/jsesc
|
||||
```
|
||||
|
||||
Via [npm](http://npmjs.org/):
|
||||
|
||||
```bash
|
||||
npm install jsesc
|
||||
```
|
||||
|
||||
In a browser:
|
||||
|
||||
```html
|
||||
<script src="jsesc.js"></script>
|
||||
```
|
||||
|
||||
In [Node.js](http://nodejs.org/) and [RingoJS](http://ringojs.org/):
|
||||
|
||||
```js
|
||||
var jsesc = require('jsesc');
|
||||
```
|
||||
|
||||
In [Narwhal](http://narwhaljs.org/):
|
||||
|
||||
```js
|
||||
var jsesc = require('jsesc').jsesc;
|
||||
```
|
||||
|
||||
In [Rhino](http://www.mozilla.org/rhino/):
|
||||
|
||||
```js
|
||||
load('jsesc.js');
|
||||
```
|
||||
|
||||
Using an AMD loader like [RequireJS](http://requirejs.org/):
|
||||
|
||||
```js
|
||||
require(
|
||||
{
|
||||
'paths': {
|
||||
'jsesc': 'path/to/jsesc'
|
||||
}
|
||||
},
|
||||
['jsesc'],
|
||||
function(jsesc) {
|
||||
console.log(jsesc);
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `jsesc(value, options)`
|
||||
|
||||
This function takes a value and returns an escaped version of the value where any characters that are not printable ASCII symbols are escaped using the shortest possible (but valid) [escape sequences for use in JavaScript strings](http://mathiasbynens.be/notes/javascript-escapes). The first supported value type is strings:
|
||||
|
||||
```js
|
||||
jsesc('Ich ♥ Bücher');
|
||||
// → 'Ich \\u2665 B\\xFCcher'
|
||||
|
||||
jsesc('foo 𝌆 bar');
|
||||
// → 'foo \\uD834\\uDF06 bar'
|
||||
```
|
||||
|
||||
Instead of a string, the `value` can also be an array, or an object. In such cases, `jsesc` will return a stringified version of the value where any characters that are not printable ASCII symbols are escaped in the same way.
|
||||
|
||||
```js
|
||||
// Escaping an array
|
||||
jsesc([
|
||||
'Ich ♥ Bücher', 'foo 𝌆 bar'
|
||||
]);
|
||||
// → '[\'Ich \\u2665 B\\xFCcher\',\'foo \\uD834\\uDF06 bar\']'
|
||||
|
||||
// Escaping an object
|
||||
jsesc({
|
||||
'Ich ♥ Bücher': 'foo 𝌆 bar'
|
||||
});
|
||||
// → '{\'Ich \\u2665 B\\xFCcher\':\'foo \\uD834\\uDF06 bar\'}'
|
||||
```
|
||||
|
||||
The optional `options` argument accepts an object with the following options:
|
||||
|
||||
#### `quotes`
|
||||
|
||||
The default value for the `quotes` option is `'single'`. This means that any occurences of `'` in the input string will be escaped as `\'`, so that the output can be used in a string literal wrapped in single quotes.
|
||||
|
||||
```js
|
||||
jsesc('Lorem ipsum "dolor" sit \'amet\' etc.');
|
||||
// → 'Lorem ipsum "dolor" sit \\\'amet\\\' etc.'
|
||||
|
||||
jsesc('Lorem ipsum "dolor" sit \'amet\' etc.', {
|
||||
'quotes': 'single'
|
||||
});
|
||||
// → 'Lorem ipsum "dolor" sit \\\'amet\\\' etc.'
|
||||
// → "Lorem ipsum \"dolor\" sit \\'amet\\' etc."
|
||||
```
|
||||
|
||||
If you want to use the output as part of a string literal wrapped in double quotes, set the `quotes` option to `'double'`.
|
||||
|
||||
```js
|
||||
jsesc('Lorem ipsum "dolor" sit \'amet\' etc.', {
|
||||
'quotes': 'double'
|
||||
});
|
||||
// → 'Lorem ipsum \\"dolor\\" sit \'amet\' etc.'
|
||||
// → "Lorem ipsum \\\"dolor\\\" sit 'amet' etc."
|
||||
```
|
||||
|
||||
This setting also affects the output for arrays and objects:
|
||||
|
||||
```js
|
||||
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
|
||||
'quotes': 'double'
|
||||
});
|
||||
// → '{"Ich \\u2665 B\\xFCcher":"foo \\uD834\\uDF06 bar"}'
|
||||
|
||||
jsesc([ 'Ich ♥ Bücher', 'foo 𝌆 bar' ], {
|
||||
'quotes': 'double'
|
||||
});
|
||||
// → '["Ich \\u2665 B\\xFCcher","foo \\uD834\\uDF06 bar"]'
|
||||
```
|
||||
|
||||
#### `wrap`
|
||||
|
||||
The `wrap` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, the output will be a valid JavaScript string literal wrapped in quotes. The type of quotes can be specified through the `quotes` setting.
|
||||
|
||||
```js
|
||||
jsesc('Lorem ipsum "dolor" sit \'amet\' etc.', {
|
||||
'quotes': 'single',
|
||||
'wrap': true
|
||||
});
|
||||
// → '\'Lorem ipsum "dolor" sit \\\'amet\\\' etc.\''
|
||||
// → "\'Lorem ipsum \"dolor\" sit \\\'amet\\\' etc.\'"
|
||||
|
||||
jsesc('Lorem ipsum "dolor" sit \'amet\' etc.', {
|
||||
'quotes': 'double',
|
||||
'wrap': true
|
||||
});
|
||||
// → '"Lorem ipsum \\"dolor\\" sit \'amet\' etc."'
|
||||
// → "\"Lorem ipsum \\\"dolor\\\" sit \'amet\' etc.\""
|
||||
```
|
||||
|
||||
#### `es6`
|
||||
|
||||
The `es6` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, any astral Unicode symbols in the input will be escaped using [ECMAScript 6 Unicode code point escape sequences](http://mathiasbynens.be/notes/javascript-escapes#unicode-code-point) instead of using separate escape sequences for each surrogate half. If backwards compatibility with ES5 environments is a concern, don’t enable this setting. If the `json` setting is enabled, the value for the `es6` setting is ignored (as if it was `false`).
|
||||
|
||||
```js
|
||||
// By default, the `es6` option is disabled:
|
||||
jsesc('foo 𝌆 bar 💩 baz');
|
||||
// → 'foo \\uD834\\uDF06 bar \\uD83D\\uDCA9 baz'
|
||||
|
||||
// To explicitly disable it:
|
||||
jsesc('foo 𝌆 bar 💩 baz', {
|
||||
'es6': false
|
||||
});
|
||||
// → 'foo \\uD834\\uDF06 bar \\uD83D\\uDCA9 baz'
|
||||
|
||||
// To enable it:
|
||||
jsesc('foo 𝌆 bar 💩 baz', {
|
||||
'es6': true
|
||||
});
|
||||
// → 'foo \\u{1D306} bar \\u{1F4A9} baz'
|
||||
```
|
||||
|
||||
#### `escapeEverything`
|
||||
|
||||
The `escapeEverything` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, all the symbols in the output will be escaped, even printable ASCII symbols.
|
||||
|
||||
```js
|
||||
jsesc('lolwat"foo\'bar', {
|
||||
'escapeEverything': true
|
||||
});
|
||||
// → '\\x6C\\x6F\\x6C\\x77\\x61\\x74\\"\\x66\\x6F\\x6F\\\'\\x62\\x61\\x72'
|
||||
// → "\\x6C\\x6F\\x6C\\x77\\x61\\x74\\\"\\x66\\x6F\\x6F\\'\\x62\\x61\\x72"
|
||||
```
|
||||
|
||||
This setting also affects the output for arrays and objects:
|
||||
|
||||
```js
|
||||
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
|
||||
'escapeEverything': true
|
||||
});
|
||||
// → '{\'\x49\x63\x68\x20\u2665\x20\x42\xFC\x63\x68\x65\x72\':\'\x66\x6F\x6F\x20\uD834\uDF06\x20\x62\x61\x72\'}'
|
||||
// → "{'\x49\x63\x68\x20\u2665\x20\x42\xFC\x63\x68\x65\x72':'\x66\x6F\x6F\x20\uD834\uDF06\x20\x62\x61\x72'}"
|
||||
|
||||
jsesc([ 'Ich ♥ Bücher': 'foo 𝌆 bar' ], {
|
||||
'escapeEverything': true
|
||||
});
|
||||
// → '[\'\x49\x63\x68\x20\u2665\x20\x42\xFC\x63\x68\x65\x72\',\'\x66\x6F\x6F\x20\uD834\uDF06\x20\x62\x61\x72\']'
|
||||
```
|
||||
|
||||
#### `compact`
|
||||
|
||||
The `compact` option takes a boolean value (`true` or `false`), and defaults to `true` (enabled). When enabled, the output for arrays and objects will be as compact as possible; it won’t be formatted nicely.
|
||||
|
||||
```js
|
||||
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
|
||||
'compact': true // this is the default
|
||||
});
|
||||
// → '{\'Ich \u2665 B\xFCcher\':\'foo \uD834\uDF06 bar\'}'
|
||||
|
||||
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
|
||||
'compact': false
|
||||
});
|
||||
// → '{\n\t\'Ich \u2665 B\xFCcher\': \'foo \uD834\uDF06 bar\'\n}'
|
||||
|
||||
jsesc([ 'Ich ♥ Bücher', 'foo 𝌆 bar' ], {
|
||||
'compact': false
|
||||
});
|
||||
// → '[\n\t\'Ich \u2665 B\xFCcher\',\n\t\'foo \uD834\uDF06 bar\'\n]'
|
||||
```
|
||||
|
||||
This setting has no effect on the output for strings.
|
||||
|
||||
#### `indent`
|
||||
|
||||
The `indent` option takes a string value, and defaults to `'\t'`. When the `compact` setting is enabled (`true`), the value of the `indent` option is used to format the output for arrays and objects.
|
||||
|
||||
```js
|
||||
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
|
||||
'compact': false,
|
||||
'indent': '\t' // this is the default
|
||||
});
|
||||
// → '{\n\t\'Ich \u2665 B\xFCcher\': \'foo \uD834\uDF06 bar\'\n}'
|
||||
|
||||
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
|
||||
'compact': false,
|
||||
'indent': ' '
|
||||
});
|
||||
// → '{\n \'Ich \u2665 B\xFCcher\': \'foo \uD834\uDF06 bar\'\n}'
|
||||
|
||||
jsesc([ 'Ich ♥ Bücher', 'foo 𝌆 bar' ], {
|
||||
'compact': false,
|
||||
'indent': ' '
|
||||
});
|
||||
// → '[\n \'Ich \u2665 B\xFCcher\',\n\ t\'foo \uD834\uDF06 bar\'\n]'
|
||||
```
|
||||
|
||||
This setting has no effect on the output for strings.
|
||||
|
||||
#### `json`
|
||||
|
||||
The `json` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, the output is valid JSON. [Hexadecimal character escape sequences](http://mathiasbynens.be/notes/javascript-escapes#hexadecimal) and [the `\v` or `\0` escape sequences](http://mathiasbynens.be/notes/javascript-escapes#single) will not be used. Setting `json: true` implies `quotes: 'double', wrap: true, es6: false`, although these values can still be overridden if needed — but in such cases, the output won’t be valid JSON anymore.
|
||||
|
||||
```js
|
||||
jsesc('foo\x00bar\xFF\uFFFDbaz', {
|
||||
'json': true
|
||||
});
|
||||
// → '"foo\\u0000bar\\u00FF\\uFFFDbaz"'
|
||||
|
||||
jsesc({ 'foo\x00bar\xFF\uFFFDbaz': 'foo\x00bar\xFF\uFFFDbaz' }, {
|
||||
'json': true
|
||||
});
|
||||
// → '{"foo\\u0000bar\\u00FF\\uFFFDbaz":"foo\\u0000bar\\u00FF\\uFFFDbaz"}'
|
||||
|
||||
jsesc([ 'foo\x00bar\xFF\uFFFDbaz', 'foo\x00bar\xFF\uFFFDbaz' ], {
|
||||
'json': true
|
||||
});
|
||||
// → '["foo\\u0000bar\\u00FF\\uFFFDbaz","foo\\u0000bar\\u00FF\\uFFFDbaz"]'
|
||||
|
||||
// Values that are acceptable in JSON but aren’t strings, arrays, or object
|
||||
// literals can’t be escaped, so they’ll just be preserved:
|
||||
jsesc([ 'foo\x00bar', [1, '©', { 'foo': true, 'qux': null }], 42 ], {
|
||||
'json': true
|
||||
});
|
||||
// → '["foo\\u0000bar",[1,"\\u00A9",{"foo":true,"qux":null}],42]'
|
||||
// Values that aren’t allowed in JSON are run through `JSON.stringify()`:
|
||||
jsesc([ undefined, -Infinity ], {
|
||||
'json': true
|
||||
});
|
||||
// → '[null,null]'
|
||||
```
|
||||
|
||||
**Note:** Using this option on objects or arrays that contain non-string values relies on `JSON.stringify()`. For legacy environments like IE ≤ 7, use [a `JSON` polyfill](http://bestiejs.github.io/json3/).
|
||||
|
||||
### `jsesc.version`
|
||||
|
||||
A string representing the semantic version number.
|
||||
|
||||
### Using the `jsesc` binary
|
||||
|
||||
To use the `jsesc` binary in your shell, simply install jsesc globally using npm:
|
||||
|
||||
```bash
|
||||
npm install -g jsesc
|
||||
```
|
||||
|
||||
After that you will be able to escape strings from the command line:
|
||||
|
||||
```bash
|
||||
$ jsesc 'föo ♥ bår 𝌆 baz'
|
||||
f\xF6o \u2665 b\xE5r \uD834\uDF06 baz
|
||||
```
|
||||
|
||||
To escape arrays or objects containing string values, use the `-o`/`--object` option:
|
||||
|
||||
```bash
|
||||
$ jsesc --object '{ "föo": "♥", "bår": "𝌆 baz" }'
|
||||
{'f\xF6o':'\u2665','b\xE5r':'\uD834\uDF06 baz'}
|
||||
```
|
||||
|
||||
To prettify the output in such cases, use the `-p`/`--pretty` option:
|
||||
|
||||
```bash
|
||||
$ jsesc --pretty '{ "föo": "♥", "bår": "𝌆 baz" }'
|
||||
{
|
||||
'f\xF6o': '\u2665',
|
||||
'b\xE5r': '\uD834\uDF06 baz'
|
||||
}
|
||||
```
|
||||
|
||||
For valid JSON output, use the `-j`/`--json` option:
|
||||
|
||||
```bash
|
||||
$ jsesc --json --pretty '{ "föo": "♥", "bår": "𝌆 baz" }'
|
||||
{
|
||||
"f\u00F6o": "\u2665",
|
||||
"b\u00E5r": "\uD834\uDF06 baz"
|
||||
}
|
||||
```
|
||||
|
||||
Read a local JSON file, escape any non-ASCII symbols, and save the result to a new file:
|
||||
|
||||
```bash
|
||||
$ jsesc --json --object < data-raw.json > data-escaped.json
|
||||
```
|
||||
|
||||
Or do the same with an online JSON file:
|
||||
|
||||
```bash
|
||||
$ curl -sL "http://git.io/aorKgQ" | jsesc --json --object > data-escaped.json
|
||||
```
|
||||
|
||||
See `jsesc --help` for the full list of options.
|
||||
|
||||
## Support
|
||||
|
||||
This library has been tested in at least Chrome 27-29, Firefox 3-22, Safari 4-6, Opera 10-12, IE 6-10, Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.9, PhantomJS 1.9.0, and Rhino 1.7RC4.
|
||||
|
||||
**Note:** Using the `json` option on objects or arrays that contain non-string values relies on `JSON.parse()`. For legacy environments like IE ≤ 7, use [a `JSON` polyfill](http://bestiejs.github.io/json3/).
|
||||
|
||||
## Unit tests & code coverage
|
||||
|
||||
After cloning this repository, run `npm install` to install the dependencies needed for development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.
|
||||
|
||||
Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, and web browsers as well, use `grunt test`.
|
||||
|
||||
To generate the code coverage report, use `grunt cover`.
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](http://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
This library is available under the [MIT](http://mths.be/mit) license.
|
138
node_modules/regjsparser/node_modules/jsesc/bin/jsesc
generated
vendored
Normal file
138
node_modules/regjsparser/node_modules/jsesc/bin/jsesc
generated
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
#!/usr/bin/env node
|
||||
(function() {
|
||||
|
||||
var fs = require('fs');
|
||||
var stringEscape = require('../jsesc.js');
|
||||
var strings = process.argv.splice(2);
|
||||
var stdin = process.stdin;
|
||||
var data;
|
||||
var timeout;
|
||||
var isObject = false;
|
||||
var options = {};
|
||||
var log = console.log;
|
||||
|
||||
var main = function() {
|
||||
var option = strings[0];
|
||||
|
||||
if (/^(?:-h|--help|undefined)$/.test(option)) {
|
||||
log(
|
||||
'jsesc v%s - http://mths.be/jsesc',
|
||||
stringEscape.version
|
||||
);
|
||||
log([
|
||||
'\nUsage:\n',
|
||||
'\tjsesc [string]',
|
||||
'\tjsesc [-s | --single-quotes] [string]',
|
||||
'\tjsesc [-d | --double-quotes] [string]',
|
||||
'\tjsesc [-w | --wrap] [string]',
|
||||
'\tjsesc [-e | --escape-everything] [string]',
|
||||
'\tjsesc [-6 | --es6] [string]',
|
||||
'\tjsesc [-j | --json] [string]',
|
||||
'\tjsesc [-o | --object] [stringified_object]', // `JSON.parse()` the argument
|
||||
'\tjsesc [-p | --pretty] [string]', // `compact: false`
|
||||
'\tjsesc [-v | --version]',
|
||||
'\tjsesc [-h | --help]',
|
||||
'\nExamples:\n',
|
||||
'\tjsesc \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
|
||||
'\tjsesc --json \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
|
||||
'\tjsesc --json --escape-everything \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
|
||||
'\tjsesc --double-quotes --wrap \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
|
||||
'\techo \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\' | jsesc'
|
||||
].join('\n'));
|
||||
return process.exit(1);
|
||||
}
|
||||
|
||||
if (/^(?:-v|--version)$/.test(option)) {
|
||||
log('v%s', stringEscape.version);
|
||||
return process.exit(1);
|
||||
}
|
||||
|
||||
strings.forEach(function(string) {
|
||||
// Process options
|
||||
if (/^(?:-s|--single-quotes)$/.test(string)) {
|
||||
options.quotes = 'single';
|
||||
return;
|
||||
}
|
||||
if (/^(?:-d|--double-quotes)$/.test(string)) {
|
||||
options.quotes = 'double';
|
||||
return;
|
||||
}
|
||||
if (/^(?:-w|--wrap)$/.test(string)) {
|
||||
options.wrap = true;
|
||||
return;
|
||||
}
|
||||
if (/^(?:-6|--es6)$/.test(string)) {
|
||||
options.es6 = true;
|
||||
return;
|
||||
}
|
||||
if (/^(?:-e|--escape-everything)$/.test(string)) {
|
||||
options.escapeEverything = true;
|
||||
return;
|
||||
}
|
||||
if (/^(?:-j|--json)$/.test(string)) {
|
||||
options.json = true;
|
||||
return;
|
||||
}
|
||||
if (/^(?:-o|--object)$/.test(string)) {
|
||||
isObject = true;
|
||||
return;
|
||||
}
|
||||
if (/^(?:-p|--pretty)$/.test(string)) {
|
||||
isObject = true;
|
||||
options.compact = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Process string(s)
|
||||
var result;
|
||||
try {
|
||||
if (isObject) {
|
||||
string = JSON.parse(string);
|
||||
}
|
||||
result = stringEscape(string, options);
|
||||
log(result);
|
||||
} catch(error) {
|
||||
log(error.message + '\n');
|
||||
log('Error: failed to escape.');
|
||||
log('If you think this is a bug in jsesc, please report it:');
|
||||
log('https://github.com/mathiasbynens/jsesc/issues/new');
|
||||
log(
|
||||
'\nStack trace using jsesc@%s:\n',
|
||||
stringEscape.version
|
||||
);
|
||||
log(error.stack);
|
||||
return process.exit(1);
|
||||
}
|
||||
});
|
||||
// Return with exit status 0 outside of the `forEach` loop, in case
|
||||
// multiple strings were passed in.
|
||||
return process.exit(0);
|
||||
|
||||
};
|
||||
|
||||
if (stdin.isTTY) {
|
||||
// handle shell arguments
|
||||
main();
|
||||
} else {
|
||||
// Either the script is called from within a non-TTY context,
|
||||
// or `stdin` content is being piped in.
|
||||
if (!process.stdout.isTTY) { // called from a non-TTY context
|
||||
timeout = setTimeout(function() {
|
||||
// if no piped data arrived after a while, handle shell arguments
|
||||
main();
|
||||
}, 250);
|
||||
}
|
||||
|
||||
data = '';
|
||||
stdin.on('data', function(chunk) {
|
||||
clearTimeout(timeout);
|
||||
data += chunk;
|
||||
});
|
||||
stdin.on('end', function() {
|
||||
strings.push(data.trim());
|
||||
main();
|
||||
});
|
||||
stdin.resume();
|
||||
}
|
||||
|
||||
}());
|
265
node_modules/regjsparser/node_modules/jsesc/jsesc.js
generated
vendored
Normal file
265
node_modules/regjsparser/node_modules/jsesc/jsesc.js
generated
vendored
Normal file
@ -0,0 +1,265 @@
|
||||
/*! http://mths.be/jsesc v0.5.0 by @mathias */
|
||||
;(function(root) {
|
||||
|
||||
// Detect free variables `exports`
|
||||
var freeExports = typeof exports == 'object' && exports;
|
||||
|
||||
// Detect free variable `module`
|
||||
var freeModule = typeof module == 'object' && module &&
|
||||
module.exports == freeExports && module;
|
||||
|
||||
// Detect free variable `global`, from Node.js or Browserified code,
|
||||
// and use it as `root`
|
||||
var freeGlobal = typeof global == 'object' && global;
|
||||
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
|
||||
root = freeGlobal;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
var object = {};
|
||||
var hasOwnProperty = object.hasOwnProperty;
|
||||
var forOwn = function(object, callback) {
|
||||
var key;
|
||||
for (key in object) {
|
||||
if (hasOwnProperty.call(object, key)) {
|
||||
callback(key, object[key]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var extend = function(destination, source) {
|
||||
if (!source) {
|
||||
return destination;
|
||||
}
|
||||
forOwn(source, function(key, value) {
|
||||
destination[key] = value;
|
||||
});
|
||||
return destination;
|
||||
};
|
||||
|
||||
var forEach = function(array, callback) {
|
||||
var length = array.length;
|
||||
var index = -1;
|
||||
while (++index < length) {
|
||||
callback(array[index]);
|
||||
}
|
||||
};
|
||||
|
||||
var toString = object.toString;
|
||||
var isArray = function(value) {
|
||||
return toString.call(value) == '[object Array]';
|
||||
};
|
||||
var isObject = function(value) {
|
||||
// This is a very simple check, but it’s good enough for what we need.
|
||||
return toString.call(value) == '[object Object]';
|
||||
};
|
||||
var isString = function(value) {
|
||||
return typeof value == 'string' ||
|
||||
toString.call(value) == '[object String]';
|
||||
};
|
||||
var isFunction = function(value) {
|
||||
// In a perfect world, the `typeof` check would be sufficient. However,
|
||||
// in Chrome 1–12, `typeof /x/ == 'object'`, and in IE 6–8
|
||||
// `typeof alert == 'object'` and similar for other host objects.
|
||||
return typeof value == 'function' ||
|
||||
toString.call(value) == '[object Function]';
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// http://mathiasbynens.be/notes/javascript-escapes#single
|
||||
var singleEscapes = {
|
||||
'"': '\\"',
|
||||
'\'': '\\\'',
|
||||
'\\': '\\\\',
|
||||
'\b': '\\b',
|
||||
'\f': '\\f',
|
||||
'\n': '\\n',
|
||||
'\r': '\\r',
|
||||
'\t': '\\t'
|
||||
// `\v` is omitted intentionally, because in IE < 9, '\v' == 'v'.
|
||||
// '\v': '\\x0B'
|
||||
};
|
||||
var regexSingleEscape = /["'\\\b\f\n\r\t]/;
|
||||
|
||||
var regexDigit = /[0-9]/;
|
||||
var regexWhitelist = /[ !#-&\(-\[\]-~]/;
|
||||
|
||||
var jsesc = function(argument, options) {
|
||||
// Handle options
|
||||
var defaults = {
|
||||
'escapeEverything': false,
|
||||
'quotes': 'single',
|
||||
'wrap': false,
|
||||
'es6': false,
|
||||
'json': false,
|
||||
'compact': true,
|
||||
'indent': '\t',
|
||||
'__indent__': ''
|
||||
};
|
||||
var json = options && options.json;
|
||||
if (json) {
|
||||
defaults.quotes = 'double';
|
||||
defaults.wrap = true;
|
||||
}
|
||||
options = extend(defaults, options);
|
||||
if (options.quotes != 'single' && options.quotes != 'double') {
|
||||
options.quotes = 'single';
|
||||
}
|
||||
var quote = options.quotes == 'double' ? '"' : '\'';
|
||||
var compact = options.compact;
|
||||
var indent = options.indent;
|
||||
var oldIndent;
|
||||
var newLine = compact ? '' : '\n';
|
||||
var result;
|
||||
var isEmpty = true;
|
||||
|
||||
if (json && argument && isFunction(argument.toJSON)) {
|
||||
argument = argument.toJSON();
|
||||
}
|
||||
|
||||
if (!isString(argument)) {
|
||||
if (isArray(argument)) {
|
||||
result = [];
|
||||
options.wrap = true;
|
||||
oldIndent = options.__indent__;
|
||||
indent += oldIndent;
|
||||
options.__indent__ = indent;
|
||||
forEach(argument, function(value) {
|
||||
isEmpty = false;
|
||||
result.push(
|
||||
(compact ? '' : indent) +
|
||||
jsesc(value, options)
|
||||
);
|
||||
});
|
||||
if (isEmpty) {
|
||||
return '[]';
|
||||
}
|
||||
return '[' + newLine + result.join(',' + newLine) + newLine +
|
||||
(compact ? '' : oldIndent) + ']';
|
||||
} else if (!isObject(argument)) {
|
||||
if (json) {
|
||||
// For some values (e.g. `undefined`, `function` objects),
|
||||
// `JSON.stringify(value)` returns `undefined` (which isn’t valid
|
||||
// JSON) instead of `'null'`.
|
||||
return JSON.stringify(argument) || 'null';
|
||||
}
|
||||
return String(argument);
|
||||
} else { // it’s an object
|
||||
result = [];
|
||||
options.wrap = true;
|
||||
oldIndent = options.__indent__;
|
||||
indent += oldIndent;
|
||||
options.__indent__ = indent;
|
||||
forOwn(argument, function(key, value) {
|
||||
isEmpty = false;
|
||||
result.push(
|
||||
(compact ? '' : indent) +
|
||||
jsesc(key, options) + ':' +
|
||||
(compact ? '' : ' ') +
|
||||
jsesc(value, options)
|
||||
);
|
||||
});
|
||||
if (isEmpty) {
|
||||
return '{}';
|
||||
}
|
||||
return '{' + newLine + result.join(',' + newLine) + newLine +
|
||||
(compact ? '' : oldIndent) + '}';
|
||||
}
|
||||
}
|
||||
|
||||
var string = argument;
|
||||
// Loop over each code unit in the string and escape it
|
||||
var index = -1;
|
||||
var length = string.length;
|
||||
var first;
|
||||
var second;
|
||||
var codePoint;
|
||||
result = '';
|
||||
while (++index < length) {
|
||||
var character = string.charAt(index);
|
||||
if (options.es6) {
|
||||
first = string.charCodeAt(index);
|
||||
if ( // check if it’s the start of a surrogate pair
|
||||
first >= 0xD800 && first <= 0xDBFF && // high surrogate
|
||||
length > index + 1 // there is a next code unit
|
||||
) {
|
||||
second = string.charCodeAt(index + 1);
|
||||
if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
|
||||
// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
||||
codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
|
||||
result += '\\u{' + codePoint.toString(16).toUpperCase() + '}';
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!options.escapeEverything) {
|
||||
if (regexWhitelist.test(character)) {
|
||||
// It’s a printable ASCII character that is not `"`, `'` or `\`,
|
||||
// so don’t escape it.
|
||||
result += character;
|
||||
continue;
|
||||
}
|
||||
if (character == '"') {
|
||||
result += quote == character ? '\\"' : character;
|
||||
continue;
|
||||
}
|
||||
if (character == '\'') {
|
||||
result += quote == character ? '\\\'' : character;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (
|
||||
character == '\0' &&
|
||||
!json &&
|
||||
!regexDigit.test(string.charAt(index + 1))
|
||||
) {
|
||||
result += '\\0';
|
||||
continue;
|
||||
}
|
||||
if (regexSingleEscape.test(character)) {
|
||||
// no need for a `hasOwnProperty` check here
|
||||
result += singleEscapes[character];
|
||||
continue;
|
||||
}
|
||||
var charCode = character.charCodeAt(0);
|
||||
var hexadecimal = charCode.toString(16).toUpperCase();
|
||||
var longhand = hexadecimal.length > 2 || json;
|
||||
var escaped = '\\' + (longhand ? 'u' : 'x') +
|
||||
('0000' + hexadecimal).slice(longhand ? -4 : -2);
|
||||
result += escaped;
|
||||
continue;
|
||||
}
|
||||
if (options.wrap) {
|
||||
result = quote + result + quote;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
jsesc.version = '0.5.0';
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
||||
// like the following:
|
||||
if (
|
||||
typeof define == 'function' &&
|
||||
typeof define.amd == 'object' &&
|
||||
define.amd
|
||||
) {
|
||||
define(function() {
|
||||
return jsesc;
|
||||
});
|
||||
} else if (freeExports && !freeExports.nodeType) {
|
||||
if (freeModule) { // in Node.js or RingoJS v0.8.0+
|
||||
freeModule.exports = jsesc;
|
||||
} else { // in Narwhal or RingoJS v0.7.0-
|
||||
freeExports.jsesc = jsesc;
|
||||
}
|
||||
} else { // in Rhino or a web browser
|
||||
root.jsesc = jsesc;
|
||||
}
|
||||
|
||||
}(this));
|
90
node_modules/regjsparser/node_modules/jsesc/man/jsesc.1
generated
vendored
Normal file
90
node_modules/regjsparser/node_modules/jsesc/man/jsesc.1
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
.Dd October 25, 2013
|
||||
.Dt jsesc 1
|
||||
.Sh NAME
|
||||
.Nm jsesc
|
||||
.Nd escape strings for use in JavaScript string literals
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl s | -single-quotes Ar string
|
||||
.br
|
||||
.Op Fl d | -double-quotes Ar string
|
||||
.br
|
||||
.Op Fl w | -wrap Ar string
|
||||
.br
|
||||
.Op Fl 6 | -es6 Ar string
|
||||
.br
|
||||
.Op Fl e | -escape-everything Ar string
|
||||
.br
|
||||
.Op Fl j | -json Ar string
|
||||
.br
|
||||
.Op Fl p | -object Ar string
|
||||
.br
|
||||
.Op Fl p | -pretty Ar string
|
||||
.br
|
||||
.Op Fl v | -version
|
||||
.br
|
||||
.Op Fl h | -help
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
escapes strings for use in JavaScript string literals while generating the shortest possible valid ASCII-only output.
|
||||
.Sh OPTIONS
|
||||
.Bl -ohang -offset
|
||||
.It Sy "-s, --single-quotes"
|
||||
Escape any occurences of ' in the input string as \\', so that the output can be used in a JavaScript string literal wrapped in single quotes.
|
||||
.It Sy "-d, --double-quotes"
|
||||
Escape any occurences of " in the input string as \\", so that the output can be used in a JavaScript string literal wrapped in double quotes.
|
||||
.It Sy "-w, --wrap"
|
||||
Make sure the output is a valid JavaScript string literal wrapped in quotes. The type of quotes can be specified using the
|
||||
.Ar -s | --single-quotes
|
||||
or
|
||||
.Ar -d | --double-quotes
|
||||
settings.
|
||||
.It Sy "-6, --es6"
|
||||
Escape any astral Unicode symbols using ECMAScript 6 Unicode code point escape sequences.
|
||||
.It Sy "-e, --escape-everything"
|
||||
Escape all the symbols in the output, even printable ASCII symbols.
|
||||
.It Sy "-j, --json"
|
||||
Make sure the output is valid JSON. Hexadecimal character escape sequences and the \\v or \\0 escape sequences will not be used. Setting this flag enables the
|
||||
.Ar -d | --double-quotes
|
||||
and
|
||||
.Ar -w | --wrap
|
||||
settings.
|
||||
.It Sy "-o, --object"
|
||||
Treat the input as a JavaScript object rather than a string. Accepted values are flat arrays containing only string values, and flat objects containing only string values.
|
||||
.It Sy "-p, --pretty"
|
||||
Pretty-print the output for objects, using whitespace to make it more readable. Setting this flag enables the
|
||||
.Ar -o | --object
|
||||
setting.
|
||||
.It Sy "-v, --version"
|
||||
Print jsesc's version.
|
||||
.It Sy "-h, --help"
|
||||
Show the help screen.
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
The
|
||||
.Nm jsesc
|
||||
utility exits with one of the following values:
|
||||
.Pp
|
||||
.Bl -tag -width flag -compact
|
||||
.It Li 0
|
||||
.Nm
|
||||
successfully escaped the given string and printed the result.
|
||||
.It Li 1
|
||||
.Nm
|
||||
wasn't instructed to escape anything (for example, the
|
||||
.Ar --help
|
||||
flag was set); or, an error occurred.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
.Bl -ohang -offset
|
||||
.It Sy "jsesc 'foo bar baz'"
|
||||
Print an escaped version of the given string.
|
||||
.It Sy echo\ 'foo bar baz'\ |\ jsesc
|
||||
Print an escaped version of the string that gets piped in.
|
||||
.El
|
||||
.Sh BUGS
|
||||
jsesc's bug tracker is located at <https://github.com/mathiasbynens/jsesc/issues>.
|
||||
.Sh AUTHOR
|
||||
Mathias Bynens <http://mathiasbynens.be/>
|
||||
.Sh WWW
|
||||
<http://mths.be/jsesc>
|
84
node_modules/regjsparser/node_modules/jsesc/package.json
generated
vendored
Normal file
84
node_modules/regjsparser/node_modules/jsesc/package.json
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"_from": "jsesc@~0.5.0",
|
||||
"_id": "jsesc@0.5.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==",
|
||||
"_location": "/regjsparser/jsesc",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "jsesc@~0.5.0",
|
||||
"name": "jsesc",
|
||||
"escapedName": "jsesc",
|
||||
"rawSpec": "~0.5.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~0.5.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/regjsparser"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
|
||||
"_shasum": "e7dee66e35d6fc16f710fe91d5cf69f70f08911d",
|
||||
"_spec": "jsesc@~0.5.0",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\regjsparser",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "http://mathiasbynens.be/"
|
||||
},
|
||||
"bin": {
|
||||
"jsesc": "bin/jsesc"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mathiasbynens/jsesc/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "A JavaScript library for escaping JavaScript strings while generating the shortest possible valid output.",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.10.0",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-shell": "^0.7.0",
|
||||
"grunt-template": "^0.2.3",
|
||||
"istanbul": "^0.3.0",
|
||||
"qunit-extras": "^1.2.0",
|
||||
"qunitjs": "~1.11.0",
|
||||
"regenerate": "^0.6.2",
|
||||
"requirejs": "^2.1.14"
|
||||
},
|
||||
"directories": {
|
||||
"test": "tests"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE-MIT.txt",
|
||||
"jsesc.js",
|
||||
"bin/",
|
||||
"man/"
|
||||
],
|
||||
"homepage": "http://mths.be/jsesc",
|
||||
"keywords": [
|
||||
"string",
|
||||
"escape",
|
||||
"javascript",
|
||||
"tool"
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://mths.be/mit"
|
||||
}
|
||||
],
|
||||
"main": "jsesc.js",
|
||||
"man": [
|
||||
"man/jsesc.1"
|
||||
],
|
||||
"name": "jsesc",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mathiasbynens/jsesc.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node tests/tests.js"
|
||||
},
|
||||
"version": "0.5.0"
|
||||
}
|
71
node_modules/regjsparser/package.json
generated
vendored
Normal file
71
node_modules/regjsparser/package.json
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
{
|
||||
"_from": "regjsparser@^0.9.1",
|
||||
"_id": "regjsparser@0.9.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==",
|
||||
"_location": "/regjsparser",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "regjsparser@^0.9.1",
|
||||
"name": "regjsparser",
|
||||
"escapedName": "regjsparser",
|
||||
"rawSpec": "^0.9.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.9.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/regexpu-core"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.9.1.tgz",
|
||||
"_shasum": "272d05aa10c7c1f67095b1ff0addae8442fc5709",
|
||||
"_spec": "regjsparser@^0.9.1",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\regexpu-core",
|
||||
"author": {
|
||||
"name": "'Julian Viereck'",
|
||||
"email": "julian.viereck@gmail.com"
|
||||
},
|
||||
"bin": {
|
||||
"regjsparser": "bin/parser"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jviereck/regjsparser/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"jsesc": "~0.5.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Parsing the JavaScript's RegExp in JavaScript.",
|
||||
"devDependencies": {
|
||||
"eslint": "^8.8.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"regenerate": "~1.0.1",
|
||||
"typescript": "^4.5.2",
|
||||
"unicode-11.0.0": "^0.7.8"
|
||||
},
|
||||
"files": [
|
||||
"bin/",
|
||||
"LICENSE.BSD",
|
||||
"parser.js",
|
||||
"parser.d.ts",
|
||||
"README.md"
|
||||
],
|
||||
"homepage": "https://github.com/jviereck/regjsparser",
|
||||
"license": "BSD-2-Clause",
|
||||
"main": "./parser",
|
||||
"name": "regjsparser",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/jviereck/regjsparser.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --ext .js --max-warnings 0 .",
|
||||
"test": "run-p test:* && npm run lint",
|
||||
"test:src": "node test/index.js",
|
||||
"test:types": "tsc test/types.ts --noEmit"
|
||||
},
|
||||
"types": "./parser.d.ts",
|
||||
"version": "0.9.1"
|
||||
}
|
183
node_modules/regjsparser/parser.d.ts
generated
vendored
Normal file
183
node_modules/regjsparser/parser.d.ts
generated
vendored
Normal file
@ -0,0 +1,183 @@
|
||||
type _If<Test, Then, Else> = Test extends true ? Then : Else;
|
||||
|
||||
export type Features = {
|
||||
lookbehind?: boolean;
|
||||
namedGroups?: boolean;
|
||||
unicodePropertyEscape?: boolean;
|
||||
unicodeSet?: boolean;
|
||||
modifiers?: boolean;
|
||||
};
|
||||
|
||||
export type AstNodeType =
|
||||
| "alternative"
|
||||
| "anchor"
|
||||
| "characterClass"
|
||||
| "characterClassEscape"
|
||||
| "characterClassRange"
|
||||
| "disjunction"
|
||||
| "dot"
|
||||
| "group"
|
||||
| "quantifier"
|
||||
| "reference"
|
||||
| "unicodePropertyEscape"
|
||||
| "value";
|
||||
|
||||
export type Base<T extends AstNodeType> = {
|
||||
range: [number, number];
|
||||
raw: string;
|
||||
type: T;
|
||||
};
|
||||
|
||||
export type AstNode<F extends Features = {}> =
|
||||
| Alternative<F>
|
||||
| Anchor
|
||||
| CharacterClass<F>
|
||||
| CharacterClassEscape
|
||||
| CharacterClassRange
|
||||
| Disjunction<F>
|
||||
| Dot
|
||||
| Group<F>
|
||||
| Quantifier<F>
|
||||
| Reference<F>
|
||||
| _If<F["unicodePropertyEscape"], UnicodePropertyEscape, never>
|
||||
| Value;
|
||||
|
||||
export type RootNode<F extends Features = {}> = Exclude<
|
||||
AstNode<F>,
|
||||
CharacterClassRange
|
||||
>;
|
||||
|
||||
export type Anchor = Base<"anchor"> & {
|
||||
kind: "boundary" | "end" | "not-boundary" | "start";
|
||||
};
|
||||
|
||||
export type CharacterClassEscape = Base<"characterClassEscape"> & {
|
||||
value: string;
|
||||
};
|
||||
|
||||
export type Value = Base<"value"> & {
|
||||
codePoint: number;
|
||||
kind:
|
||||
| "controlLetter"
|
||||
| "hexadecimalEscape"
|
||||
| "identifier"
|
||||
| "null"
|
||||
| "octal"
|
||||
| "singleEscape"
|
||||
| "symbol"
|
||||
| "unicodeCodePointEscape"
|
||||
| "unicodeEscape";
|
||||
};
|
||||
|
||||
export type Identifier = Base<"value"> & {
|
||||
value: string;
|
||||
};
|
||||
|
||||
export type Alternative<F extends Features = {}> = Base<"alternative"> & {
|
||||
body: RootNode<F>[];
|
||||
};
|
||||
|
||||
export type CharacterClassRange = Base<"characterClassRange"> & {
|
||||
max: Value;
|
||||
min: Value;
|
||||
};
|
||||
|
||||
export type UnicodePropertyEscape = Base<"unicodePropertyEscape"> & {
|
||||
negative: boolean;
|
||||
value: string;
|
||||
};
|
||||
|
||||
export type CharacterClassBody =
|
||||
| CharacterClassEscape
|
||||
| CharacterClassRange
|
||||
| UnicodePropertyEscape
|
||||
| Value;
|
||||
|
||||
export type CharacterClass<F extends Features = {}> = Base<"characterClass"> & {
|
||||
body: CharacterClassBody[];
|
||||
negative: boolean;
|
||||
kind: "union" | _If<F["unicodeSet"], "intersection" | "subtraction", never>;
|
||||
};
|
||||
|
||||
export type ModifierFlags = {
|
||||
enabling: string,
|
||||
disabling: string
|
||||
}
|
||||
|
||||
export type NonCapturingGroup<F extends Features = {}> = Base<"group"> &
|
||||
(
|
||||
| {
|
||||
behavior:
|
||||
| "lookahead"
|
||||
| "lookbehind"
|
||||
| "negativeLookahead"
|
||||
| "negativeLookbehind";
|
||||
body: RootNode<F>[];
|
||||
}
|
||||
| ({
|
||||
behavior: "ignore";
|
||||
body: RootNode<F>[];
|
||||
} & _If<
|
||||
F["modifiers"],
|
||||
{
|
||||
modifierFlags?: ModifierFlags;
|
||||
},
|
||||
{
|
||||
modifierFlags: undefined;
|
||||
}
|
||||
>)
|
||||
);
|
||||
|
||||
|
||||
export type CapturingGroup<F extends Features = {}> = Base<"group"> & {
|
||||
behavior: "normal";
|
||||
body: RootNode<F>[];
|
||||
} & _If<
|
||||
F["namedGroups"],
|
||||
{
|
||||
name?: Identifier;
|
||||
},
|
||||
{
|
||||
name: undefined;
|
||||
}
|
||||
>;
|
||||
|
||||
export type Group<F extends Features = {}> =
|
||||
| CapturingGroup<F>
|
||||
| NonCapturingGroup<F>;
|
||||
|
||||
export type Quantifier<F extends Features = {}> = Base<"quantifier"> & {
|
||||
body: [RootNode<F>];
|
||||
greedy: boolean;
|
||||
max?: number;
|
||||
min: number;
|
||||
symbol?: '?' | '*' | '+';
|
||||
};
|
||||
|
||||
export type Disjunction<F extends Features = {}> = Base<"disjunction"> & {
|
||||
body: [RootNode<F>, RootNode<F>, ...RootNode<F>[]];
|
||||
};
|
||||
|
||||
export type Dot = Base<"dot">;
|
||||
|
||||
export type NamedReference = Base<"reference"> & {
|
||||
matchIndex: undefined;
|
||||
name: Identifier;
|
||||
};
|
||||
|
||||
export type IndexReference = Base<"reference"> & {
|
||||
matchIndex: number;
|
||||
name: undefined;
|
||||
};
|
||||
|
||||
export type Reference<F extends Features = {}> = _If<
|
||||
F["namedGroups"],
|
||||
NamedReference,
|
||||
IndexReference
|
||||
>;
|
||||
|
||||
export function parse<F extends Features = {}>(
|
||||
str: string,
|
||||
flags: string,
|
||||
features?: F
|
||||
): RootNode<F>;
|
1634
node_modules/regjsparser/parser.js
generated
vendored
Normal file
1634
node_modules/regjsparser/parser.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user