Upload sarif for eslint results
This commit is contained in:
parent
d8b1697e9a
commit
55c72b9aa6
68 changed files with 18214 additions and 1 deletions
20
node_modules/utf8/LICENSE-MIT.txt
generated
vendored
Normal file
20
node_modules/utf8/LICENSE-MIT.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Copyright Mathias Bynens <https://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.
|
||||
85
node_modules/utf8/README.md
generated
vendored
Normal file
85
node_modules/utf8/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
# utf8.js [](https://travis-ci.org/mathiasbynens/utf8.js) [](https://coveralls.io/r/mathiasbynens/utf8.js) [](https://gemnasium.com/mathiasbynens/utf8.js)
|
||||
|
||||
_utf8.js_ is a well-tested UTF-8 encoder/decoder written in JavaScript. Unlike many other JavaScript solutions, it is designed to be a _proper_ UTF-8 encoder/decoder: it can encode/decode any scalar Unicode code point values, as per [the Encoding Standard](https://encoding.spec.whatwg.org/#utf-8). [Here’s an online demo.](https://mothereff.in/utf-8)
|
||||
|
||||
Feel free to fork if you see possible improvements!
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install utf8
|
||||
```
|
||||
|
||||
In a browser:
|
||||
|
||||
```html
|
||||
<script src="utf8.js"></script>
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
```js
|
||||
const utf8 = require('utf8');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `utf8.encode(string)`
|
||||
|
||||
Encodes any given JavaScript string (`string`) as UTF-8, and returns the UTF-8-encoded version of the string. It throws an error if the input string contains a non-scalar value, i.e. a lone surrogate. (If you need to be able to encode non-scalar values as well, use [WTF-8](https://mths.be/wtf8) instead.)
|
||||
|
||||
```js
|
||||
// U+00A9 COPYRIGHT SIGN; see http://codepoints.net/U+00A9
|
||||
utf8.encode('\xA9');
|
||||
// → '\xC2\xA9'
|
||||
// U+10001 LINEAR B SYLLABLE B038 E; see http://codepoints.net/U+10001
|
||||
utf8.encode('\uD800\uDC01');
|
||||
// → '\xF0\x90\x80\x81'
|
||||
```
|
||||
|
||||
### `utf8.decode(byteString)`
|
||||
|
||||
Decodes any given UTF-8-encoded string (`byteString`) as UTF-8, and returns the UTF-8-decoded version of the string. It throws an error when malformed UTF-8 is detected. (If you need to be able to decode encoded non-scalar values as well, use [WTF-8](https://mths.be/wtf8) instead.)
|
||||
|
||||
```js
|
||||
utf8.decode('\xC2\xA9');
|
||||
// → '\xA9'
|
||||
|
||||
utf8.decode('\xF0\x90\x80\x81');
|
||||
// → '\uD800\uDC01'
|
||||
// → U+10001 LINEAR B SYLLABLE B038 E
|
||||
```
|
||||
|
||||
### `utf8.version`
|
||||
|
||||
A string representing the semantic version number.
|
||||
|
||||
## Support
|
||||
|
||||
utf8.js has been tested in at least Chrome 27-39, Firefox 3-34, Safari 4-8, Opera 10-28, IE 6-11, Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.11, PhantomJS 1.9.0, and Rhino 1.7RC4.
|
||||
|
||||
## 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, PhantomJS, and web browsers as well, use `grunt test`.
|
||||
|
||||
To generate the code coverage report, use `grunt cover`.
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why is the first release named v2.0.0? Haven’t you heard of [semantic versioning](http://semver.org/)?
|
||||
|
||||
Long before utf8.js was created, the `utf8` module on npm was registered and used by another (slightly buggy) library. @ryanmcgrath was kind enough to give me access to the `utf8` package on npm when I told him about utf8.js. Since there has already been a v1.0.0 release of the old library, and to avoid breaking backwards compatibility with projects that rely on the `utf8` npm package, I decided the tag the first release of utf8.js as v2.0.0 and take it from there.
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
utf8.js is available under the [MIT](https://mths.be/mit) license.
|
||||
42
node_modules/utf8/package.json
generated
vendored
Normal file
42
node_modules/utf8/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"name": "utf8",
|
||||
"version": "3.0.0",
|
||||
"description": "A well-tested UTF-8 encoder/decoder written in JavaScript.",
|
||||
"homepage": "https://mths.be/utf8js",
|
||||
"main": "utf8.js",
|
||||
"keywords": [
|
||||
"charset",
|
||||
"encoding",
|
||||
"unicode",
|
||||
"utf8"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mathiasbynens/utf8.js.git"
|
||||
},
|
||||
"bugs": "https://github.com/mathiasbynens/utf8.js/issues",
|
||||
"files": [
|
||||
"LICENSE-MIT.txt",
|
||||
"utf8.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node tests/tests.js",
|
||||
"test-extended": "node tests/tests.js --extended",
|
||||
"test-browser": "open tests/index.html",
|
||||
"ci": "npm run build && npm test",
|
||||
"build": "cd tests; if [ ! -f data.json ]; then python generate-test-data.py; fi",
|
||||
"cover-html": "istanbul cover --report html --verbose --dir coverage tests/tests.js; istanbul report --root coverage --format html",
|
||||
"cover-coveralls": "istanbul cover --verbose --dir coverage tests/tests.js && coveralls < coverage/lcov.info; rm -rf coverage/lcov*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.14",
|
||||
"istanbul": "^0.4.5",
|
||||
"qunit-extras": "^1.4.2",
|
||||
"qunitjs": "~1.11.0"
|
||||
}
|
||||
}
|
||||
202
node_modules/utf8/utf8.js
generated
vendored
Normal file
202
node_modules/utf8/utf8.js
generated
vendored
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
/*! https://mths.be/utf8js v3.0.0 by @mathias */
|
||||
;(function(root) {
|
||||
|
||||
var stringFromCharCode = String.fromCharCode;
|
||||
|
||||
// Taken from https://mths.be/punycode
|
||||
function ucs2decode(string) {
|
||||
var output = [];
|
||||
var counter = 0;
|
||||
var length = string.length;
|
||||
var value;
|
||||
var extra;
|
||||
while (counter < length) {
|
||||
value = string.charCodeAt(counter++);
|
||||
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
||||
// high surrogate, and there is a next character
|
||||
extra = string.charCodeAt(counter++);
|
||||
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
|
||||
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
||||
} else {
|
||||
// unmatched surrogate; only append this code unit, in case the next
|
||||
// code unit is the high surrogate of a surrogate pair
|
||||
output.push(value);
|
||||
counter--;
|
||||
}
|
||||
} else {
|
||||
output.push(value);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
// Taken from https://mths.be/punycode
|
||||
function ucs2encode(array) {
|
||||
var length = array.length;
|
||||
var index = -1;
|
||||
var value;
|
||||
var output = '';
|
||||
while (++index < length) {
|
||||
value = array[index];
|
||||
if (value > 0xFFFF) {
|
||||
value -= 0x10000;
|
||||
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
||||
value = 0xDC00 | value & 0x3FF;
|
||||
}
|
||||
output += stringFromCharCode(value);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
function checkScalarValue(codePoint) {
|
||||
if (codePoint >= 0xD800 && codePoint <= 0xDFFF) {
|
||||
throw Error(
|
||||
'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +
|
||||
' is not a scalar value'
|
||||
);
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
function createByte(codePoint, shift) {
|
||||
return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
|
||||
}
|
||||
|
||||
function encodeCodePoint(codePoint) {
|
||||
if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
|
||||
return stringFromCharCode(codePoint);
|
||||
}
|
||||
var symbol = '';
|
||||
if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
|
||||
symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
|
||||
}
|
||||
else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
|
||||
checkScalarValue(codePoint);
|
||||
symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
|
||||
symbol += createByte(codePoint, 6);
|
||||
}
|
||||
else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
|
||||
symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
|
||||
symbol += createByte(codePoint, 12);
|
||||
symbol += createByte(codePoint, 6);
|
||||
}
|
||||
symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
|
||||
return symbol;
|
||||
}
|
||||
|
||||
function utf8encode(string) {
|
||||
var codePoints = ucs2decode(string);
|
||||
var length = codePoints.length;
|
||||
var index = -1;
|
||||
var codePoint;
|
||||
var byteString = '';
|
||||
while (++index < length) {
|
||||
codePoint = codePoints[index];
|
||||
byteString += encodeCodePoint(codePoint);
|
||||
}
|
||||
return byteString;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
function readContinuationByte() {
|
||||
if (byteIndex >= byteCount) {
|
||||
throw Error('Invalid byte index');
|
||||
}
|
||||
|
||||
var continuationByte = byteArray[byteIndex] & 0xFF;
|
||||
byteIndex++;
|
||||
|
||||
if ((continuationByte & 0xC0) == 0x80) {
|
||||
return continuationByte & 0x3F;
|
||||
}
|
||||
|
||||
// If we end up here, it’s not a continuation byte
|
||||
throw Error('Invalid continuation byte');
|
||||
}
|
||||
|
||||
function decodeSymbol() {
|
||||
var byte1;
|
||||
var byte2;
|
||||
var byte3;
|
||||
var byte4;
|
||||
var codePoint;
|
||||
|
||||
if (byteIndex > byteCount) {
|
||||
throw Error('Invalid byte index');
|
||||
}
|
||||
|
||||
if (byteIndex == byteCount) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read first byte
|
||||
byte1 = byteArray[byteIndex] & 0xFF;
|
||||
byteIndex++;
|
||||
|
||||
// 1-byte sequence (no continuation bytes)
|
||||
if ((byte1 & 0x80) == 0) {
|
||||
return byte1;
|
||||
}
|
||||
|
||||
// 2-byte sequence
|
||||
if ((byte1 & 0xE0) == 0xC0) {
|
||||
byte2 = readContinuationByte();
|
||||
codePoint = ((byte1 & 0x1F) << 6) | byte2;
|
||||
if (codePoint >= 0x80) {
|
||||
return codePoint;
|
||||
} else {
|
||||
throw Error('Invalid continuation byte');
|
||||
}
|
||||
}
|
||||
|
||||
// 3-byte sequence (may include unpaired surrogates)
|
||||
if ((byte1 & 0xF0) == 0xE0) {
|
||||
byte2 = readContinuationByte();
|
||||
byte3 = readContinuationByte();
|
||||
codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;
|
||||
if (codePoint >= 0x0800) {
|
||||
checkScalarValue(codePoint);
|
||||
return codePoint;
|
||||
} else {
|
||||
throw Error('Invalid continuation byte');
|
||||
}
|
||||
}
|
||||
|
||||
// 4-byte sequence
|
||||
if ((byte1 & 0xF8) == 0xF0) {
|
||||
byte2 = readContinuationByte();
|
||||
byte3 = readContinuationByte();
|
||||
byte4 = readContinuationByte();
|
||||
codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |
|
||||
(byte3 << 0x06) | byte4;
|
||||
if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
|
||||
return codePoint;
|
||||
}
|
||||
}
|
||||
|
||||
throw Error('Invalid UTF-8 detected');
|
||||
}
|
||||
|
||||
var byteArray;
|
||||
var byteCount;
|
||||
var byteIndex;
|
||||
function utf8decode(byteString) {
|
||||
byteArray = ucs2decode(byteString);
|
||||
byteCount = byteArray.length;
|
||||
byteIndex = 0;
|
||||
var codePoints = [];
|
||||
var tmp;
|
||||
while ((tmp = decodeSymbol()) !== false) {
|
||||
codePoints.push(tmp);
|
||||
}
|
||||
return ucs2encode(codePoints);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
root.version = '3.0.0';
|
||||
root.encode = utf8encode;
|
||||
root.decode = utf8decode;
|
||||
|
||||
}(typeof exports === 'undefined' ? this.utf8 = {} : exports));
|
||||
Loading…
Add table
Add a link
Reference in a new issue