forked from Supositware/Haha-Yes
commando
This commit is contained in:
parent
1596a91c75
commit
b2a654d3db
2395 changed files with 346479 additions and 5 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,6 +1,4 @@
|
||||||
config.json
|
config.json
|
||||||
package-lock.json
|
package-lock.json
|
||||||
package.json
|
package.json
|
||||||
node_modules
|
|
||||||
node_modules/
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
@ -11,7 +11,7 @@ module.exports = class DedCommand extends Command {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
run(message) {
|
async run(message) {
|
||||||
message.say("i dont work :(");
|
await message.say("im dead now k bye thx);
|
||||||
process.exit();
|
process.exit();
|
||||||
}}
|
}}
|
2
index.js
2
index.js
|
@ -6,7 +6,7 @@ const fs = require("fs");
|
||||||
|
|
||||||
// Prefix and ownerID and invite to support server
|
// Prefix and ownerID and invite to support server
|
||||||
const client = new CommandoClient({
|
const client = new CommandoClient({
|
||||||
commandPrefix: 'haha ',
|
commandPrefix: 'h3h3 ',
|
||||||
owner: '267065637183029248',
|
owner: '267065637183029248',
|
||||||
invite: 'https://discord.gg/SsMCsVY',
|
invite: 'https://discord.gg/SsMCsVY',
|
||||||
});
|
});
|
||||||
|
|
1
node_modules/.bin/lzmajs
generated
vendored
Symbolic link
1
node_modules/.bin/lzmajs
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../lzma-native/bin/lzmajs
|
1
node_modules/.bin/seek-bunzip
generated
vendored
Symbolic link
1
node_modules/.bin/seek-bunzip
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../seek-bzip/bin/seek-bunzip
|
1
node_modules/.bin/seek-table
generated
vendored
Symbolic link
1
node_modules/.bin/seek-table
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../seek-bzip/bin/seek-bzip-table
|
5
node_modules/base64-js/.travis.yml
generated
vendored
Normal file
5
node_modules/base64-js/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- "0.8"
|
||||||
|
- "0.10"
|
||||||
|
- "0.11"
|
21
node_modules/base64-js/LICENSE.MIT
generated
vendored
Normal file
21
node_modules/base64-js/LICENSE.MIT
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014
|
||||||
|
|
||||||
|
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.
|
31
node_modules/base64-js/README.md
generated
vendored
Normal file
31
node_modules/base64-js/README.md
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
base64-js
|
||||||
|
=========
|
||||||
|
|
||||||
|
`base64-js` does basic base64 encoding/decoding in pure JS.
|
||||||
|
|
||||||
|
[![build status](https://secure.travis-ci.org/beatgammit/base64-js.png)](http://travis-ci.org/beatgammit/base64-js)
|
||||||
|
|
||||||
|
[![testling badge](https://ci.testling.com/beatgammit/base64-js.png)](https://ci.testling.com/beatgammit/base64-js)
|
||||||
|
|
||||||
|
Many browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data.
|
||||||
|
|
||||||
|
Sometimes encoding/decoding binary data in the browser is useful, and that is what this module does.
|
||||||
|
|
||||||
|
## install
|
||||||
|
|
||||||
|
With [npm](https://npmjs.org) do:
|
||||||
|
|
||||||
|
`npm install base64-js`
|
||||||
|
|
||||||
|
## methods
|
||||||
|
|
||||||
|
`var base64 = require('base64-js')`
|
||||||
|
|
||||||
|
`base64` has two exposed functions, `toByteArray` and `fromByteArray`, which both take a single argument.
|
||||||
|
|
||||||
|
* `toByteArray` - Takes a base64 string and returns a byte array
|
||||||
|
* `fromByteArray` - Takes a byte array and returns a base64 string
|
||||||
|
|
||||||
|
## license
|
||||||
|
|
||||||
|
MIT
|
19
node_modules/base64-js/bench/bench.js
generated
vendored
Normal file
19
node_modules/base64-js/bench/bench.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
var random = require('crypto').pseudoRandomBytes
|
||||||
|
|
||||||
|
var b64 = require('../')
|
||||||
|
var fs = require('fs')
|
||||||
|
var path = require('path')
|
||||||
|
var data = random(1e6).toString('base64')
|
||||||
|
//fs.readFileSync(path.join(__dirname, 'example.b64'), 'ascii').split('\n').join('')
|
||||||
|
var start = Date.now()
|
||||||
|
var raw = b64.toByteArray(data)
|
||||||
|
var middle = Date.now()
|
||||||
|
var data = b64.fromByteArray(raw)
|
||||||
|
var end = Date.now()
|
||||||
|
|
||||||
|
console.log('decode ms, decode ops/ms, encode ms, encode ops/ms')
|
||||||
|
console.log(
|
||||||
|
middle - start, data.length / (middle - start),
|
||||||
|
end - middle, data.length / (end - middle))
|
||||||
|
//console.log(data)
|
||||||
|
|
124
node_modules/base64-js/lib/b64.js
generated
vendored
Normal file
124
node_modules/base64-js/lib/b64.js
generated
vendored
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||||
|
|
||||||
|
;(function (exports) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var Arr = (typeof Uint8Array !== 'undefined')
|
||||||
|
? Uint8Array
|
||||||
|
: Array
|
||||||
|
|
||||||
|
var PLUS = '+'.charCodeAt(0)
|
||||||
|
var SLASH = '/'.charCodeAt(0)
|
||||||
|
var NUMBER = '0'.charCodeAt(0)
|
||||||
|
var LOWER = 'a'.charCodeAt(0)
|
||||||
|
var UPPER = 'A'.charCodeAt(0)
|
||||||
|
var PLUS_URL_SAFE = '-'.charCodeAt(0)
|
||||||
|
var SLASH_URL_SAFE = '_'.charCodeAt(0)
|
||||||
|
|
||||||
|
function decode (elt) {
|
||||||
|
var code = elt.charCodeAt(0)
|
||||||
|
if (code === PLUS ||
|
||||||
|
code === PLUS_URL_SAFE)
|
||||||
|
return 62 // '+'
|
||||||
|
if (code === SLASH ||
|
||||||
|
code === SLASH_URL_SAFE)
|
||||||
|
return 63 // '/'
|
||||||
|
if (code < NUMBER)
|
||||||
|
return -1 //no match
|
||||||
|
if (code < NUMBER + 10)
|
||||||
|
return code - NUMBER + 26 + 26
|
||||||
|
if (code < UPPER + 26)
|
||||||
|
return code - UPPER
|
||||||
|
if (code < LOWER + 26)
|
||||||
|
return code - LOWER + 26
|
||||||
|
}
|
||||||
|
|
||||||
|
function b64ToByteArray (b64) {
|
||||||
|
var i, j, l, tmp, placeHolders, arr
|
||||||
|
|
||||||
|
if (b64.length % 4 > 0) {
|
||||||
|
throw new Error('Invalid string. Length must be a multiple of 4')
|
||||||
|
}
|
||||||
|
|
||||||
|
// the number of equal signs (place holders)
|
||||||
|
// if there are two placeholders, than the two characters before it
|
||||||
|
// represent one byte
|
||||||
|
// if there is only one, then the three characters before it represent 2 bytes
|
||||||
|
// this is just a cheap hack to not do indexOf twice
|
||||||
|
var len = b64.length
|
||||||
|
placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
|
||||||
|
|
||||||
|
// base64 is 4/3 + up to two characters of the original data
|
||||||
|
arr = new Arr(b64.length * 3 / 4 - placeHolders)
|
||||||
|
|
||||||
|
// if there are placeholders, only get up to the last complete 4 chars
|
||||||
|
l = placeHolders > 0 ? b64.length - 4 : b64.length
|
||||||
|
|
||||||
|
var L = 0
|
||||||
|
|
||||||
|
function push (v) {
|
||||||
|
arr[L++] = v
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
||||||
|
tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
|
||||||
|
push((tmp & 0xFF0000) >> 16)
|
||||||
|
push((tmp & 0xFF00) >> 8)
|
||||||
|
push(tmp & 0xFF)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (placeHolders === 2) {
|
||||||
|
tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
|
||||||
|
push(tmp & 0xFF)
|
||||||
|
} else if (placeHolders === 1) {
|
||||||
|
tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
|
||||||
|
push((tmp >> 8) & 0xFF)
|
||||||
|
push(tmp & 0xFF)
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr
|
||||||
|
}
|
||||||
|
|
||||||
|
function uint8ToBase64 (uint8) {
|
||||||
|
var i,
|
||||||
|
extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
|
||||||
|
output = "",
|
||||||
|
temp, length
|
||||||
|
|
||||||
|
function encode (num) {
|
||||||
|
return lookup.charAt(num)
|
||||||
|
}
|
||||||
|
|
||||||
|
function tripletToBase64 (num) {
|
||||||
|
return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
|
||||||
|
}
|
||||||
|
|
||||||
|
// go through the array every three bytes, we'll deal with trailing stuff later
|
||||||
|
for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
|
||||||
|
temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
|
||||||
|
output += tripletToBase64(temp)
|
||||||
|
}
|
||||||
|
|
||||||
|
// pad the end with zeros, but make sure to not forget the extra bytes
|
||||||
|
switch (extraBytes) {
|
||||||
|
case 1:
|
||||||
|
temp = uint8[uint8.length - 1]
|
||||||
|
output += encode(temp >> 2)
|
||||||
|
output += encode((temp << 4) & 0x3F)
|
||||||
|
output += '=='
|
||||||
|
break
|
||||||
|
case 2:
|
||||||
|
temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
|
||||||
|
output += encode(temp >> 10)
|
||||||
|
output += encode((temp >> 4) & 0x3F)
|
||||||
|
output += encode((temp << 2) & 0x3F)
|
||||||
|
output += '='
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return output
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.toByteArray = b64ToByteArray
|
||||||
|
exports.fromByteArray = uint8ToBase64
|
||||||
|
}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
|
51
node_modules/base64-js/test/convert.js
generated
vendored
Normal file
51
node_modules/base64-js/test/convert.js
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
var test = require('tape'),
|
||||||
|
b64 = require('../lib/b64'),
|
||||||
|
checks = [
|
||||||
|
'a',
|
||||||
|
'aa',
|
||||||
|
'aaa',
|
||||||
|
'hi',
|
||||||
|
'hi!',
|
||||||
|
'hi!!',
|
||||||
|
'sup',
|
||||||
|
'sup?',
|
||||||
|
'sup?!'
|
||||||
|
];
|
||||||
|
|
||||||
|
test('convert to base64 and back', function (t) {
|
||||||
|
t.plan(checks.length);
|
||||||
|
|
||||||
|
for (var i = 0; i < checks.length; i++) {
|
||||||
|
var check = checks[i],
|
||||||
|
b64Str,
|
||||||
|
arr,
|
||||||
|
str;
|
||||||
|
|
||||||
|
b64Str = b64.fromByteArray(map(check, function (char) { return char.charCodeAt(0); }));
|
||||||
|
|
||||||
|
arr = b64.toByteArray(b64Str);
|
||||||
|
str = map(arr, function (byte) { return String.fromCharCode(byte); }).join('');
|
||||||
|
|
||||||
|
t.equal(check, str, 'Checked ' + check);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function map (arr, callback) {
|
||||||
|
var res = [],
|
||||||
|
kValue,
|
||||||
|
mappedValue;
|
||||||
|
|
||||||
|
for (var k = 0, len = arr.length; k < len; k++) {
|
||||||
|
if ((typeof arr === 'string' && !!arr.charAt(k))) {
|
||||||
|
kValue = arr.charAt(k);
|
||||||
|
mappedValue = callback(kValue, k, arr);
|
||||||
|
res[k] = mappedValue;
|
||||||
|
} else if (typeof arr !== 'string' && k in arr) {
|
||||||
|
kValue = arr[k];
|
||||||
|
mappedValue = callback(kValue, k, arr);
|
||||||
|
res[k] = mappedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
18
node_modules/base64-js/test/url-safe.js
generated
vendored
Normal file
18
node_modules/base64-js/test/url-safe.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
var test = require('tape'),
|
||||||
|
b64 = require('../lib/b64');
|
||||||
|
|
||||||
|
test('decode url-safe style base64 strings', function (t) {
|
||||||
|
var expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff];
|
||||||
|
|
||||||
|
var actual = b64.toByteArray('//++/++/++//');
|
||||||
|
for (var i = 0; i < actual.length; i++) {
|
||||||
|
t.equal(actual[i], expected[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
actual = b64.toByteArray('__--_--_--__');
|
||||||
|
for (var i = 0; i < actual.length; i++) {
|
||||||
|
t.equal(actual[i], expected[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
});
|
97
node_modules/bindings/README.md
generated
vendored
Normal file
97
node_modules/bindings/README.md
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
node-bindings
|
||||||
|
=============
|
||||||
|
### Helper module for loading your native module's .node file
|
||||||
|
|
||||||
|
This is a helper module for authors of Node.js native addon modules.
|
||||||
|
It is basically the "swiss army knife" of `require()`ing your native module's
|
||||||
|
`.node` file.
|
||||||
|
|
||||||
|
Throughout the course of Node's native addon history, addons have ended up being
|
||||||
|
compiled in a variety of different places, depending on which build tool and which
|
||||||
|
version of node was used. To make matters worse, now the _gyp_ build tool can
|
||||||
|
produce either a _Release_ or _Debug_ build, each being built into different
|
||||||
|
locations.
|
||||||
|
|
||||||
|
This module checks _all_ the possible locations that a native addon would be built
|
||||||
|
at, and returns the first one that loads successfully.
|
||||||
|
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
Install with `npm`:
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
$ npm install bindings
|
||||||
|
```
|
||||||
|
|
||||||
|
Or add it to the `"dependencies"` section of your _package.json_ file.
|
||||||
|
|
||||||
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
|
||||||
|
`require()`ing the proper bindings file for the current node version, platform
|
||||||
|
and architecture is as simple as:
|
||||||
|
|
||||||
|
``` js
|
||||||
|
var bindings = require('bindings')('binding.node')
|
||||||
|
|
||||||
|
// Use your bindings defined in your C files
|
||||||
|
bindings.your_c_function()
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Nice Error Output
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
When the `.node` file could not be loaded, `node-bindings` throws an Error with
|
||||||
|
a nice error message telling you exactly what was tried. You can also check the
|
||||||
|
`err.tries` Array property.
|
||||||
|
|
||||||
|
```
|
||||||
|
Error: Could not load the bindings file. Tried:
|
||||||
|
→ /Users/nrajlich/ref/build/binding.node
|
||||||
|
→ /Users/nrajlich/ref/build/Debug/binding.node
|
||||||
|
→ /Users/nrajlich/ref/build/Release/binding.node
|
||||||
|
→ /Users/nrajlich/ref/out/Debug/binding.node
|
||||||
|
→ /Users/nrajlich/ref/Debug/binding.node
|
||||||
|
→ /Users/nrajlich/ref/out/Release/binding.node
|
||||||
|
→ /Users/nrajlich/ref/Release/binding.node
|
||||||
|
→ /Users/nrajlich/ref/build/default/binding.node
|
||||||
|
→ /Users/nrajlich/ref/compiled/0.8.2/darwin/x64/binding.node
|
||||||
|
at bindings (/Users/nrajlich/ref/node_modules/bindings/bindings.js:84:13)
|
||||||
|
at Object.<anonymous> (/Users/nrajlich/ref/lib/ref.js:5:47)
|
||||||
|
at Module._compile (module.js:449:26)
|
||||||
|
at Object.Module._extensions..js (module.js:467:10)
|
||||||
|
at Module.load (module.js:356:32)
|
||||||
|
at Function.Module._load (module.js:312:12)
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
|
||||||
|
|
||||||
|
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.
|
166
node_modules/bindings/bindings.js
generated
vendored
Normal file
166
node_modules/bindings/bindings.js
generated
vendored
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var fs = require('fs')
|
||||||
|
, path = require('path')
|
||||||
|
, join = path.join
|
||||||
|
, dirname = path.dirname
|
||||||
|
, exists = fs.existsSync || path.existsSync
|
||||||
|
, defaults = {
|
||||||
|
arrow: process.env.NODE_BINDINGS_ARROW || ' → '
|
||||||
|
, compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled'
|
||||||
|
, platform: process.platform
|
||||||
|
, arch: process.arch
|
||||||
|
, version: process.versions.node
|
||||||
|
, bindings: 'bindings.node'
|
||||||
|
, try: [
|
||||||
|
// node-gyp's linked version in the "build" dir
|
||||||
|
[ 'module_root', 'build', 'bindings' ]
|
||||||
|
// node-waf and gyp_addon (a.k.a node-gyp)
|
||||||
|
, [ 'module_root', 'build', 'Debug', 'bindings' ]
|
||||||
|
, [ 'module_root', 'build', 'Release', 'bindings' ]
|
||||||
|
// Debug files, for development (legacy behavior, remove for node v0.9)
|
||||||
|
, [ 'module_root', 'out', 'Debug', 'bindings' ]
|
||||||
|
, [ 'module_root', 'Debug', 'bindings' ]
|
||||||
|
// Release files, but manually compiled (legacy behavior, remove for node v0.9)
|
||||||
|
, [ 'module_root', 'out', 'Release', 'bindings' ]
|
||||||
|
, [ 'module_root', 'Release', 'bindings' ]
|
||||||
|
// Legacy from node-waf, node <= 0.4.x
|
||||||
|
, [ 'module_root', 'build', 'default', 'bindings' ]
|
||||||
|
// Production "Release" buildtype binary (meh...)
|
||||||
|
, [ 'module_root', 'compiled', 'version', 'platform', 'arch', 'bindings' ]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main `bindings()` function loads the compiled bindings for a given module.
|
||||||
|
* It uses V8's Error API to determine the parent filename that this function is
|
||||||
|
* being invoked from, which is then used to find the root directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function bindings (opts) {
|
||||||
|
|
||||||
|
// Argument surgery
|
||||||
|
if (typeof opts == 'string') {
|
||||||
|
opts = { bindings: opts }
|
||||||
|
} else if (!opts) {
|
||||||
|
opts = {}
|
||||||
|
}
|
||||||
|
opts.__proto__ = defaults
|
||||||
|
|
||||||
|
// Get the module root
|
||||||
|
if (!opts.module_root) {
|
||||||
|
opts.module_root = exports.getRoot(exports.getFileName())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure the given bindings name ends with .node
|
||||||
|
if (path.extname(opts.bindings) != '.node') {
|
||||||
|
opts.bindings += '.node'
|
||||||
|
}
|
||||||
|
|
||||||
|
var tries = []
|
||||||
|
, i = 0
|
||||||
|
, l = opts.try.length
|
||||||
|
, n
|
||||||
|
, b
|
||||||
|
, err
|
||||||
|
|
||||||
|
for (; i<l; i++) {
|
||||||
|
n = join.apply(null, opts.try[i].map(function (p) {
|
||||||
|
return opts[p] || p
|
||||||
|
}))
|
||||||
|
tries.push(n)
|
||||||
|
try {
|
||||||
|
b = opts.path ? require.resolve(n) : require(n)
|
||||||
|
if (!opts.path) {
|
||||||
|
b.path = n
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
} catch (e) {
|
||||||
|
if (!/not find/i.test(e.message)) {
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = new Error('Could not locate the bindings file. Tried:\n'
|
||||||
|
+ tries.map(function (a) { return opts.arrow + a }).join('\n'))
|
||||||
|
err.tries = tries
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
module.exports = exports = bindings
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the filename of the JavaScript file that invokes this function.
|
||||||
|
* Used to help find the root directory of a module.
|
||||||
|
* Optionally accepts an filename argument to skip when searching for the invoking filename
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.getFileName = function getFileName (calling_file) {
|
||||||
|
var origPST = Error.prepareStackTrace
|
||||||
|
, origSTL = Error.stackTraceLimit
|
||||||
|
, dummy = {}
|
||||||
|
, fileName
|
||||||
|
|
||||||
|
Error.stackTraceLimit = 10
|
||||||
|
|
||||||
|
Error.prepareStackTrace = function (e, st) {
|
||||||
|
for (var i=0, l=st.length; i<l; i++) {
|
||||||
|
fileName = st[i].getFileName()
|
||||||
|
if (fileName !== __filename) {
|
||||||
|
if (calling_file) {
|
||||||
|
if (fileName !== calling_file) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// run the 'prepareStackTrace' function above
|
||||||
|
Error.captureStackTrace(dummy)
|
||||||
|
dummy.stack
|
||||||
|
|
||||||
|
// cleanup
|
||||||
|
Error.prepareStackTrace = origPST
|
||||||
|
Error.stackTraceLimit = origSTL
|
||||||
|
|
||||||
|
return fileName
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the root directory of a module, given an arbitrary filename
|
||||||
|
* somewhere in the module tree. The "root directory" is the directory
|
||||||
|
* containing the `package.json` file.
|
||||||
|
*
|
||||||
|
* In: /home/nate/node-native-module/lib/index.js
|
||||||
|
* Out: /home/nate/node-native-module
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.getRoot = function getRoot (file) {
|
||||||
|
var dir = dirname(file)
|
||||||
|
, prev
|
||||||
|
while (true) {
|
||||||
|
if (dir === '.') {
|
||||||
|
// Avoids an infinite loop in rare cases, like the REPL
|
||||||
|
dir = process.cwd()
|
||||||
|
}
|
||||||
|
if (exists(join(dir, 'package.json')) || exists(join(dir, 'node_modules'))) {
|
||||||
|
// Found the 'package.json' file or 'node_modules' dir; we're done
|
||||||
|
return dir
|
||||||
|
}
|
||||||
|
if (prev === dir) {
|
||||||
|
// Got to the top
|
||||||
|
throw new Error('Could not find module root given file: "' + file
|
||||||
|
+ '". Do you have a `package.json` file? ')
|
||||||
|
}
|
||||||
|
// Try the parent dir next
|
||||||
|
prev = dir
|
||||||
|
dir = join(dir, '..')
|
||||||
|
}
|
||||||
|
}
|
59
node_modules/bl/.jshintrc
generated
vendored
Normal file
59
node_modules/bl/.jshintrc
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{
|
||||||
|
"predef": [ ]
|
||||||
|
, "bitwise": false
|
||||||
|
, "camelcase": false
|
||||||
|
, "curly": false
|
||||||
|
, "eqeqeq": false
|
||||||
|
, "forin": false
|
||||||
|
, "immed": false
|
||||||
|
, "latedef": false
|
||||||
|
, "noarg": true
|
||||||
|
, "noempty": true
|
||||||
|
, "nonew": true
|
||||||
|
, "plusplus": false
|
||||||
|
, "quotmark": true
|
||||||
|
, "regexp": false
|
||||||
|
, "undef": true
|
||||||
|
, "unused": true
|
||||||
|
, "strict": false
|
||||||
|
, "trailing": true
|
||||||
|
, "maxlen": 120
|
||||||
|
, "asi": true
|
||||||
|
, "boss": true
|
||||||
|
, "debug": true
|
||||||
|
, "eqnull": true
|
||||||
|
, "esnext": true
|
||||||
|
, "evil": true
|
||||||
|
, "expr": true
|
||||||
|
, "funcscope": false
|
||||||
|
, "globalstrict": false
|
||||||
|
, "iterator": false
|
||||||
|
, "lastsemic": true
|
||||||
|
, "laxbreak": true
|
||||||
|
, "laxcomma": true
|
||||||
|
, "loopfunc": true
|
||||||
|
, "multistr": false
|
||||||
|
, "onecase": false
|
||||||
|
, "proto": false
|
||||||
|
, "regexdash": false
|
||||||
|
, "scripturl": true
|
||||||
|
, "smarttabs": false
|
||||||
|
, "shadow": false
|
||||||
|
, "sub": true
|
||||||
|
, "supernew": false
|
||||||
|
, "validthis": true
|
||||||
|
, "browser": true
|
||||||
|
, "couch": false
|
||||||
|
, "devel": false
|
||||||
|
, "dojo": false
|
||||||
|
, "mootools": false
|
||||||
|
, "node": true
|
||||||
|
, "nonstandard": true
|
||||||
|
, "prototypejs": false
|
||||||
|
, "rhino": false
|
||||||
|
, "worker": true
|
||||||
|
, "wsh": false
|
||||||
|
, "nomen": false
|
||||||
|
, "onevar": false
|
||||||
|
, "passfail": false
|
||||||
|
}
|
16
node_modules/bl/.travis.yml
generated
vendored
Normal file
16
node_modules/bl/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
sudo: false
|
||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- '0.10'
|
||||||
|
- '0.12'
|
||||||
|
- '4'
|
||||||
|
- '6'
|
||||||
|
- '8'
|
||||||
|
- '9'
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
notifications:
|
||||||
|
email:
|
||||||
|
- rod@vagg.org
|
||||||
|
- matteo.collina@gmail.com
|
13
node_modules/bl/LICENSE.md
generated
vendored
Normal file
13
node_modules/bl/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Copyright (c) 2013-2016 bl contributors
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
*bl contributors listed at <https://github.com/rvagg/bl#contributors>*
|
||||||
|
|
||||||
|
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.
|
208
node_modules/bl/README.md
generated
vendored
Normal file
208
node_modules/bl/README.md
generated
vendored
Normal file
|
@ -0,0 +1,208 @@
|
||||||
|
# bl *(BufferList)*
|
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.org/rvagg/bl.svg?branch=master)](https://travis-ci.org/rvagg/bl)
|
||||||
|
|
||||||
|
**A Node.js Buffer list collector, reader and streamer thingy.**
|
||||||
|
|
||||||
|
[![NPM](https://nodei.co/npm/bl.png?downloads=true&downloadRank=true)](https://nodei.co/npm/bl/)
|
||||||
|
[![NPM](https://nodei.co/npm-dl/bl.png?months=6&height=3)](https://nodei.co/npm/bl/)
|
||||||
|
|
||||||
|
**bl** is a storage object for collections of Node Buffers, exposing them with the main Buffer readable API. Also works as a duplex stream so you can collect buffers from a stream that emits them and emit buffers to a stream that consumes them!
|
||||||
|
|
||||||
|
The original buffers are kept intact and copies are only done as necessary. Any reads that require the use of a single original buffer will return a slice of that buffer only (which references the same memory as the original buffer). Reads that span buffers perform concatenation as required and return the results transparently.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const BufferList = require('bl')
|
||||||
|
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(new Buffer('abcd'))
|
||||||
|
bl.append(new Buffer('efg'))
|
||||||
|
bl.append('hi') // bl will also accept & convert Strings
|
||||||
|
bl.append(new Buffer('j'))
|
||||||
|
bl.append(new Buffer([ 0x3, 0x4 ]))
|
||||||
|
|
||||||
|
console.log(bl.length) // 12
|
||||||
|
|
||||||
|
console.log(bl.slice(0, 10).toString('ascii')) // 'abcdefghij'
|
||||||
|
console.log(bl.slice(3, 10).toString('ascii')) // 'defghij'
|
||||||
|
console.log(bl.slice(3, 6).toString('ascii')) // 'def'
|
||||||
|
console.log(bl.slice(3, 8).toString('ascii')) // 'defgh'
|
||||||
|
console.log(bl.slice(5, 10).toString('ascii')) // 'fghij'
|
||||||
|
|
||||||
|
// or just use toString!
|
||||||
|
console.log(bl.toString()) // 'abcdefghij\u0003\u0004'
|
||||||
|
console.log(bl.toString('ascii', 3, 8)) // 'defgh'
|
||||||
|
console.log(bl.toString('ascii', 5, 10)) // 'fghij'
|
||||||
|
|
||||||
|
// other standard Buffer readables
|
||||||
|
console.log(bl.readUInt16BE(10)) // 0x0304
|
||||||
|
console.log(bl.readUInt16LE(10)) // 0x0403
|
||||||
|
```
|
||||||
|
|
||||||
|
Give it a callback in the constructor and use it just like **[concat-stream](https://github.com/maxogden/node-concat-stream)**:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const bl = require('bl')
|
||||||
|
, fs = require('fs')
|
||||||
|
|
||||||
|
fs.createReadStream('README.md')
|
||||||
|
.pipe(bl(function (err, data) { // note 'new' isn't strictly required
|
||||||
|
// `data` is a complete Buffer object containing the full data
|
||||||
|
console.log(data.toString())
|
||||||
|
}))
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that when you use the *callback* method like this, the resulting `data` parameter is a concatenation of all `Buffer` objects in the list. If you want to avoid the overhead of this concatenation (in cases of extreme performance consciousness), then avoid the *callback* method and just listen to `'end'` instead, like a standard Stream.
|
||||||
|
|
||||||
|
Or to fetch a URL using [hyperquest](https://github.com/substack/hyperquest) (should work with [request](http://github.com/mikeal/request) and even plain Node http too!):
|
||||||
|
```js
|
||||||
|
const hyperquest = require('hyperquest')
|
||||||
|
, bl = require('bl')
|
||||||
|
, url = 'https://raw.github.com/rvagg/bl/master/README.md'
|
||||||
|
|
||||||
|
hyperquest(url).pipe(bl(function (err, data) {
|
||||||
|
console.log(data.toString())
|
||||||
|
}))
|
||||||
|
```
|
||||||
|
|
||||||
|
Or, use it as a readable stream to recompose a list of Buffers to an output source:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const BufferList = require('bl')
|
||||||
|
, fs = require('fs')
|
||||||
|
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(new Buffer('abcd'))
|
||||||
|
bl.append(new Buffer('efg'))
|
||||||
|
bl.append(new Buffer('hi'))
|
||||||
|
bl.append(new Buffer('j'))
|
||||||
|
|
||||||
|
bl.pipe(fs.createWriteStream('gibberish.txt'))
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
* <a href="#ctor"><code><b>new BufferList([ callback ])</b></code></a>
|
||||||
|
* <a href="#length"><code>bl.<b>length</b></code></a>
|
||||||
|
* <a href="#append"><code>bl.<b>append(buffer)</b></code></a>
|
||||||
|
* <a href="#get"><code>bl.<b>get(index)</b></code></a>
|
||||||
|
* <a href="#slice"><code>bl.<b>slice([ start[, end ] ])</b></code></a>
|
||||||
|
* <a href="#shallowSlice"><code>bl.<b>shallowSlice([ start[, end ] ])</b></code></a>
|
||||||
|
* <a href="#copy"><code>bl.<b>copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])</b></code></a>
|
||||||
|
* <a href="#duplicate"><code>bl.<b>duplicate()</b></code></a>
|
||||||
|
* <a href="#consume"><code>bl.<b>consume(bytes)</b></code></a>
|
||||||
|
* <a href="#toString"><code>bl.<b>toString([encoding, [ start, [ end ]]])</b></code></a>
|
||||||
|
* <a href="#readXX"><code>bl.<b>readDoubleBE()</b></code>, <code>bl.<b>readDoubleLE()</b></code>, <code>bl.<b>readFloatBE()</b></code>, <code>bl.<b>readFloatLE()</b></code>, <code>bl.<b>readInt32BE()</b></code>, <code>bl.<b>readInt32LE()</b></code>, <code>bl.<b>readUInt32BE()</b></code>, <code>bl.<b>readUInt32LE()</b></code>, <code>bl.<b>readInt16BE()</b></code>, <code>bl.<b>readInt16LE()</b></code>, <code>bl.<b>readUInt16BE()</b></code>, <code>bl.<b>readUInt16LE()</b></code>, <code>bl.<b>readInt8()</b></code>, <code>bl.<b>readUInt8()</b></code></a>
|
||||||
|
* <a href="#streams">Streams</a>
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="ctor"></a>
|
||||||
|
### new BufferList([ callback | Buffer | Buffer array | BufferList | BufferList array | String ])
|
||||||
|
The constructor takes an optional callback, if supplied, the callback will be called with an error argument followed by a reference to the **bl** instance, when `bl.end()` is called (i.e. from a piped stream). This is a convenient method of collecting the entire contents of a stream, particularly when the stream is *chunky*, such as a network stream.
|
||||||
|
|
||||||
|
Normally, no arguments are required for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` object.
|
||||||
|
|
||||||
|
`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var bl = require('bl')
|
||||||
|
var myinstance = bl()
|
||||||
|
|
||||||
|
// equivalent to:
|
||||||
|
|
||||||
|
var BufferList = require('bl')
|
||||||
|
var myinstance = new BufferList()
|
||||||
|
```
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="length"></a>
|
||||||
|
### bl.length
|
||||||
|
Get the length of the list in bytes. This is the sum of the lengths of all of the buffers contained in the list, minus any initial offset for a semi-consumed buffer at the beginning. Should accurately represent the total number of bytes that can be read from the list.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="append"></a>
|
||||||
|
### bl.append(Buffer | Buffer array | BufferList | BufferList array | String)
|
||||||
|
`append(buffer)` adds an additional buffer or BufferList to the internal list. `this` is returned so it can be chained.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="get"></a>
|
||||||
|
### bl.get(index)
|
||||||
|
`get()` will return the byte at the specified index.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="slice"></a>
|
||||||
|
### bl.slice([ start, [ end ] ])
|
||||||
|
`slice()` returns a new `Buffer` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively.
|
||||||
|
|
||||||
|
If the requested range spans a single internal buffer then a slice of that buffer will be returned which shares the original memory range of that Buffer. If the range spans multiple buffers then copy operations will likely occur to give you a uniform Buffer.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="shallowSlice"></a>
|
||||||
|
### bl.shallowSlice([ start, [ end ] ])
|
||||||
|
`shallowSlice()` returns a new `BufferList` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively.
|
||||||
|
|
||||||
|
No copies will be performed. All buffers in the result share memory with the original list.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="copy"></a>
|
||||||
|
### bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])
|
||||||
|
`copy()` copies the content of the list in the `dest` buffer, starting from `destStart` and containing the bytes within the range specified with `srcStart` to `srcEnd`. `destStart`, `start` and `end` are optional and will default to the beginning of the `dest` buffer, and the beginning and end of the list respectively.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="duplicate"></a>
|
||||||
|
### bl.duplicate()
|
||||||
|
`duplicate()` performs a **shallow-copy** of the list. The internal Buffers remains the same, so if you change the underlying Buffers, the change will be reflected in both the original and the duplicate. This method is needed if you want to call `consume()` or `pipe()` and still keep the original list.Example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append('hello')
|
||||||
|
bl.append(' world')
|
||||||
|
bl.append('\n')
|
||||||
|
|
||||||
|
bl.duplicate().pipe(process.stdout, { end: false })
|
||||||
|
|
||||||
|
console.log(bl.toString())
|
||||||
|
```
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="consume"></a>
|
||||||
|
### bl.consume(bytes)
|
||||||
|
`consume()` will shift bytes *off the start of the list*. The number of bytes consumed don't need to line up with the sizes of the internal Buffers—initial offsets will be calculated accordingly in order to give you a consistent view of the data.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="toString"></a>
|
||||||
|
### bl.toString([encoding, [ start, [ end ]]])
|
||||||
|
`toString()` will return a string representation of the buffer. The optional `start` and `end` arguments are passed on to `slice()`, while the `encoding` is passed on to `toString()` of the resulting Buffer. See the [Buffer#toString()](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end) documentation for more information.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="readXX"></a>
|
||||||
|
### bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8()
|
||||||
|
|
||||||
|
All of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently.
|
||||||
|
|
||||||
|
See the <b><code>[Buffer](http://nodejs.org/docs/latest/api/buffer.html)</code></b> documentation for how these work.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="streams"></a>
|
||||||
|
### Streams
|
||||||
|
**bl** is a Node **[Duplex Stream](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_duplex)**, so it can be read from and written to like a standard Node stream. You can also `pipe()` to and from a **bl** instance.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
**bl** is brought to you by the following hackers:
|
||||||
|
|
||||||
|
* [Rod Vagg](https://github.com/rvagg)
|
||||||
|
* [Matteo Collina](https://github.com/mcollina)
|
||||||
|
* [Jarett Cruger](https://github.com/jcrugzz)
|
||||||
|
|
||||||
|
=======
|
||||||
|
|
||||||
|
<a name="license"></a>
|
||||||
|
## License & copyright
|
||||||
|
|
||||||
|
Copyright (c) 2013-2016 bl contributors (listed above).
|
||||||
|
|
||||||
|
bl is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
|
281
node_modules/bl/bl.js
generated
vendored
Normal file
281
node_modules/bl/bl.js
generated
vendored
Normal file
|
@ -0,0 +1,281 @@
|
||||||
|
var DuplexStream = require('readable-stream/duplex')
|
||||||
|
, util = require('util')
|
||||||
|
, Buffer = require('safe-buffer').Buffer
|
||||||
|
|
||||||
|
|
||||||
|
function BufferList (callback) {
|
||||||
|
if (!(this instanceof BufferList))
|
||||||
|
return new BufferList(callback)
|
||||||
|
|
||||||
|
this._bufs = []
|
||||||
|
this.length = 0
|
||||||
|
|
||||||
|
if (typeof callback == 'function') {
|
||||||
|
this._callback = callback
|
||||||
|
|
||||||
|
var piper = function piper (err) {
|
||||||
|
if (this._callback) {
|
||||||
|
this._callback(err)
|
||||||
|
this._callback = null
|
||||||
|
}
|
||||||
|
}.bind(this)
|
||||||
|
|
||||||
|
this.on('pipe', function onPipe (src) {
|
||||||
|
src.on('error', piper)
|
||||||
|
})
|
||||||
|
this.on('unpipe', function onUnpipe (src) {
|
||||||
|
src.removeListener('error', piper)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.append(callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
DuplexStream.call(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
util.inherits(BufferList, DuplexStream)
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype._offset = function _offset (offset) {
|
||||||
|
var tot = 0, i = 0, _t
|
||||||
|
if (offset === 0) return [ 0, 0 ]
|
||||||
|
for (; i < this._bufs.length; i++) {
|
||||||
|
_t = tot + this._bufs[i].length
|
||||||
|
if (offset < _t || i == this._bufs.length - 1)
|
||||||
|
return [ i, offset - tot ]
|
||||||
|
tot = _t
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.append = function append (buf) {
|
||||||
|
var i = 0
|
||||||
|
|
||||||
|
if (Buffer.isBuffer(buf)) {
|
||||||
|
this._appendBuffer(buf);
|
||||||
|
} else if (Array.isArray(buf)) {
|
||||||
|
for (; i < buf.length; i++)
|
||||||
|
this.append(buf[i])
|
||||||
|
} else if (buf instanceof BufferList) {
|
||||||
|
// unwrap argument into individual BufferLists
|
||||||
|
for (; i < buf._bufs.length; i++)
|
||||||
|
this.append(buf._bufs[i])
|
||||||
|
} else if (buf != null) {
|
||||||
|
// coerce number arguments to strings, since Buffer(number) does
|
||||||
|
// uninitialized memory allocation
|
||||||
|
if (typeof buf == 'number')
|
||||||
|
buf = buf.toString()
|
||||||
|
|
||||||
|
this._appendBuffer(Buffer.from(buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype._appendBuffer = function appendBuffer (buf) {
|
||||||
|
this._bufs.push(buf)
|
||||||
|
this.length += buf.length
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype._write = function _write (buf, encoding, callback) {
|
||||||
|
this._appendBuffer(buf)
|
||||||
|
|
||||||
|
if (typeof callback == 'function')
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype._read = function _read (size) {
|
||||||
|
if (!this.length)
|
||||||
|
return this.push(null)
|
||||||
|
|
||||||
|
size = Math.min(size, this.length)
|
||||||
|
this.push(this.slice(0, size))
|
||||||
|
this.consume(size)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.end = function end (chunk) {
|
||||||
|
DuplexStream.prototype.end.call(this, chunk)
|
||||||
|
|
||||||
|
if (this._callback) {
|
||||||
|
this._callback(null, this.slice())
|
||||||
|
this._callback = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.get = function get (index) {
|
||||||
|
return this.slice(index, index + 1)[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.slice = function slice (start, end) {
|
||||||
|
if (typeof start == 'number' && start < 0)
|
||||||
|
start += this.length
|
||||||
|
if (typeof end == 'number' && end < 0)
|
||||||
|
end += this.length
|
||||||
|
return this.copy(null, 0, start, end)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) {
|
||||||
|
if (typeof srcStart != 'number' || srcStart < 0)
|
||||||
|
srcStart = 0
|
||||||
|
if (typeof srcEnd != 'number' || srcEnd > this.length)
|
||||||
|
srcEnd = this.length
|
||||||
|
if (srcStart >= this.length)
|
||||||
|
return dst || Buffer.alloc(0)
|
||||||
|
if (srcEnd <= 0)
|
||||||
|
return dst || Buffer.alloc(0)
|
||||||
|
|
||||||
|
var copy = !!dst
|
||||||
|
, off = this._offset(srcStart)
|
||||||
|
, len = srcEnd - srcStart
|
||||||
|
, bytes = len
|
||||||
|
, bufoff = (copy && dstStart) || 0
|
||||||
|
, start = off[1]
|
||||||
|
, l
|
||||||
|
, i
|
||||||
|
|
||||||
|
// copy/slice everything
|
||||||
|
if (srcStart === 0 && srcEnd == this.length) {
|
||||||
|
if (!copy) { // slice, but full concat if multiple buffers
|
||||||
|
return this._bufs.length === 1
|
||||||
|
? this._bufs[0]
|
||||||
|
: Buffer.concat(this._bufs, this.length)
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy, need to copy individual buffers
|
||||||
|
for (i = 0; i < this._bufs.length; i++) {
|
||||||
|
this._bufs[i].copy(dst, bufoff)
|
||||||
|
bufoff += this._bufs[i].length
|
||||||
|
}
|
||||||
|
|
||||||
|
return dst
|
||||||
|
}
|
||||||
|
|
||||||
|
// easy, cheap case where it's a subset of one of the buffers
|
||||||
|
if (bytes <= this._bufs[off[0]].length - start) {
|
||||||
|
return copy
|
||||||
|
? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes)
|
||||||
|
: this._bufs[off[0]].slice(start, start + bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!copy) // a slice, we need something to copy in to
|
||||||
|
dst = Buffer.allocUnsafe(len)
|
||||||
|
|
||||||
|
for (i = off[0]; i < this._bufs.length; i++) {
|
||||||
|
l = this._bufs[i].length - start
|
||||||
|
|
||||||
|
if (bytes > l) {
|
||||||
|
this._bufs[i].copy(dst, bufoff, start)
|
||||||
|
} else {
|
||||||
|
this._bufs[i].copy(dst, bufoff, start, start + bytes)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
bufoff += l
|
||||||
|
bytes -= l
|
||||||
|
|
||||||
|
if (start)
|
||||||
|
start = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return dst
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferList.prototype.shallowSlice = function shallowSlice (start, end) {
|
||||||
|
start = start || 0
|
||||||
|
end = end || this.length
|
||||||
|
|
||||||
|
if (start < 0)
|
||||||
|
start += this.length
|
||||||
|
if (end < 0)
|
||||||
|
end += this.length
|
||||||
|
|
||||||
|
var startOffset = this._offset(start)
|
||||||
|
, endOffset = this._offset(end)
|
||||||
|
, buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1)
|
||||||
|
|
||||||
|
if (endOffset[1] == 0)
|
||||||
|
buffers.pop()
|
||||||
|
else
|
||||||
|
buffers[buffers.length-1] = buffers[buffers.length-1].slice(0, endOffset[1])
|
||||||
|
|
||||||
|
if (startOffset[1] != 0)
|
||||||
|
buffers[0] = buffers[0].slice(startOffset[1])
|
||||||
|
|
||||||
|
return new BufferList(buffers)
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferList.prototype.toString = function toString (encoding, start, end) {
|
||||||
|
return this.slice(start, end).toString(encoding)
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferList.prototype.consume = function consume (bytes) {
|
||||||
|
while (this._bufs.length) {
|
||||||
|
if (bytes >= this._bufs[0].length) {
|
||||||
|
bytes -= this._bufs[0].length
|
||||||
|
this.length -= this._bufs[0].length
|
||||||
|
this._bufs.shift()
|
||||||
|
} else {
|
||||||
|
this._bufs[0] = this._bufs[0].slice(bytes)
|
||||||
|
this.length -= bytes
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.duplicate = function duplicate () {
|
||||||
|
var i = 0
|
||||||
|
, copy = new BufferList()
|
||||||
|
|
||||||
|
for (; i < this._bufs.length; i++)
|
||||||
|
copy.append(this._bufs[i])
|
||||||
|
|
||||||
|
return copy
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.destroy = function destroy () {
|
||||||
|
this._bufs.length = 0
|
||||||
|
this.length = 0
|
||||||
|
this.push(null)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
;(function () {
|
||||||
|
var methods = {
|
||||||
|
'readDoubleBE' : 8
|
||||||
|
, 'readDoubleLE' : 8
|
||||||
|
, 'readFloatBE' : 4
|
||||||
|
, 'readFloatLE' : 4
|
||||||
|
, 'readInt32BE' : 4
|
||||||
|
, 'readInt32LE' : 4
|
||||||
|
, 'readUInt32BE' : 4
|
||||||
|
, 'readUInt32LE' : 4
|
||||||
|
, 'readInt16BE' : 2
|
||||||
|
, 'readInt16LE' : 2
|
||||||
|
, 'readUInt16BE' : 2
|
||||||
|
, 'readUInt16LE' : 2
|
||||||
|
, 'readInt8' : 1
|
||||||
|
, 'readUInt8' : 1
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var m in methods) {
|
||||||
|
(function (m) {
|
||||||
|
BufferList.prototype[m] = function (offset) {
|
||||||
|
return this.slice(offset, offset + methods[m])[m](0)
|
||||||
|
}
|
||||||
|
}(m))
|
||||||
|
}
|
||||||
|
}())
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = BufferList
|
702
node_modules/bl/test/test.js
generated
vendored
Normal file
702
node_modules/bl/test/test.js
generated
vendored
Normal file
|
@ -0,0 +1,702 @@
|
||||||
|
var tape = require('tape')
|
||||||
|
, crypto = require('crypto')
|
||||||
|
, fs = require('fs')
|
||||||
|
, hash = require('hash_file')
|
||||||
|
, BufferList = require('../')
|
||||||
|
, Buffer = require('safe-buffer').Buffer
|
||||||
|
|
||||||
|
, encodings =
|
||||||
|
('hex utf8 utf-8 ascii binary base64'
|
||||||
|
+ (process.browser ? '' : ' ucs2 ucs-2 utf16le utf-16le')).split(' ')
|
||||||
|
|
||||||
|
tape('single bytes from single buffer', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
|
||||||
|
t.equal(bl.length, 4)
|
||||||
|
|
||||||
|
t.equal(bl.get(0), 97)
|
||||||
|
t.equal(bl.get(1), 98)
|
||||||
|
t.equal(bl.get(2), 99)
|
||||||
|
t.equal(bl.get(3), 100)
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('single bytes from multiple buffers', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
bl.append(Buffer.from('efg'))
|
||||||
|
bl.append(Buffer.from('hi'))
|
||||||
|
bl.append(Buffer.from('j'))
|
||||||
|
|
||||||
|
t.equal(bl.length, 10)
|
||||||
|
|
||||||
|
t.equal(bl.get(0), 97)
|
||||||
|
t.equal(bl.get(1), 98)
|
||||||
|
t.equal(bl.get(2), 99)
|
||||||
|
t.equal(bl.get(3), 100)
|
||||||
|
t.equal(bl.get(4), 101)
|
||||||
|
t.equal(bl.get(5), 102)
|
||||||
|
t.equal(bl.get(6), 103)
|
||||||
|
t.equal(bl.get(7), 104)
|
||||||
|
t.equal(bl.get(8), 105)
|
||||||
|
t.equal(bl.get(9), 106)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('multi bytes from single buffer', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
|
||||||
|
t.equal(bl.length, 4)
|
||||||
|
|
||||||
|
t.equal(bl.slice(0, 4).toString('ascii'), 'abcd')
|
||||||
|
t.equal(bl.slice(0, 3).toString('ascii'), 'abc')
|
||||||
|
t.equal(bl.slice(1, 4).toString('ascii'), 'bcd')
|
||||||
|
t.equal(bl.slice(-4, -1).toString('ascii'), 'abc')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('multi bytes from single buffer (negative indexes)', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(Buffer.from('buffer'))
|
||||||
|
|
||||||
|
t.equal(bl.length, 6)
|
||||||
|
|
||||||
|
t.equal(bl.slice(-6, -1).toString('ascii'), 'buffe')
|
||||||
|
t.equal(bl.slice(-6, -2).toString('ascii'), 'buff')
|
||||||
|
t.equal(bl.slice(-5, -2).toString('ascii'), 'uff')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('multiple bytes from multiple buffers', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
bl.append(Buffer.from('efg'))
|
||||||
|
bl.append(Buffer.from('hi'))
|
||||||
|
bl.append(Buffer.from('j'))
|
||||||
|
|
||||||
|
t.equal(bl.length, 10)
|
||||||
|
|
||||||
|
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||||
|
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
||||||
|
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
||||||
|
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
||||||
|
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
||||||
|
t.equal(bl.slice(-7, -4).toString('ascii'), 'def')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('multiple bytes from multiple buffer lists', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append(new BufferList([ Buffer.from('abcd'), Buffer.from('efg') ]))
|
||||||
|
bl.append(new BufferList([ Buffer.from('hi'), Buffer.from('j') ]))
|
||||||
|
|
||||||
|
t.equal(bl.length, 10)
|
||||||
|
|
||||||
|
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||||
|
|
||||||
|
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
||||||
|
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
||||||
|
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
||||||
|
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
// same data as previous test, just using nested constructors
|
||||||
|
tape('multiple bytes from crazy nested buffer lists', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append(new BufferList([
|
||||||
|
new BufferList([
|
||||||
|
new BufferList(Buffer.from('abc'))
|
||||||
|
, Buffer.from('d')
|
||||||
|
, new BufferList(Buffer.from('efg'))
|
||||||
|
])
|
||||||
|
, new BufferList([ Buffer.from('hi') ])
|
||||||
|
, new BufferList(Buffer.from('j'))
|
||||||
|
]))
|
||||||
|
|
||||||
|
t.equal(bl.length, 10)
|
||||||
|
|
||||||
|
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||||
|
|
||||||
|
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
||||||
|
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
||||||
|
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
||||||
|
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('append accepts arrays of Buffers', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(Buffer.from('abc'))
|
||||||
|
bl.append([ Buffer.from('def') ])
|
||||||
|
bl.append([ Buffer.from('ghi'), Buffer.from('jkl') ])
|
||||||
|
bl.append([ Buffer.from('mnop'), Buffer.from('qrstu'), Buffer.from('vwxyz') ])
|
||||||
|
t.equal(bl.length, 26)
|
||||||
|
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('append accepts arrays of BufferLists', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(Buffer.from('abc'))
|
||||||
|
bl.append([ new BufferList('def') ])
|
||||||
|
bl.append(new BufferList([ Buffer.from('ghi'), new BufferList('jkl') ]))
|
||||||
|
bl.append([ Buffer.from('mnop'), new BufferList([ Buffer.from('qrstu'), Buffer.from('vwxyz') ]) ])
|
||||||
|
t.equal(bl.length, 26)
|
||||||
|
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('append chainable', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
t.ok(bl.append(Buffer.from('abcd')) === bl)
|
||||||
|
t.ok(bl.append([ Buffer.from('abcd') ]) === bl)
|
||||||
|
t.ok(bl.append(new BufferList(Buffer.from('abcd'))) === bl)
|
||||||
|
t.ok(bl.append([ new BufferList(Buffer.from('abcd')) ]) === bl)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('append chainable (test results)', function (t) {
|
||||||
|
var bl = new BufferList('abc')
|
||||||
|
.append([ new BufferList('def') ])
|
||||||
|
.append(new BufferList([ Buffer.from('ghi'), new BufferList('jkl') ]))
|
||||||
|
.append([ Buffer.from('mnop'), new BufferList([ Buffer.from('qrstu'), Buffer.from('vwxyz') ]) ])
|
||||||
|
|
||||||
|
t.equal(bl.length, 26)
|
||||||
|
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('consuming from multiple buffers', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
bl.append(Buffer.from('efg'))
|
||||||
|
bl.append(Buffer.from('hi'))
|
||||||
|
bl.append(Buffer.from('j'))
|
||||||
|
|
||||||
|
t.equal(bl.length, 10)
|
||||||
|
|
||||||
|
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||||
|
|
||||||
|
bl.consume(3)
|
||||||
|
t.equal(bl.length, 7)
|
||||||
|
t.equal(bl.slice(0, 7).toString('ascii'), 'defghij')
|
||||||
|
|
||||||
|
bl.consume(2)
|
||||||
|
t.equal(bl.length, 5)
|
||||||
|
t.equal(bl.slice(0, 5).toString('ascii'), 'fghij')
|
||||||
|
|
||||||
|
bl.consume(1)
|
||||||
|
t.equal(bl.length, 4)
|
||||||
|
t.equal(bl.slice(0, 4).toString('ascii'), 'ghij')
|
||||||
|
|
||||||
|
bl.consume(1)
|
||||||
|
t.equal(bl.length, 3)
|
||||||
|
t.equal(bl.slice(0, 3).toString('ascii'), 'hij')
|
||||||
|
|
||||||
|
bl.consume(2)
|
||||||
|
t.equal(bl.length, 1)
|
||||||
|
t.equal(bl.slice(0, 1).toString('ascii'), 'j')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('complete consumption', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append(Buffer.from('a'))
|
||||||
|
bl.append(Buffer.from('b'))
|
||||||
|
|
||||||
|
bl.consume(2)
|
||||||
|
|
||||||
|
t.equal(bl.length, 0)
|
||||||
|
t.equal(bl._bufs.length, 0)
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test readUInt8 / readInt8', function (t) {
|
||||||
|
var buf1 = Buffer.alloc(1)
|
||||||
|
, buf2 = Buffer.alloc(3)
|
||||||
|
, buf3 = Buffer.alloc(3)
|
||||||
|
, bl = new BufferList()
|
||||||
|
|
||||||
|
buf2[1] = 0x3
|
||||||
|
buf2[2] = 0x4
|
||||||
|
buf3[0] = 0x23
|
||||||
|
buf3[1] = 0x42
|
||||||
|
|
||||||
|
bl.append(buf1)
|
||||||
|
bl.append(buf2)
|
||||||
|
bl.append(buf3)
|
||||||
|
|
||||||
|
t.equal(bl.readUInt8(2), 0x3)
|
||||||
|
t.equal(bl.readInt8(2), 0x3)
|
||||||
|
t.equal(bl.readUInt8(3), 0x4)
|
||||||
|
t.equal(bl.readInt8(3), 0x4)
|
||||||
|
t.equal(bl.readUInt8(4), 0x23)
|
||||||
|
t.equal(bl.readInt8(4), 0x23)
|
||||||
|
t.equal(bl.readUInt8(5), 0x42)
|
||||||
|
t.equal(bl.readInt8(5), 0x42)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test readUInt16LE / readUInt16BE / readInt16LE / readInt16BE', function (t) {
|
||||||
|
var buf1 = Buffer.alloc(1)
|
||||||
|
, buf2 = Buffer.alloc(3)
|
||||||
|
, buf3 = Buffer.alloc(3)
|
||||||
|
, bl = new BufferList()
|
||||||
|
|
||||||
|
buf2[1] = 0x3
|
||||||
|
buf2[2] = 0x4
|
||||||
|
buf3[0] = 0x23
|
||||||
|
buf3[1] = 0x42
|
||||||
|
|
||||||
|
bl.append(buf1)
|
||||||
|
bl.append(buf2)
|
||||||
|
bl.append(buf3)
|
||||||
|
|
||||||
|
t.equal(bl.readUInt16BE(2), 0x0304)
|
||||||
|
t.equal(bl.readUInt16LE(2), 0x0403)
|
||||||
|
t.equal(bl.readInt16BE(2), 0x0304)
|
||||||
|
t.equal(bl.readInt16LE(2), 0x0403)
|
||||||
|
t.equal(bl.readUInt16BE(3), 0x0423)
|
||||||
|
t.equal(bl.readUInt16LE(3), 0x2304)
|
||||||
|
t.equal(bl.readInt16BE(3), 0x0423)
|
||||||
|
t.equal(bl.readInt16LE(3), 0x2304)
|
||||||
|
t.equal(bl.readUInt16BE(4), 0x2342)
|
||||||
|
t.equal(bl.readUInt16LE(4), 0x4223)
|
||||||
|
t.equal(bl.readInt16BE(4), 0x2342)
|
||||||
|
t.equal(bl.readInt16LE(4), 0x4223)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t) {
|
||||||
|
var buf1 = Buffer.alloc(1)
|
||||||
|
, buf2 = Buffer.alloc(3)
|
||||||
|
, buf3 = Buffer.alloc(3)
|
||||||
|
, bl = new BufferList()
|
||||||
|
|
||||||
|
buf2[1] = 0x3
|
||||||
|
buf2[2] = 0x4
|
||||||
|
buf3[0] = 0x23
|
||||||
|
buf3[1] = 0x42
|
||||||
|
|
||||||
|
bl.append(buf1)
|
||||||
|
bl.append(buf2)
|
||||||
|
bl.append(buf3)
|
||||||
|
|
||||||
|
t.equal(bl.readUInt32BE(2), 0x03042342)
|
||||||
|
t.equal(bl.readUInt32LE(2), 0x42230403)
|
||||||
|
t.equal(bl.readInt32BE(2), 0x03042342)
|
||||||
|
t.equal(bl.readInt32LE(2), 0x42230403)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test readFloatLE / readFloatBE', function (t) {
|
||||||
|
var buf1 = Buffer.alloc(1)
|
||||||
|
, buf2 = Buffer.alloc(3)
|
||||||
|
, buf3 = Buffer.alloc(3)
|
||||||
|
, bl = new BufferList()
|
||||||
|
|
||||||
|
buf2[1] = 0x00
|
||||||
|
buf2[2] = 0x00
|
||||||
|
buf3[0] = 0x80
|
||||||
|
buf3[1] = 0x3f
|
||||||
|
|
||||||
|
bl.append(buf1)
|
||||||
|
bl.append(buf2)
|
||||||
|
bl.append(buf3)
|
||||||
|
|
||||||
|
t.equal(bl.readFloatLE(2), 0x01)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test readDoubleLE / readDoubleBE', function (t) {
|
||||||
|
var buf1 = Buffer.alloc(1)
|
||||||
|
, buf2 = Buffer.alloc(3)
|
||||||
|
, buf3 = Buffer.alloc(10)
|
||||||
|
, bl = new BufferList()
|
||||||
|
|
||||||
|
buf2[1] = 0x55
|
||||||
|
buf2[2] = 0x55
|
||||||
|
buf3[0] = 0x55
|
||||||
|
buf3[1] = 0x55
|
||||||
|
buf3[2] = 0x55
|
||||||
|
buf3[3] = 0x55
|
||||||
|
buf3[4] = 0xd5
|
||||||
|
buf3[5] = 0x3f
|
||||||
|
|
||||||
|
bl.append(buf1)
|
||||||
|
bl.append(buf2)
|
||||||
|
bl.append(buf3)
|
||||||
|
|
||||||
|
t.equal(bl.readDoubleLE(2), 0.3333333333333333)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test toString', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
bl.append(Buffer.from('efg'))
|
||||||
|
bl.append(Buffer.from('hi'))
|
||||||
|
bl.append(Buffer.from('j'))
|
||||||
|
|
||||||
|
t.equal(bl.toString('ascii', 0, 10), 'abcdefghij')
|
||||||
|
t.equal(bl.toString('ascii', 3, 10), 'defghij')
|
||||||
|
t.equal(bl.toString('ascii', 3, 6), 'def')
|
||||||
|
t.equal(bl.toString('ascii', 3, 8), 'defgh')
|
||||||
|
t.equal(bl.toString('ascii', 5, 10), 'fghij')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test toString encoding', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
, b = Buffer.from('abcdefghij\xff\x00')
|
||||||
|
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
bl.append(Buffer.from('efg'))
|
||||||
|
bl.append(Buffer.from('hi'))
|
||||||
|
bl.append(Buffer.from('j'))
|
||||||
|
bl.append(Buffer.from('\xff\x00'))
|
||||||
|
|
||||||
|
encodings.forEach(function (enc) {
|
||||||
|
t.equal(bl.toString(enc), b.toString(enc), enc)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
!process.browser && tape('test stream', function (t) {
|
||||||
|
var random = crypto.randomBytes(65534)
|
||||||
|
, rndhash = hash(random, 'md5')
|
||||||
|
, md5sum = crypto.createHash('md5')
|
||||||
|
, bl = new BufferList(function (err, buf) {
|
||||||
|
t.ok(Buffer.isBuffer(buf))
|
||||||
|
t.ok(err === null)
|
||||||
|
t.equal(rndhash, hash(bl.slice(), 'md5'))
|
||||||
|
t.equal(rndhash, hash(buf, 'md5'))
|
||||||
|
|
||||||
|
bl.pipe(fs.createWriteStream('/tmp/bl_test_rnd_out.dat'))
|
||||||
|
.on('close', function () {
|
||||||
|
var s = fs.createReadStream('/tmp/bl_test_rnd_out.dat')
|
||||||
|
s.on('data', md5sum.update.bind(md5sum))
|
||||||
|
s.on('end', function() {
|
||||||
|
t.equal(rndhash, md5sum.digest('hex'), 'woohoo! correct hash!')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
fs.writeFileSync('/tmp/bl_test_rnd.dat', random)
|
||||||
|
fs.createReadStream('/tmp/bl_test_rnd.dat').pipe(bl)
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('instantiation with Buffer', function (t) {
|
||||||
|
var buf = crypto.randomBytes(1024)
|
||||||
|
, buf2 = crypto.randomBytes(1024)
|
||||||
|
, b = BufferList(buf)
|
||||||
|
|
||||||
|
t.equal(buf.toString('hex'), b.slice().toString('hex'), 'same buffer')
|
||||||
|
b = BufferList([ buf, buf2 ])
|
||||||
|
t.equal(b.slice().toString('hex'), Buffer.concat([ buf, buf2 ]).toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test String appendage', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
, b = Buffer.from('abcdefghij\xff\x00')
|
||||||
|
|
||||||
|
bl.append('abcd')
|
||||||
|
bl.append('efg')
|
||||||
|
bl.append('hi')
|
||||||
|
bl.append('j')
|
||||||
|
bl.append('\xff\x00')
|
||||||
|
|
||||||
|
encodings.forEach(function (enc) {
|
||||||
|
t.equal(bl.toString(enc), b.toString(enc))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test Number appendage', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
, b = Buffer.from('1234567890')
|
||||||
|
|
||||||
|
bl.append(1234)
|
||||||
|
bl.append(567)
|
||||||
|
bl.append(89)
|
||||||
|
bl.append(0)
|
||||||
|
|
||||||
|
encodings.forEach(function (enc) {
|
||||||
|
t.equal(bl.toString(enc), b.toString(enc))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('write nothing, should get empty buffer', function (t) {
|
||||||
|
t.plan(3)
|
||||||
|
BufferList(function (err, data) {
|
||||||
|
t.notOk(err, 'no error')
|
||||||
|
t.ok(Buffer.isBuffer(data), 'got a buffer')
|
||||||
|
t.equal(0, data.length, 'got a zero-length buffer')
|
||||||
|
t.end()
|
||||||
|
}).end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('unicode string', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
var inp1 = '\u2600'
|
||||||
|
, inp2 = '\u2603'
|
||||||
|
, exp = inp1 + ' and ' + inp2
|
||||||
|
, bl = BufferList()
|
||||||
|
bl.write(inp1)
|
||||||
|
bl.write(' and ')
|
||||||
|
bl.write(inp2)
|
||||||
|
t.equal(exp, bl.toString())
|
||||||
|
t.equal(Buffer.from(exp).toString('hex'), bl.toString('hex'))
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('should emit finish', function (t) {
|
||||||
|
var source = BufferList()
|
||||||
|
, dest = BufferList()
|
||||||
|
|
||||||
|
source.write('hello')
|
||||||
|
source.pipe(dest)
|
||||||
|
|
||||||
|
dest.on('finish', function () {
|
||||||
|
t.equal(dest.toString('utf8'), 'hello')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('basic copy', function (t) {
|
||||||
|
var buf = crypto.randomBytes(1024)
|
||||||
|
, buf2 = Buffer.alloc(1024)
|
||||||
|
, b = BufferList(buf)
|
||||||
|
|
||||||
|
b.copy(buf2)
|
||||||
|
t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('copy after many appends', function (t) {
|
||||||
|
var buf = crypto.randomBytes(512)
|
||||||
|
, buf2 = Buffer.alloc(1024)
|
||||||
|
, b = BufferList(buf)
|
||||||
|
|
||||||
|
b.append(buf)
|
||||||
|
b.copy(buf2)
|
||||||
|
t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('copy at a precise position', function (t) {
|
||||||
|
var buf = crypto.randomBytes(1004)
|
||||||
|
, buf2 = Buffer.alloc(1024)
|
||||||
|
, b = BufferList(buf)
|
||||||
|
|
||||||
|
b.copy(buf2, 20)
|
||||||
|
t.equal(b.slice().toString('hex'), buf2.slice(20).toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('copy starting from a precise location', function (t) {
|
||||||
|
var buf = crypto.randomBytes(10)
|
||||||
|
, buf2 = Buffer.alloc(5)
|
||||||
|
, b = BufferList(buf)
|
||||||
|
|
||||||
|
b.copy(buf2, 0, 5)
|
||||||
|
t.equal(b.slice(5).toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('copy in an interval', function (t) {
|
||||||
|
var rnd = crypto.randomBytes(10)
|
||||||
|
, b = BufferList(rnd) // put the random bytes there
|
||||||
|
, actual = Buffer.alloc(3)
|
||||||
|
, expected = Buffer.alloc(3)
|
||||||
|
|
||||||
|
rnd.copy(expected, 0, 5, 8)
|
||||||
|
b.copy(actual, 0, 5, 8)
|
||||||
|
|
||||||
|
t.equal(actual.toString('hex'), expected.toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('copy an interval between two buffers', function (t) {
|
||||||
|
var buf = crypto.randomBytes(10)
|
||||||
|
, buf2 = Buffer.alloc(10)
|
||||||
|
, b = BufferList(buf)
|
||||||
|
|
||||||
|
b.append(buf)
|
||||||
|
b.copy(buf2, 0, 5, 15)
|
||||||
|
|
||||||
|
t.equal(b.slice(5, 15).toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('shallow slice across buffer boundaries', function (t) {
|
||||||
|
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||||
|
|
||||||
|
t.equal(bl.shallowSlice(3, 13).toString(), 'stSecondTh')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('shallow slice within single buffer', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||||
|
|
||||||
|
t.equal(bl.shallowSlice(5, 10).toString(), 'Secon')
|
||||||
|
t.equal(bl.shallowSlice(7, 10).toString(), 'con')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('shallow slice single buffer', function (t) {
|
||||||
|
t.plan(3)
|
||||||
|
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||||
|
|
||||||
|
t.equal(bl.shallowSlice(0, 5).toString(), 'First')
|
||||||
|
t.equal(bl.shallowSlice(5, 11).toString(), 'Second')
|
||||||
|
t.equal(bl.shallowSlice(11, 16).toString(), 'Third')
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('shallow slice with negative or omitted indices', function (t) {
|
||||||
|
t.plan(4)
|
||||||
|
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||||
|
|
||||||
|
t.equal(bl.shallowSlice().toString(), 'FirstSecondThird')
|
||||||
|
t.equal(bl.shallowSlice(5).toString(), 'SecondThird')
|
||||||
|
t.equal(bl.shallowSlice(5, -3).toString(), 'SecondTh')
|
||||||
|
t.equal(bl.shallowSlice(-8).toString(), 'ondThird')
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('shallow slice does not make a copy', function (t) {
|
||||||
|
t.plan(1)
|
||||||
|
var buffers = [Buffer.from('First'), Buffer.from('Second'), Buffer.from('Third')]
|
||||||
|
var bl = (new BufferList(buffers)).shallowSlice(5, -3)
|
||||||
|
|
||||||
|
buffers[1].fill('h')
|
||||||
|
buffers[2].fill('h')
|
||||||
|
|
||||||
|
t.equal(bl.toString(), 'hhhhhhhh')
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('duplicate', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
|
||||||
|
var bl = new BufferList('abcdefghij\xff\x00')
|
||||||
|
, dup = bl.duplicate()
|
||||||
|
|
||||||
|
t.equal(bl.prototype, dup.prototype)
|
||||||
|
t.equal(bl.toString('hex'), dup.toString('hex'))
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('destroy no pipe', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
|
||||||
|
var bl = new BufferList('alsdkfja;lsdkfja;lsdk')
|
||||||
|
bl.destroy()
|
||||||
|
|
||||||
|
t.equal(bl._bufs.length, 0)
|
||||||
|
t.equal(bl.length, 0)
|
||||||
|
})
|
||||||
|
|
||||||
|
!process.browser && tape('destroy with pipe before read end', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
|
||||||
|
var bl = new BufferList()
|
||||||
|
fs.createReadStream(__dirname + '/test.js')
|
||||||
|
.pipe(bl)
|
||||||
|
|
||||||
|
bl.destroy()
|
||||||
|
|
||||||
|
t.equal(bl._bufs.length, 0)
|
||||||
|
t.equal(bl.length, 0)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
!process.browser && tape('destroy with pipe before read end with race', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
|
||||||
|
var bl = new BufferList()
|
||||||
|
fs.createReadStream(__dirname + '/test.js')
|
||||||
|
.pipe(bl)
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
bl.destroy()
|
||||||
|
setTimeout(function () {
|
||||||
|
t.equal(bl._bufs.length, 0)
|
||||||
|
t.equal(bl.length, 0)
|
||||||
|
}, 500)
|
||||||
|
}, 500)
|
||||||
|
})
|
||||||
|
|
||||||
|
!process.browser && tape('destroy with pipe after read end', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
|
||||||
|
var bl = new BufferList()
|
||||||
|
fs.createReadStream(__dirname + '/test.js')
|
||||||
|
.on('end', onEnd)
|
||||||
|
.pipe(bl)
|
||||||
|
|
||||||
|
function onEnd () {
|
||||||
|
bl.destroy()
|
||||||
|
|
||||||
|
t.equal(bl._bufs.length, 0)
|
||||||
|
t.equal(bl.length, 0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
!process.browser && tape('destroy with pipe while writing to a destination', function (t) {
|
||||||
|
t.plan(4)
|
||||||
|
|
||||||
|
var bl = new BufferList()
|
||||||
|
, ds = new BufferList()
|
||||||
|
|
||||||
|
fs.createReadStream(__dirname + '/test.js')
|
||||||
|
.on('end', onEnd)
|
||||||
|
.pipe(bl)
|
||||||
|
|
||||||
|
function onEnd () {
|
||||||
|
bl.pipe(ds)
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
bl.destroy()
|
||||||
|
|
||||||
|
t.equals(bl._bufs.length, 0)
|
||||||
|
t.equals(bl.length, 0)
|
||||||
|
|
||||||
|
ds.destroy()
|
||||||
|
|
||||||
|
t.equals(bl._bufs.length, 0)
|
||||||
|
t.equals(bl.length, 0)
|
||||||
|
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
!process.browser && tape('handle error', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
fs.createReadStream('/does/not/exist').pipe(BufferList(function (err, data) {
|
||||||
|
t.ok(err instanceof Error, 'has error')
|
||||||
|
t.notOk(data, 'no data')
|
||||||
|
}))
|
||||||
|
})
|
17
node_modules/buffer-alloc-unsafe/index.js
generated
vendored
Normal file
17
node_modules/buffer-alloc-unsafe/index.js
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
function allocUnsafe (size) {
|
||||||
|
if (typeof size !== 'number') {
|
||||||
|
throw new TypeError('"size" argument must be a number')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size < 0) {
|
||||||
|
throw new RangeError('"size" argument must not be negative')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Buffer.allocUnsafe) {
|
||||||
|
return Buffer.allocUnsafe(size)
|
||||||
|
} else {
|
||||||
|
return new Buffer(size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = allocUnsafe
|
46
node_modules/buffer-alloc-unsafe/readme.md
generated
vendored
Normal file
46
node_modules/buffer-alloc-unsafe/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# Buffer Alloc Unsafe
|
||||||
|
|
||||||
|
A [ponyfill](https://ponyfill.com) for `Buffer.allocUnsafe`.
|
||||||
|
|
||||||
|
Works as Node.js: `v7.0.0` <br>
|
||||||
|
Works on Node.js: `v0.10.0`
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save buffer-alloc-unsafe
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const allocUnsafe = require('buffer-alloc-unsafe')
|
||||||
|
|
||||||
|
console.log(allocUnsafe(10))
|
||||||
|
//=> <Buffer 78 0c 80 03 01 00 00 00 05 00>
|
||||||
|
|
||||||
|
console.log(allocUnsafe(10))
|
||||||
|
//=> <Buffer 58 ed bf 5f ff 7f 00 00 01 00>
|
||||||
|
|
||||||
|
console.log(allocUnsafe(10))
|
||||||
|
//=> <Buffer 50 0c 80 03 01 00 00 00 0a 00>
|
||||||
|
|
||||||
|
allocUnsafe(-10)
|
||||||
|
//=> RangeError: "size" argument must not be negative
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### allocUnsafe(size)
|
||||||
|
|
||||||
|
- `size` <Integer> The desired length of the new `Buffer`
|
||||||
|
|
||||||
|
Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must be
|
||||||
|
less than or equal to the value of `buffer.kMaxLength` and greater than or equal
|
||||||
|
to zero. Otherwise, a `RangeError` is thrown.
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [buffer-alloc](https://github.com/LinusU/buffer-alloc) A ponyfill for `Buffer.alloc`
|
||||||
|
- [buffer-fill](https://github.com/LinusU/buffer-fill) A ponyfill for `Buffer.fill`
|
||||||
|
- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from`
|
32
node_modules/buffer-alloc/index.js
generated
vendored
Normal file
32
node_modules/buffer-alloc/index.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
var bufferFill = require('buffer-fill')
|
||||||
|
var allocUnsafe = require('buffer-alloc-unsafe')
|
||||||
|
|
||||||
|
module.exports = function alloc (size, fill, encoding) {
|
||||||
|
if (typeof size !== 'number') {
|
||||||
|
throw new TypeError('"size" argument must be a number')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size < 0) {
|
||||||
|
throw new RangeError('"size" argument must not be negative')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Buffer.alloc) {
|
||||||
|
return Buffer.alloc(size, fill, encoding)
|
||||||
|
}
|
||||||
|
|
||||||
|
var buffer = allocUnsafe(size)
|
||||||
|
|
||||||
|
if (size === 0) {
|
||||||
|
return buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fill === undefined) {
|
||||||
|
return bufferFill(buffer, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof encoding !== 'string') {
|
||||||
|
encoding = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
return bufferFill(buffer, fill, encoding)
|
||||||
|
}
|
43
node_modules/buffer-alloc/readme.md
generated
vendored
Normal file
43
node_modules/buffer-alloc/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# Buffer Alloc
|
||||||
|
|
||||||
|
A [ponyfill](https://ponyfill.com) for `Buffer.alloc`.
|
||||||
|
|
||||||
|
Works as Node.js: `v7.0.0` <br>
|
||||||
|
Works on Node.js: `v0.10.0`
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save buffer-alloc
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const alloc = require('buffer-alloc')
|
||||||
|
|
||||||
|
console.log(alloc(4))
|
||||||
|
//=> <Buffer 00 00 00 00>
|
||||||
|
|
||||||
|
console.log(alloc(6, 0x41))
|
||||||
|
//=> <Buffer 41 41 41 41 41 41>
|
||||||
|
|
||||||
|
console.log(alloc(10, 'linus', 'utf8'))
|
||||||
|
//=> <Buffer 6c 69 6e 75 73 6c 69 6e 75 73>
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### alloc(size[, fill[, encoding]])
|
||||||
|
|
||||||
|
- `size` <Integer> The desired length of the new `Buffer`
|
||||||
|
- `fill` <String> | <Buffer> | <Integer> A value to pre-fill the new `Buffer` with. **Default:** `0`
|
||||||
|
- `encoding` <String> If `fill` is a string, this is its encoding. **Default:** `'utf8'`
|
||||||
|
|
||||||
|
Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the `Buffer` will be zero-filled.
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe`
|
||||||
|
- [buffer-fill](https://github.com/LinusU/buffer-fill) A ponyfill for `Buffer.fill`
|
||||||
|
- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from`
|
19
node_modules/buffer-crc32/LICENSE
generated
vendored
Normal file
19
node_modules/buffer-crc32/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
The MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2013 Brian J. Brennan
|
||||||
|
|
||||||
|
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.
|
47
node_modules/buffer-crc32/README.md
generated
vendored
Normal file
47
node_modules/buffer-crc32/README.md
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
# buffer-crc32
|
||||||
|
|
||||||
|
[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32)
|
||||||
|
|
||||||
|
crc32 that works with binary data and fancy character sets, outputs
|
||||||
|
buffer, signed or unsigned data and has tests.
|
||||||
|
|
||||||
|
Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix
|
||||||
|
|
||||||
|
# install
|
||||||
|
```
|
||||||
|
npm install buffer-crc32
|
||||||
|
```
|
||||||
|
|
||||||
|
# example
|
||||||
|
```js
|
||||||
|
var crc32 = require('buffer-crc32');
|
||||||
|
// works with buffers
|
||||||
|
var buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])
|
||||||
|
crc32(buf) // -> <Buffer 94 5a ab 4a>
|
||||||
|
|
||||||
|
// has convenience methods for getting signed or unsigned ints
|
||||||
|
crc32.signed(buf) // -> -1805997238
|
||||||
|
crc32.unsigned(buf) // -> 2488970058
|
||||||
|
|
||||||
|
// will cast to buffer if given a string, so you can
|
||||||
|
// directly use foreign characters safely
|
||||||
|
crc32('自動販売機') // -> <Buffer cb 03 1a c5>
|
||||||
|
|
||||||
|
// and works in append mode too
|
||||||
|
var partialCrc = crc32('hey');
|
||||||
|
var partialCrc = crc32(' ', partialCrc);
|
||||||
|
var partialCrc = crc32('sup', partialCrc);
|
||||||
|
var partialCrc = crc32(' ', partialCrc);
|
||||||
|
var finalCrc = crc32('bros', partialCrc); // -> <Buffer 47 fa 55 70>
|
||||||
|
```
|
||||||
|
|
||||||
|
# tests
|
||||||
|
This was tested against the output of zlib's crc32 method. You can run
|
||||||
|
the tests with`npm test` (requires tap)
|
||||||
|
|
||||||
|
# see also
|
||||||
|
https://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also
|
||||||
|
supports buffer inputs and return unsigned ints (thanks @tjholowaychuk).
|
||||||
|
|
||||||
|
# license
|
||||||
|
MIT/X11
|
111
node_modules/buffer-crc32/index.js
generated
vendored
Normal file
111
node_modules/buffer-crc32/index.js
generated
vendored
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
var Buffer = require('buffer').Buffer;
|
||||||
|
|
||||||
|
var CRC_TABLE = [
|
||||||
|
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
|
||||||
|
0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
|
||||||
|
0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
|
||||||
|
0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
|
||||||
|
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
|
||||||
|
0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
||||||
|
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
|
||||||
|
0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
||||||
|
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
|
||||||
|
0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
|
||||||
|
0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
|
||||||
|
0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
||||||
|
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
|
||||||
|
0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
|
||||||
|
0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
|
||||||
|
0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
||||||
|
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
|
||||||
|
0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
||||||
|
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
|
||||||
|
0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
|
||||||
|
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
|
||||||
|
0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
|
||||||
|
0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
|
||||||
|
0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||||
|
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
|
||||||
|
0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
|
||||||
|
0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
|
||||||
|
0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
|
||||||
|
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
|
||||||
|
0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
||||||
|
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
|
||||||
|
0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
||||||
|
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
|
||||||
|
0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
|
||||||
|
0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
|
||||||
|
0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
||||||
|
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
|
||||||
|
0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
|
||||||
|
0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
|
||||||
|
0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
||||||
|
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
|
||||||
|
0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
||||||
|
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
|
||||||
|
0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
|
||||||
|
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
|
||||||
|
0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
|
||||||
|
0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
|
||||||
|
0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||||
|
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
|
||||||
|
0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
|
||||||
|
0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
|
||||||
|
0x2d02ef8d
|
||||||
|
];
|
||||||
|
|
||||||
|
if (typeof Int32Array !== 'undefined') {
|
||||||
|
CRC_TABLE = new Int32Array(CRC_TABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureBuffer(input) {
|
||||||
|
if (Buffer.isBuffer(input)) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hasNewBufferAPI =
|
||||||
|
typeof Buffer.alloc === "function" &&
|
||||||
|
typeof Buffer.from === "function";
|
||||||
|
|
||||||
|
if (typeof input === "number") {
|
||||||
|
return hasNewBufferAPI ? Buffer.alloc(input) : new Buffer(input);
|
||||||
|
}
|
||||||
|
else if (typeof input === "string") {
|
||||||
|
return hasNewBufferAPI ? Buffer.from(input) : new Buffer(input);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error("input must be buffer, number, or string, received " +
|
||||||
|
typeof input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function bufferizeInt(num) {
|
||||||
|
var tmp = ensureBuffer(4);
|
||||||
|
tmp.writeInt32BE(num, 0);
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _crc32(buf, previous) {
|
||||||
|
buf = ensureBuffer(buf);
|
||||||
|
if (Buffer.isBuffer(previous)) {
|
||||||
|
previous = previous.readUInt32BE(0);
|
||||||
|
}
|
||||||
|
var crc = ~~previous ^ -1;
|
||||||
|
for (var n = 0; n < buf.length; n++) {
|
||||||
|
crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8);
|
||||||
|
}
|
||||||
|
return (crc ^ -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function crc32() {
|
||||||
|
return bufferizeInt(_crc32.apply(null, arguments));
|
||||||
|
}
|
||||||
|
crc32.signed = function () {
|
||||||
|
return _crc32.apply(null, arguments);
|
||||||
|
};
|
||||||
|
crc32.unsigned = function () {
|
||||||
|
return _crc32.apply(null, arguments) >>> 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = crc32;
|
113
node_modules/buffer-fill/index.js
generated
vendored
Normal file
113
node_modules/buffer-fill/index.js
generated
vendored
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
/* Node.js 6.4.0 and up has full support */
|
||||||
|
var hasFullSupport = (function () {
|
||||||
|
try {
|
||||||
|
if (!Buffer.isEncoding('latin1')) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var buf = Buffer.alloc ? Buffer.alloc(4) : new Buffer(4)
|
||||||
|
|
||||||
|
buf.fill('ab', 'ucs2')
|
||||||
|
|
||||||
|
return (buf.toString('hex') === '61006200')
|
||||||
|
} catch (_) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}())
|
||||||
|
|
||||||
|
function isSingleByte (val) {
|
||||||
|
return (val.length === 1 && val.charCodeAt(0) < 256)
|
||||||
|
}
|
||||||
|
|
||||||
|
function fillWithNumber (buffer, val, start, end) {
|
||||||
|
if (start < 0 || end > buffer.length) {
|
||||||
|
throw new RangeError('Out of range index')
|
||||||
|
}
|
||||||
|
|
||||||
|
start = start >>> 0
|
||||||
|
end = end === undefined ? buffer.length : end >>> 0
|
||||||
|
|
||||||
|
if (end > start) {
|
||||||
|
buffer.fill(val, start, end)
|
||||||
|
}
|
||||||
|
|
||||||
|
return buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
function fillWithBuffer (buffer, val, start, end) {
|
||||||
|
if (start < 0 || end > buffer.length) {
|
||||||
|
throw new RangeError('Out of range index')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (end <= start) {
|
||||||
|
return buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
start = start >>> 0
|
||||||
|
end = end === undefined ? buffer.length : end >>> 0
|
||||||
|
|
||||||
|
var pos = start
|
||||||
|
var len = val.length
|
||||||
|
while (pos <= (end - len)) {
|
||||||
|
val.copy(buffer, pos)
|
||||||
|
pos += len
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pos !== end) {
|
||||||
|
val.copy(buffer, pos, 0, end - pos)
|
||||||
|
}
|
||||||
|
|
||||||
|
return buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
function fill (buffer, val, start, end, encoding) {
|
||||||
|
if (hasFullSupport) {
|
||||||
|
return buffer.fill(val, start, end, encoding)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof val === 'number') {
|
||||||
|
return fillWithNumber(buffer, val, start, end)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof val === 'string') {
|
||||||
|
if (typeof start === 'string') {
|
||||||
|
encoding = start
|
||||||
|
start = 0
|
||||||
|
end = buffer.length
|
||||||
|
} else if (typeof end === 'string') {
|
||||||
|
encoding = end
|
||||||
|
end = buffer.length
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encoding !== undefined && typeof encoding !== 'string') {
|
||||||
|
throw new TypeError('encoding must be a string')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encoding === 'latin1') {
|
||||||
|
encoding = 'binary'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
||||||
|
throw new TypeError('Unknown encoding: ' + encoding)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val === '') {
|
||||||
|
return fillWithNumber(buffer, 0, start, end)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSingleByte(val)) {
|
||||||
|
return fillWithNumber(buffer, val.charCodeAt(0), start, end)
|
||||||
|
}
|
||||||
|
|
||||||
|
val = new Buffer(val, encoding)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Buffer.isBuffer(val)) {
|
||||||
|
return fillWithBuffer(buffer, val, start, end)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other values (e.g. undefined, boolean, object) results in zero-fill
|
||||||
|
return fillWithNumber(buffer, 0, start, end)
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = fill
|
54
node_modules/buffer-fill/readme.md
generated
vendored
Normal file
54
node_modules/buffer-fill/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
# Buffer Fill
|
||||||
|
|
||||||
|
A [ponyfill](https://ponyfill.com) for `Buffer.fill`.
|
||||||
|
|
||||||
|
Works as Node.js: `v6.4.0` <br>
|
||||||
|
Works on Node.js: `v0.10.0`
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save buffer-fill
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const fill = require('buffer-fill')
|
||||||
|
const buf = Buffer.allocUnsafe(5)
|
||||||
|
|
||||||
|
console.log(buf.fill(8))
|
||||||
|
//=> <Buffer 08 08 08 08 08>
|
||||||
|
|
||||||
|
console.log(buf.fill(9, 2, 4))
|
||||||
|
//=> <Buffer 08 08 09 09 08>
|
||||||
|
|
||||||
|
console.log(buf.fill('linus', 'latin1'))
|
||||||
|
//=> <Buffer 6c 69 6e 75 73>
|
||||||
|
|
||||||
|
console.log(buf.fill('\u0222'))
|
||||||
|
//=> <Buffer c8 a2 c8 a2 c8>
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### fill(buf, value[, offset[, end]][, encoding])
|
||||||
|
|
||||||
|
- `value` <String> | <Buffer> | <Integer> The value to fill `buf` with
|
||||||
|
- `offset` <Integer> Where to start filling `buf`. **Default:** `0`
|
||||||
|
- `end` <Integer> Where to stop filling `buf` (not inclusive). **Default:** `buf.length`
|
||||||
|
- `encoding` <String> If `value` is a string, this is its encoding. **Default:** `'utf8'`
|
||||||
|
- Return: <Buffer> A reference to `buf`
|
||||||
|
|
||||||
|
Fills `buf` with the specified `value`. If the `offset` and `end` are not given,
|
||||||
|
the entire `buf` will be filled. This is meant to be a small simplification to
|
||||||
|
allow the creation and filling of a `Buffer` to be done on a single line.
|
||||||
|
|
||||||
|
If the final write of a `fill()` operation falls on a multi-byte character, then
|
||||||
|
only the first bytes of that character that fit into `buf` are written.
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe`
|
||||||
|
- [buffer-alloc](https://github.com/LinusU/buffer-alloc) A ponyfill for `Buffer.alloc`
|
||||||
|
- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from`
|
1
node_modules/buffer/.npmignore
generated
vendored
Normal file
1
node_modules/buffer/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
perf/
|
8
node_modules/buffer/.travis.yml
generated
vendored
Normal file
8
node_modules/buffer/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- '4'
|
||||||
|
sudo: false
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
- secure: AUsK+8fYSpwIMHcVt8Mu9SpG9RPHp4XDAwCQfpU3d5U65q8OVVC6C+XjvnNmEd2PoEJRHem8ZXEyRVfGM1sttKZLZP70TEKZOpOiRQnZiTQCAJ92TfGsDj/F4LoWSjUZUpfeg9b3iSp8G5dVw3+q9QZPIu6eykASK6bfcg//Cyg=
|
||||||
|
- secure: eQBKJWu7XbhAN4ZvOOhMenC0IPpoYj+wZVVzzsLwUppfJqlrHV0CUW8rJdvZNiaGhYhoyHTnAcynpTE5kZfg3XjevOvF8PGY5wUYCki9BI+rp+pvVPZE/DNUAQpFR2gd2nxMJ4kYv7GVb6i/DfuqJa0h8IuY4zcMuKWwbQd3Az8=
|
22
node_modules/buffer/.zuul.yml
generated
vendored
Normal file
22
node_modules/buffer/.zuul.yml
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
ui: tape
|
||||||
|
scripts:
|
||||||
|
- "./test/_polyfill.js"
|
||||||
|
browsers:
|
||||||
|
- name: chrome
|
||||||
|
version: -2..latest
|
||||||
|
- name: firefox
|
||||||
|
version: -2..latest
|
||||||
|
- name: safari
|
||||||
|
version: [6, 7, 8, 9..latest]
|
||||||
|
- name: ie
|
||||||
|
version: 8..latest
|
||||||
|
- name: microsoftedge
|
||||||
|
version: 20..latest
|
||||||
|
- name: opera
|
||||||
|
version: 11..latest
|
||||||
|
- name: iphone
|
||||||
|
version: [5.1, 6.1, 7.1, 8.4, 9.1..latest]
|
||||||
|
- name: ipad
|
||||||
|
version: [5.1, 6.1, 7.1, 8.4, 9.1..latest]
|
||||||
|
- name: android
|
||||||
|
version: 4.0..latest
|
21
node_modules/buffer/LICENSE
generated
vendored
Normal file
21
node_modules/buffer/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) Feross Aboukhadijeh, and other contributors.
|
||||||
|
|
||||||
|
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.
|
364
node_modules/buffer/README.md
generated
vendored
Normal file
364
node_modules/buffer/README.md
generated
vendored
Normal file
|
@ -0,0 +1,364 @@
|
||||||
|
# buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][npm-url]
|
||||||
|
|
||||||
|
#### The buffer module from [node.js](http://nodejs.org/), for the browser.
|
||||||
|
|
||||||
|
[![saucelabs][saucelabs-image]][saucelabs-url]
|
||||||
|
|
||||||
|
[travis-image]: https://img.shields.io/travis/feross/buffer.svg?style=flat
|
||||||
|
[travis-url]: https://travis-ci.org/feross/buffer
|
||||||
|
[npm-image]: https://img.shields.io/npm/v/buffer.svg?style=flat
|
||||||
|
[npm-url]: https://npmjs.org/package/buffer
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/buffer.svg?style=flat
|
||||||
|
[saucelabs-image]: https://saucelabs.com/browser-matrix/buffer.svg
|
||||||
|
[saucelabs-url]: https://saucelabs.com/u/buffer
|
||||||
|
|
||||||
|
With [browserify](http://browserify.org), simply `require('buffer')` or use the `Buffer` global and you will get this module.
|
||||||
|
|
||||||
|
The goal is to provide an API that is 100% identical to
|
||||||
|
[node's Buffer API](http://iojs.org/api/buffer.html). Read the
|
||||||
|
[official docs](http://iojs.org/api/buffer.html) for the full list of properties,
|
||||||
|
instance methods, and class methods that are supported.
|
||||||
|
|
||||||
|
## features
|
||||||
|
|
||||||
|
- Manipulate binary data like a boss, in all browsers -- even IE6!
|
||||||
|
- Super fast. Backed by Typed Arrays (`Uint8Array`/`ArrayBuffer`, not `Object`)
|
||||||
|
- Extremely small bundle size (**5.04KB minified + gzipped**, 35.5KB with comments)
|
||||||
|
- Excellent browser support (IE 6+, Chrome 4+, Firefox 3+, Safari 5.1+, Opera 11+, iOS, etc.)
|
||||||
|
- Preserves Node API exactly, with one important difference (see below)
|
||||||
|
- `.slice()` returns instances of the same type (Buffer)
|
||||||
|
- Square-bracket `buf[4]` notation works, even in old browsers like IE6!
|
||||||
|
- Does not modify any browser prototypes or put anything on `window`
|
||||||
|
- Comprehensive test suite (including all buffer tests from node.js core)
|
||||||
|
|
||||||
|
|
||||||
|
## install
|
||||||
|
|
||||||
|
To use this module directly (without browserify), install it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install buffer
|
||||||
|
```
|
||||||
|
|
||||||
|
This module was previously called **native-buffer-browserify**, but please use **buffer**
|
||||||
|
from now on.
|
||||||
|
|
||||||
|
A standalone bundle is available [here](https://wzrd.in/standalone/buffer), for non-browserify users.
|
||||||
|
|
||||||
|
|
||||||
|
## usage
|
||||||
|
|
||||||
|
The module's API is identical to node's `Buffer` API. Read the
|
||||||
|
[official docs](http://iojs.org/api/buffer.html) for the full list of properties,
|
||||||
|
instance methods, and class methods that are supported.
|
||||||
|
|
||||||
|
As mentioned above, `require('buffer')` or use the `Buffer` global with
|
||||||
|
[browserify](http://browserify.org) and this module will automatically be included
|
||||||
|
in your bundle. Almost any npm module will work in the browser, even if it assumes that
|
||||||
|
the node `Buffer` API will be available.
|
||||||
|
|
||||||
|
To depend on this module explicitly (without browserify), require it like this:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var Buffer = require('buffer/').Buffer // note: the trailing slash is important!
|
||||||
|
```
|
||||||
|
|
||||||
|
To require this module explicitly, use `require('buffer/')` which tells the node.js module
|
||||||
|
lookup algorithm (also used by browserify) to use the **npm module** named `buffer`
|
||||||
|
instead of the **node.js core** module named `buffer`!
|
||||||
|
|
||||||
|
|
||||||
|
## how does it work?
|
||||||
|
|
||||||
|
`Buffer` is a subclass of `Uint8Array` augmented with all the `Buffer` API methods.
|
||||||
|
The `Uint8Array` prototype is not modified.
|
||||||
|
|
||||||
|
|
||||||
|
## one minor difference
|
||||||
|
|
||||||
|
#### In old browsers, `buf.slice()` does not modify parent buffer's memory
|
||||||
|
|
||||||
|
If you only support modern browsers (specifically, those with typed array support),
|
||||||
|
then this issue does not affect you. If you support super old browsers, then read on.
|
||||||
|
|
||||||
|
In node, the `slice()` method returns a new `Buffer` that shares underlying memory
|
||||||
|
with the original Buffer. When you modify one buffer, you modify the other.
|
||||||
|
[Read more.](http://iojs.org/api/buffer.html#buffer_buf_slice_start_end)
|
||||||
|
|
||||||
|
In browsers with typed array support, this `Buffer` implementation supports this
|
||||||
|
behavior. In browsers without typed arrays, an alternate buffer implementation is
|
||||||
|
used that is based on `Object` which has no mechanism to point separate
|
||||||
|
`Buffer`s to the same underlying slab of memory.
|
||||||
|
|
||||||
|
You can see which browser versions lack typed array support
|
||||||
|
[here](https://github.com/feross/buffer/blob/master/index.js#L20-L46).
|
||||||
|
|
||||||
|
|
||||||
|
## tracking the latest node api
|
||||||
|
|
||||||
|
This module tracks the Buffer API in the latest (unstable) version of node.js. The Buffer
|
||||||
|
API is considered **stable** in the
|
||||||
|
[node stability index](http://nodejs.org/docs/latest/api/documentation.html#documentation_stability_index),
|
||||||
|
so it is unlikely that there will ever be breaking changes.
|
||||||
|
Nonetheless, when/if the Buffer API changes in node, this module's API will change
|
||||||
|
accordingly.
|
||||||
|
|
||||||
|
## performance
|
||||||
|
|
||||||
|
See perf tests in `/perf`.
|
||||||
|
|
||||||
|
`BrowserBuffer` is the browser `buffer` module (this repo). `Uint8Array` is included as a
|
||||||
|
sanity check (since `BrowserBuffer` uses `Uint8Array` under the hood, `Uint8Array` will
|
||||||
|
always be at least a bit faster). Finally, `NodeBuffer` is the node.js buffer module,
|
||||||
|
which is included to compare against.
|
||||||
|
|
||||||
|
### Chrome 38
|
||||||
|
|
||||||
|
| Method | Operations | Accuracy | Sampled | Fastest |
|
||||||
|
|:-------|:-----------|:---------|:--------|:-------:|
|
||||||
|
| BrowserBuffer#bracket-notation | 11,457,464 ops/sec | ±0.86% | 66 | ✓ |
|
||||||
|
| Uint8Array#bracket-notation | 10,824,332 ops/sec | ±0.74% | 65 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#concat | 450,532 ops/sec | ±0.76% | 68 | |
|
||||||
|
| Uint8Array#concat | 1,368,911 ops/sec | ±1.50% | 62 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#copy(16000) | 903,001 ops/sec | ±0.96% | 67 | |
|
||||||
|
| Uint8Array#copy(16000) | 1,422,441 ops/sec | ±1.04% | 66 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#copy(16) | 11,431,358 ops/sec | ±0.46% | 69 | |
|
||||||
|
| Uint8Array#copy(16) | 13,944,163 ops/sec | ±1.12% | 68 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#new(16000) | 106,329 ops/sec | ±6.70% | 44 | |
|
||||||
|
| Uint8Array#new(16000) | 131,001 ops/sec | ±2.85% | 31 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#new(16) | 1,554,491 ops/sec | ±1.60% | 65 | |
|
||||||
|
| Uint8Array#new(16) | 6,623,930 ops/sec | ±1.66% | 65 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readDoubleBE | 112,830 ops/sec | ±0.51% | 69 | ✓ |
|
||||||
|
| DataView#getFloat64 | 93,500 ops/sec | ±0.57% | 68 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readFloatBE | 146,678 ops/sec | ±0.95% | 68 | ✓ |
|
||||||
|
| DataView#getFloat32 | 99,311 ops/sec | ±0.41% | 67 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readUInt32LE | 843,214 ops/sec | ±0.70% | 69 | ✓ |
|
||||||
|
| DataView#getUint32 | 103,024 ops/sec | ±0.64% | 67 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#slice | 1,013,941 ops/sec | ±0.75% | 67 | |
|
||||||
|
| Uint8Array#subarray | 1,903,928 ops/sec | ±0.53% | 67 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#writeFloatBE | 61,387 ops/sec | ±0.90% | 67 | |
|
||||||
|
| DataView#setFloat32 | 141,249 ops/sec | ±0.40% | 66 | ✓ |
|
||||||
|
|
||||||
|
|
||||||
|
### Firefox 33
|
||||||
|
|
||||||
|
| Method | Operations | Accuracy | Sampled | Fastest |
|
||||||
|
|:-------|:-----------|:---------|:--------|:-------:|
|
||||||
|
| BrowserBuffer#bracket-notation | 20,800,421 ops/sec | ±1.84% | 60 | |
|
||||||
|
| Uint8Array#bracket-notation | 20,826,235 ops/sec | ±2.02% | 61 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#concat | 153,076 ops/sec | ±2.32% | 61 | |
|
||||||
|
| Uint8Array#concat | 1,255,674 ops/sec | ±8.65% | 52 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#copy(16000) | 1,105,312 ops/sec | ±1.16% | 63 | |
|
||||||
|
| Uint8Array#copy(16000) | 1,615,911 ops/sec | ±0.55% | 66 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#copy(16) | 16,357,599 ops/sec | ±0.73% | 68 | |
|
||||||
|
| Uint8Array#copy(16) | 31,436,281 ops/sec | ±1.05% | 68 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#new(16000) | 52,995 ops/sec | ±6.01% | 35 | |
|
||||||
|
| Uint8Array#new(16000) | 87,686 ops/sec | ±5.68% | 45 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#new(16) | 252,031 ops/sec | ±1.61% | 66 | |
|
||||||
|
| Uint8Array#new(16) | 8,477,026 ops/sec | ±0.49% | 68 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readDoubleBE | 99,871 ops/sec | ±0.41% | 69 | |
|
||||||
|
| DataView#getFloat64 | 285,663 ops/sec | ±0.70% | 68 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readFloatBE | 115,540 ops/sec | ±0.42% | 69 | |
|
||||||
|
| DataView#getFloat32 | 288,722 ops/sec | ±0.82% | 68 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readUInt32LE | 633,926 ops/sec | ±1.08% | 67 | ✓ |
|
||||||
|
| DataView#getUint32 | 294,808 ops/sec | ±0.79% | 64 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#slice | 349,425 ops/sec | ±0.46% | 69 | |
|
||||||
|
| Uint8Array#subarray | 5,965,819 ops/sec | ±0.60% | 65 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#writeFloatBE | 59,980 ops/sec | ±0.41% | 67 | |
|
||||||
|
| DataView#setFloat32 | 317,634 ops/sec | ±0.63% | 68 | ✓ |
|
||||||
|
|
||||||
|
### Safari 8
|
||||||
|
|
||||||
|
| Method | Operations | Accuracy | Sampled | Fastest |
|
||||||
|
|:-------|:-----------|:---------|:--------|:-------:|
|
||||||
|
| BrowserBuffer#bracket-notation | 10,279,729 ops/sec | ±2.25% | 56 | ✓ |
|
||||||
|
| Uint8Array#bracket-notation | 10,030,767 ops/sec | ±2.23% | 59 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#concat | 144,138 ops/sec | ±1.38% | 65 | |
|
||||||
|
| Uint8Array#concat | 4,950,764 ops/sec | ±1.70% | 63 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#copy(16000) | 1,058,548 ops/sec | ±1.51% | 64 | |
|
||||||
|
| Uint8Array#copy(16000) | 1,409,666 ops/sec | ±1.17% | 65 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#copy(16) | 6,282,529 ops/sec | ±1.88% | 58 | |
|
||||||
|
| Uint8Array#copy(16) | 11,907,128 ops/sec | ±2.87% | 58 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#new(16000) | 101,663 ops/sec | ±3.89% | 57 | |
|
||||||
|
| Uint8Array#new(16000) | 22,050,818 ops/sec | ±6.51% | 46 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#new(16) | 176,072 ops/sec | ±2.13% | 64 | |
|
||||||
|
| Uint8Array#new(16) | 24,385,731 ops/sec | ±5.01% | 51 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readDoubleBE | 41,341 ops/sec | ±1.06% | 67 | |
|
||||||
|
| DataView#getFloat64 | 322,280 ops/sec | ±0.84% | 68 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readFloatBE | 46,141 ops/sec | ±1.06% | 65 | |
|
||||||
|
| DataView#getFloat32 | 337,025 ops/sec | ±0.43% | 69 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readUInt32LE | 151,551 ops/sec | ±1.02% | 66 | |
|
||||||
|
| DataView#getUint32 | 308,278 ops/sec | ±0.94% | 67 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#slice | 197,365 ops/sec | ±0.95% | 66 | |
|
||||||
|
| Uint8Array#subarray | 9,558,024 ops/sec | ±3.08% | 58 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#writeFloatBE | 17,518 ops/sec | ±1.03% | 63 | |
|
||||||
|
| DataView#setFloat32 | 319,751 ops/sec | ±0.48% | 68 | ✓ |
|
||||||
|
|
||||||
|
|
||||||
|
### Node 0.11.14
|
||||||
|
|
||||||
|
| Method | Operations | Accuracy | Sampled | Fastest |
|
||||||
|
|:-------|:-----------|:---------|:--------|:-------:|
|
||||||
|
| BrowserBuffer#bracket-notation | 10,489,828 ops/sec | ±3.25% | 90 | |
|
||||||
|
| Uint8Array#bracket-notation | 10,534,884 ops/sec | ±0.81% | 92 | ✓ |
|
||||||
|
| NodeBuffer#bracket-notation | 10,389,910 ops/sec | ±0.97% | 87 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#concat | 487,830 ops/sec | ±2.58% | 88 | |
|
||||||
|
| Uint8Array#concat | 1,814,327 ops/sec | ±1.28% | 88 | ✓ |
|
||||||
|
| NodeBuffer#concat | 1,636,523 ops/sec | ±1.88% | 73 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#copy(16000) | 1,073,665 ops/sec | ±0.77% | 90 | |
|
||||||
|
| Uint8Array#copy(16000) | 1,348,517 ops/sec | ±0.84% | 89 | ✓ |
|
||||||
|
| NodeBuffer#copy(16000) | 1,289,533 ops/sec | ±0.82% | 93 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#copy(16) | 12,782,706 ops/sec | ±0.74% | 85 | |
|
||||||
|
| Uint8Array#copy(16) | 14,180,427 ops/sec | ±0.93% | 92 | ✓ |
|
||||||
|
| NodeBuffer#copy(16) | 11,083,134 ops/sec | ±1.06% | 89 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#new(16000) | 141,678 ops/sec | ±3.30% | 67 | |
|
||||||
|
| Uint8Array#new(16000) | 161,491 ops/sec | ±2.96% | 60 | |
|
||||||
|
| NodeBuffer#new(16000) | 292,699 ops/sec | ±3.20% | 55 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#new(16) | 1,655,466 ops/sec | ±2.41% | 82 | |
|
||||||
|
| Uint8Array#new(16) | 14,399,926 ops/sec | ±0.91% | 94 | ✓ |
|
||||||
|
| NodeBuffer#new(16) | 3,894,696 ops/sec | ±0.88% | 92 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readDoubleBE | 109,582 ops/sec | ±0.75% | 93 | ✓ |
|
||||||
|
| DataView#getFloat64 | 91,235 ops/sec | ±0.81% | 90 | |
|
||||||
|
| NodeBuffer#readDoubleBE | 88,593 ops/sec | ±0.96% | 81 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readFloatBE | 139,854 ops/sec | ±1.03% | 85 | ✓ |
|
||||||
|
| DataView#getFloat32 | 98,744 ops/sec | ±0.80% | 89 | |
|
||||||
|
| NodeBuffer#readFloatBE | 92,769 ops/sec | ±0.94% | 93 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readUInt32LE | 710,861 ops/sec | ±0.82% | 92 | |
|
||||||
|
| DataView#getUint32 | 117,893 ops/sec | ±0.84% | 91 | |
|
||||||
|
| NodeBuffer#readUInt32LE | 851,412 ops/sec | ±0.72% | 93 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#slice | 1,673,877 ops/sec | ±0.73% | 94 | |
|
||||||
|
| Uint8Array#subarray | 6,919,243 ops/sec | ±0.67% | 90 | ✓ |
|
||||||
|
| NodeBuffer#slice | 4,617,604 ops/sec | ±0.79% | 93 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#writeFloatBE | 66,011 ops/sec | ±0.75% | 93 | |
|
||||||
|
| DataView#setFloat32 | 127,760 ops/sec | ±0.72% | 93 | ✓ |
|
||||||
|
| NodeBuffer#writeFloatBE | 103,352 ops/sec | ±0.83% | 93 | |
|
||||||
|
|
||||||
|
### iojs 1.8.1
|
||||||
|
|
||||||
|
| Method | Operations | Accuracy | Sampled | Fastest |
|
||||||
|
|:-------|:-----------|:---------|:--------|:-------:|
|
||||||
|
| BrowserBuffer#bracket-notation | 10,990,488 ops/sec | ±1.11% | 91 | |
|
||||||
|
| Uint8Array#bracket-notation | 11,268,757 ops/sec | ±0.65% | 97 | |
|
||||||
|
| NodeBuffer#bracket-notation | 11,353,260 ops/sec | ±0.83% | 94 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#concat | 378,954 ops/sec | ±0.74% | 94 | |
|
||||||
|
| Uint8Array#concat | 1,358,288 ops/sec | ±0.97% | 87 | |
|
||||||
|
| NodeBuffer#concat | 1,934,050 ops/sec | ±1.11% | 78 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#copy(16000) | 894,538 ops/sec | ±0.56% | 84 | |
|
||||||
|
| Uint8Array#copy(16000) | 1,442,656 ops/sec | ±0.71% | 96 | |
|
||||||
|
| NodeBuffer#copy(16000) | 1,457,898 ops/sec | ±0.53% | 92 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#copy(16) | 12,870,457 ops/sec | ±0.67% | 95 | |
|
||||||
|
| Uint8Array#copy(16) | 16,643,989 ops/sec | ±0.61% | 93 | ✓ |
|
||||||
|
| NodeBuffer#copy(16) | 14,885,848 ops/sec | ±0.74% | 94 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#new(16000) | 109,264 ops/sec | ±4.21% | 63 | |
|
||||||
|
| Uint8Array#new(16000) | 138,916 ops/sec | ±1.87% | 61 | |
|
||||||
|
| NodeBuffer#new(16000) | 281,449 ops/sec | ±3.58% | 51 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#new(16) | 1,362,935 ops/sec | ±0.56% | 99 | |
|
||||||
|
| Uint8Array#new(16) | 6,193,090 ops/sec | ±0.64% | 95 | ✓ |
|
||||||
|
| NodeBuffer#new(16) | 4,745,425 ops/sec | ±1.56% | 90 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readDoubleBE | 118,127 ops/sec | ±0.59% | 93 | ✓ |
|
||||||
|
| DataView#getFloat64 | 107,332 ops/sec | ±0.65% | 91 | |
|
||||||
|
| NodeBuffer#readDoubleBE | 116,274 ops/sec | ±0.94% | 95 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readFloatBE | 150,326 ops/sec | ±0.58% | 95 | ✓ |
|
||||||
|
| DataView#getFloat32 | 110,541 ops/sec | ±0.57% | 98 | |
|
||||||
|
| NodeBuffer#readFloatBE | 121,599 ops/sec | ±0.60% | 87 | |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#readUInt32LE | 814,147 ops/sec | ±0.62% | 93 | |
|
||||||
|
| DataView#getUint32 | 137,592 ops/sec | ±0.64% | 90 | |
|
||||||
|
| NodeBuffer#readUInt32LE | 931,650 ops/sec | ±0.71% | 96 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#slice | 878,590 ops/sec | ±0.68% | 93 | |
|
||||||
|
| Uint8Array#subarray | 2,843,308 ops/sec | ±1.02% | 90 | |
|
||||||
|
| NodeBuffer#slice | 4,998,316 ops/sec | ±0.68% | 90 | ✓ |
|
||||||
|
| | | | |
|
||||||
|
| BrowserBuffer#writeFloatBE | 65,927 ops/sec | ±0.74% | 93 | |
|
||||||
|
| DataView#setFloat32 | 139,823 ops/sec | ±0.97% | 89 | ✓ |
|
||||||
|
| NodeBuffer#writeFloatBE | 135,763 ops/sec | ±0.65% | 96 | |
|
||||||
|
| | | | |
|
||||||
|
|
||||||
|
## Testing the project
|
||||||
|
|
||||||
|
First, install the project:
|
||||||
|
|
||||||
|
npm install
|
||||||
|
|
||||||
|
Then, to run tests in Node.js, run:
|
||||||
|
|
||||||
|
npm run test-node
|
||||||
|
|
||||||
|
To test locally in a browser, you can run:
|
||||||
|
|
||||||
|
npm run test-browser-local
|
||||||
|
|
||||||
|
This will print out a URL that you can then open in a browser to run the tests, using [Zuul](https://github.com/defunctzombie/zuul).
|
||||||
|
|
||||||
|
To run automated browser tests using Saucelabs, ensure that your `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables are set, then run:
|
||||||
|
|
||||||
|
npm test
|
||||||
|
|
||||||
|
This is what's run in Travis, to check against various browsers. The list of browsers is kept in the `.zuul.yml` file.
|
||||||
|
|
||||||
|
## JavaScript Standard Style
|
||||||
|
|
||||||
|
This module uses [JavaScript Standard Style](https://github.com/feross/standard).
|
||||||
|
|
||||||
|
[![js-standard-style](https://raw.githubusercontent.com/feross/standard/master/badge.png)](https://github.com/feross/standard)
|
||||||
|
|
||||||
|
To test that the code conforms to the style, `npm install` and run:
|
||||||
|
|
||||||
|
./node_modules/.bin/standard
|
||||||
|
|
||||||
|
## credit
|
||||||
|
|
||||||
|
This was originally forked from [buffer-browserify](https://github.com/toots/buffer-browserify).
|
||||||
|
|
||||||
|
|
||||||
|
## license
|
||||||
|
|
||||||
|
MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org), and other contributors. Originally forked from an MIT-licensed module by Romain Beauxis.
|
126
node_modules/buffer/bin/download-node-tests.js
generated
vendored
Executable file
126
node_modules/buffer/bin/download-node-tests.js
generated
vendored
Executable file
|
@ -0,0 +1,126 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
var concat = require('concat-stream')
|
||||||
|
var fs = require('fs')
|
||||||
|
var hyperquest = require('hyperquest')
|
||||||
|
var cp = require('child_process')
|
||||||
|
var split = require('split')
|
||||||
|
var through = require('through2')
|
||||||
|
|
||||||
|
var url = 'https://api.github.com/repos/nodejs/io.js/contents'
|
||||||
|
var dirs = [
|
||||||
|
'/test/parallel',
|
||||||
|
'/test/pummel'
|
||||||
|
]
|
||||||
|
|
||||||
|
cp.execSync('rm -rf node/*.js', { cwd: __dirname + '/../test' })
|
||||||
|
cp.execSync('rm -rf node-es6/*.js', { cwd: __dirname + '/../test' })
|
||||||
|
|
||||||
|
var httpOpts = {
|
||||||
|
headers: {
|
||||||
|
'User-Agent': null
|
||||||
|
// auth if github rate-limits you...
|
||||||
|
// 'Authorization': 'Basic ' + Buffer('username:password').toString('base64'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dirs.forEach(function (dir) {
|
||||||
|
var req = hyperquest(url + dir, httpOpts)
|
||||||
|
req.pipe(concat(function (data) {
|
||||||
|
if (req.response.statusCode !== 200) {
|
||||||
|
throw new Error(url + dir + ': ' + data.toString())
|
||||||
|
}
|
||||||
|
downloadBufferTests(dir, JSON.parse(data))
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
|
function downloadBufferTests (dir, files) {
|
||||||
|
files.forEach(function (file) {
|
||||||
|
if (!/test-buffer.*/.test(file.name)) return
|
||||||
|
|
||||||
|
var path
|
||||||
|
if (file.name === 'test-buffer-iterator.js' ||
|
||||||
|
file.name === 'test-buffer-arraybuffer.js') {
|
||||||
|
path = __dirname + '/../test/node-es6/' + file.name
|
||||||
|
} else if (file.name === 'test-buffer-fakes.js') {
|
||||||
|
// These teses only apply to node, where they're calling into C++ and need to
|
||||||
|
// ensure the prototype can't be faked, or else there will be a segfault.
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
path = __dirname + '/../test/node/' + file.name
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(file.download_url)
|
||||||
|
hyperquest(file.download_url, httpOpts)
|
||||||
|
.pipe(split())
|
||||||
|
.pipe(testfixer(file.name))
|
||||||
|
.pipe(fs.createWriteStream(path))
|
||||||
|
.on('finish', function () {
|
||||||
|
console.log('wrote ' + file.name)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function testfixer (filename) {
|
||||||
|
var firstline = true
|
||||||
|
|
||||||
|
return through(function (line, enc, cb) {
|
||||||
|
line = line.toString()
|
||||||
|
|
||||||
|
if (firstline) {
|
||||||
|
// require buffer explicitly
|
||||||
|
var preamble = 'if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;\n' +
|
||||||
|
'var Buffer = require(\'../../\').Buffer;'
|
||||||
|
if (/use strict/.test(line)) line += '\n' + preamble
|
||||||
|
else line + preamble + '\n' + line
|
||||||
|
firstline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// use `var` instead of `const`/`let`
|
||||||
|
line = line.replace(/(const|let) /g, 'var ')
|
||||||
|
|
||||||
|
// make `require('common')` work
|
||||||
|
line = line.replace(/(var common = require.*)/g, 'var common = {};')
|
||||||
|
|
||||||
|
// use `Buffer.isBuffer` instead of `instanceof Buffer`
|
||||||
|
line = line.replace(/buf instanceof Buffer/g, 'Buffer.isBuffer(buf)')
|
||||||
|
|
||||||
|
// require browser buffer
|
||||||
|
line = line.replace(/(.*)require\('buffer'\)(.*)/g, '$1require(\'../../\')$2')
|
||||||
|
|
||||||
|
// smalloc is only used for kMaxLength
|
||||||
|
line = line.replace(
|
||||||
|
/require\('smalloc'\)/g,
|
||||||
|
'{ kMaxLength: process.env.OBJECT_IMPL ? 0x3fffffff : 0x7fffffff }'
|
||||||
|
)
|
||||||
|
|
||||||
|
// comment out console logs
|
||||||
|
line = line.replace(/(.*console\..*)/g, '// $1')
|
||||||
|
|
||||||
|
// we can't reliably test typed array max-sizes in the browser
|
||||||
|
if (filename === 'test-buffer-big.js') {
|
||||||
|
line = line.replace(/(.*new Int8Array.*RangeError.*)/, '// $1')
|
||||||
|
line = line.replace(/(.*new ArrayBuffer.*RangeError.*)/, '// $1')
|
||||||
|
line = line.replace(/(.*new Float64Array.*RangeError.*)/, '// $1')
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://github.com/iojs/io.js/blob/v0.12/test/parallel/test-buffer.js#L38
|
||||||
|
// we can't run this because we need to support
|
||||||
|
// browsers that don't have typed arrays
|
||||||
|
if (filename === 'test-buffer.js') {
|
||||||
|
line = line.replace(/b\[0\] = -1;/, 'b[0] = 255;')
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://github.com/iojs/io.js/blob/v0.12/test/parallel/test-buffer.js#L1138
|
||||||
|
// unfortunately we can't run this as it touches
|
||||||
|
// node streams which do an instanceof check
|
||||||
|
// and crypto-browserify doesn't work in old
|
||||||
|
// versions of ie
|
||||||
|
if (filename === 'test-buffer.js') {
|
||||||
|
line = line.replace(/^(\s*)(var crypto = require.*)/, '$1// $2')
|
||||||
|
line = line.replace(/(crypto.createHash.*\))/, '1 /*$1*/')
|
||||||
|
}
|
||||||
|
|
||||||
|
cb(null, line + '\n')
|
||||||
|
})
|
||||||
|
}
|
18
node_modules/buffer/bin/test.js
generated
vendored
Normal file
18
node_modules/buffer/bin/test.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
var cp = require('child_process')
|
||||||
|
|
||||||
|
var runBrowserTests = !process.env.TRAVIS_PULL_REQUEST ||
|
||||||
|
process.env.TRAVIS_PULL_REQUEST === 'false'
|
||||||
|
|
||||||
|
var node = cp.spawn('npm', ['run', 'test-node'], { stdio: 'inherit' })
|
||||||
|
node.on('close', function (code) {
|
||||||
|
if (code === 0 && runBrowserTests) {
|
||||||
|
var browser = cp.spawn('npm', ['run', 'test-browser'], { stdio: 'inherit' })
|
||||||
|
browser.on('close', function (code) {
|
||||||
|
process.exit(code)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
process.exit(code)
|
||||||
|
}
|
||||||
|
})
|
1548
node_modules/buffer/index.js
generated
vendored
Normal file
1548
node_modules/buffer/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
150
node_modules/buffer/test/_polyfill.js
generated
vendored
Normal file
150
node_modules/buffer/test/_polyfill.js
generated
vendored
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
if (!Array.prototype.forEach) {
|
||||||
|
|
||||||
|
Array.prototype.forEach = function(callback, thisArg) {
|
||||||
|
|
||||||
|
var T, k;
|
||||||
|
|
||||||
|
if (this == null) {
|
||||||
|
throw new TypeError(' this is null or not defined');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. Let O be the result of calling ToObject passing the |this| value as the argument.
|
||||||
|
var O = Object(this);
|
||||||
|
|
||||||
|
// 2. Let lenValue be the result of calling the Get internal method of O with the argument "length".
|
||||||
|
// 3. Let len be ToUint32(lenValue).
|
||||||
|
var len = O.length >>> 0;
|
||||||
|
|
||||||
|
// 4. If IsCallable(callback) is false, throw a TypeError exception.
|
||||||
|
// See: http://es5.github.com/#x9.11
|
||||||
|
if (typeof callback !== "function") {
|
||||||
|
throw new TypeError(callback + ' is not a function');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
||||||
|
if (arguments.length > 1) {
|
||||||
|
T = thisArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. Let k be 0
|
||||||
|
k = 0;
|
||||||
|
|
||||||
|
// 7. Repeat, while k < len
|
||||||
|
while (k < len) {
|
||||||
|
|
||||||
|
var kValue;
|
||||||
|
|
||||||
|
// a. Let Pk be ToString(k).
|
||||||
|
// This is implicit for LHS operands of the in operator
|
||||||
|
// b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.
|
||||||
|
// This step can be combined with c
|
||||||
|
// c. If kPresent is true, then
|
||||||
|
if (k in O) {
|
||||||
|
|
||||||
|
// i. Let kValue be the result of calling the Get internal method of O with argument Pk.
|
||||||
|
kValue = O[k];
|
||||||
|
|
||||||
|
// ii. Call the Call internal method of callback with T as the this value and
|
||||||
|
// argument list containing kValue, k, and O.
|
||||||
|
callback.call(T, kValue, k, O);
|
||||||
|
}
|
||||||
|
// d. Increase k by 1.
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
// 8. return undefined
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Array.isArray) {
|
||||||
|
Array.isArray = function(arg) {
|
||||||
|
return Object.prototype.toString.call(arg) === '[object Array]';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Array.prototype.map) {
|
||||||
|
|
||||||
|
Array.prototype.map = function(callback, thisArg) {
|
||||||
|
|
||||||
|
var T, A, k;
|
||||||
|
|
||||||
|
if (this == null) {
|
||||||
|
throw new TypeError(' this is null or not defined');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. Let O be the result of calling ToObject passing the |this|
|
||||||
|
// value as the argument.
|
||||||
|
var O = Object(this);
|
||||||
|
|
||||||
|
// 2. Let lenValue be the result of calling the Get internal
|
||||||
|
// method of O with the argument "length".
|
||||||
|
// 3. Let len be ToUint32(lenValue).
|
||||||
|
var len = O.length >>> 0;
|
||||||
|
|
||||||
|
// 4. If IsCallable(callback) is false, throw a TypeError exception.
|
||||||
|
// See: http://es5.github.com/#x9.11
|
||||||
|
if (typeof callback !== 'function') {
|
||||||
|
throw new TypeError(callback + ' is not a function');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
||||||
|
if (arguments.length > 1) {
|
||||||
|
T = thisArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. Let A be a new array created as if by the expression new Array(len)
|
||||||
|
// where Array is the standard built-in constructor with that name and
|
||||||
|
// len is the value of len.
|
||||||
|
A = new Array(len);
|
||||||
|
|
||||||
|
// 7. Let k be 0
|
||||||
|
k = 0;
|
||||||
|
|
||||||
|
// 8. Repeat, while k < len
|
||||||
|
while (k < len) {
|
||||||
|
|
||||||
|
var kValue, mappedValue;
|
||||||
|
|
||||||
|
// a. Let Pk be ToString(k).
|
||||||
|
// This is implicit for LHS operands of the in operator
|
||||||
|
// b. Let kPresent be the result of calling the HasProperty internal
|
||||||
|
// method of O with argument Pk.
|
||||||
|
// This step can be combined with c
|
||||||
|
// c. If kPresent is true, then
|
||||||
|
if (k in O) {
|
||||||
|
|
||||||
|
// i. Let kValue be the result of calling the Get internal
|
||||||
|
// method of O with argument Pk.
|
||||||
|
kValue = O[k];
|
||||||
|
|
||||||
|
// ii. Let mappedValue be the result of calling the Call internal
|
||||||
|
// method of callback with T as the this value and argument
|
||||||
|
// list containing kValue, k, and O.
|
||||||
|
mappedValue = callback.call(T, kValue, k, O);
|
||||||
|
|
||||||
|
// iii. Call the DefineOwnProperty internal method of A with arguments
|
||||||
|
// Pk, Property Descriptor
|
||||||
|
// { Value: mappedValue,
|
||||||
|
// Writable: true,
|
||||||
|
// Enumerable: true,
|
||||||
|
// Configurable: true },
|
||||||
|
// and false.
|
||||||
|
|
||||||
|
// In browsers that support Object.defineProperty, use the following:
|
||||||
|
// Object.defineProperty(A, k, {
|
||||||
|
// value: mappedValue,
|
||||||
|
// writable: true,
|
||||||
|
// enumerable: true,
|
||||||
|
// configurable: true
|
||||||
|
// });
|
||||||
|
|
||||||
|
// For best browser support, use the following:
|
||||||
|
A[k] = mappedValue;
|
||||||
|
}
|
||||||
|
// d. Increase k by 1.
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 9. return A
|
||||||
|
return A;
|
||||||
|
};
|
||||||
|
}
|
47
node_modules/buffer/test/base64.js
generated
vendored
Normal file
47
node_modules/buffer/test/base64.js
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||||
|
var B = require('../').Buffer
|
||||||
|
var test = require('tape')
|
||||||
|
|
||||||
|
test('base64: ignore whitespace', function (t) {
|
||||||
|
var text = '\n YW9ldQ== '
|
||||||
|
var buf = new B(text, 'base64')
|
||||||
|
t.equal(buf.toString(), 'aoeu')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('base64: strings without padding', function (t) {
|
||||||
|
t.equal((new B('YW9ldQ', 'base64').toString()), 'aoeu')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('base64: newline in utf8 -- should not be an issue', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('LS0tCnRpdGxlOiBUaHJlZSBkYXNoZXMgbWFya3MgdGhlIHNwb3QKdGFnczoK', 'base64').toString('utf8'),
|
||||||
|
'---\ntitle: Three dashes marks the spot\ntags:\n'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('base64: newline in base64 -- should get stripped', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('LS0tCnRpdGxlOiBUaHJlZSBkYXNoZXMgbWFya3MgdGhlIHNwb3QKdGFnczoK\nICAtIHlhbWwKICAtIGZyb250LW1hdHRlcgogIC0gZGFzaGVzCmV4cGFuZWQt', 'base64').toString('utf8'),
|
||||||
|
'---\ntitle: Three dashes marks the spot\ntags:\n - yaml\n - front-matter\n - dashes\nexpaned-'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('base64: tab characters in base64 - should get stripped', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('LS0tCnRpdGxlOiBUaHJlZSBkYXNoZXMgbWFya3MgdGhlIHNwb3QKdGFnczoK\t\t\t\tICAtIHlhbWwKICAtIGZyb250LW1hdHRlcgogIC0gZGFzaGVzCmV4cGFuZWQt', 'base64').toString('utf8'),
|
||||||
|
'---\ntitle: Three dashes marks the spot\ntags:\n - yaml\n - front-matter\n - dashes\nexpaned-'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('base64: invalid non-alphanumeric characters -- should be stripped', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('!"#$%&\'()*,.:;<=>?@[\\]^`{|}~', 'base64').toString('utf8'),
|
||||||
|
''
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
91
node_modules/buffer/test/basic.js
generated
vendored
Normal file
91
node_modules/buffer/test/basic.js
generated
vendored
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||||
|
var B = require('../').Buffer
|
||||||
|
var test = require('tape')
|
||||||
|
|
||||||
|
test('buf.constructor is Buffer', function (t) {
|
||||||
|
var buf = new B([1, 2])
|
||||||
|
t.strictEqual(buf.constructor, B)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('instanceof Buffer', function (t) {
|
||||||
|
var buf = new B([1, 2])
|
||||||
|
t.ok(buf instanceof B)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('convert to Uint8Array in modern browsers', function (t) {
|
||||||
|
if (B.TYPED_ARRAY_SUPPORT) {
|
||||||
|
var buf = new B([1, 2])
|
||||||
|
var uint8array = new Uint8Array(buf.buffer)
|
||||||
|
t.ok(uint8array instanceof Uint8Array)
|
||||||
|
t.equal(uint8array[0], 1)
|
||||||
|
t.equal(uint8array[1], 2)
|
||||||
|
} else {
|
||||||
|
t.pass('object impl: skipping test')
|
||||||
|
}
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('indexes from a string', function (t) {
|
||||||
|
var buf = new B('abc')
|
||||||
|
t.equal(buf[0], 97)
|
||||||
|
t.equal(buf[1], 98)
|
||||||
|
t.equal(buf[2], 99)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('indexes from an array', function (t) {
|
||||||
|
var buf = new B([ 97, 98, 99 ])
|
||||||
|
t.equal(buf[0], 97)
|
||||||
|
t.equal(buf[1], 98)
|
||||||
|
t.equal(buf[2], 99)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('setting index value should modify buffer contents', function (t) {
|
||||||
|
var buf = new B([ 97, 98, 99 ])
|
||||||
|
t.equal(buf[2], 99)
|
||||||
|
t.equal(buf.toString(), 'abc')
|
||||||
|
|
||||||
|
buf[2] += 10
|
||||||
|
t.equal(buf[2], 109)
|
||||||
|
t.equal(buf.toString(), 'abm')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('storing negative number should cast to unsigned', function (t) {
|
||||||
|
var buf = new B(1)
|
||||||
|
|
||||||
|
if (B.TYPED_ARRAY_SUPPORT) {
|
||||||
|
// This does not work with the object implementation -- nothing we can do!
|
||||||
|
buf[0] = -3
|
||||||
|
t.equal(buf[0], 253)
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = new B(1)
|
||||||
|
buf.writeInt8(-3, 0)
|
||||||
|
t.equal(buf[0], 253)
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('test that memory is copied from array-like', function (t) {
|
||||||
|
if (B.TYPED_ARRAY_SUPPORT) {
|
||||||
|
var u = new Uint8Array(4)
|
||||||
|
var b = new B(u)
|
||||||
|
b[0] = 1
|
||||||
|
b[1] = 2
|
||||||
|
b[2] = 3
|
||||||
|
b[3] = 4
|
||||||
|
|
||||||
|
t.equal(u[0], 0)
|
||||||
|
t.equal(u[1], 0)
|
||||||
|
t.equal(u[2], 0)
|
||||||
|
t.equal(u[3], 0)
|
||||||
|
} else {
|
||||||
|
t.pass('object impl: skipping test')
|
||||||
|
}
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
59
node_modules/buffer/test/compare.js
generated
vendored
Normal file
59
node_modules/buffer/test/compare.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||||
|
var B = require('../').Buffer
|
||||||
|
var test = require('tape')
|
||||||
|
|
||||||
|
test('buffer.compare', function (t) {
|
||||||
|
var b = new B(1).fill('a')
|
||||||
|
var c = new B(1).fill('c')
|
||||||
|
var d = new B(2).fill('aa')
|
||||||
|
|
||||||
|
t.equal(b.compare(c), -1)
|
||||||
|
t.equal(c.compare(d), 1)
|
||||||
|
t.equal(d.compare(b), 1)
|
||||||
|
t.equal(b.compare(d), -1)
|
||||||
|
|
||||||
|
// static method
|
||||||
|
t.equal(B.compare(b, c), -1)
|
||||||
|
t.equal(B.compare(c, d), 1)
|
||||||
|
t.equal(B.compare(d, b), 1)
|
||||||
|
t.equal(B.compare(b, d), -1)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('buffer.compare argument validation', function (t) {
|
||||||
|
t.throws(function () {
|
||||||
|
var b = new B(1)
|
||||||
|
B.compare(b, 'abc')
|
||||||
|
})
|
||||||
|
|
||||||
|
t.throws(function () {
|
||||||
|
var b = new B(1)
|
||||||
|
B.compare('abc', b)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.throws(function () {
|
||||||
|
var b = new B(1)
|
||||||
|
b.compare('abc')
|
||||||
|
})
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('buffer.equals', function (t) {
|
||||||
|
var b = new B(5).fill('abcdf')
|
||||||
|
var c = new B(5).fill('abcdf')
|
||||||
|
var d = new B(5).fill('abcde')
|
||||||
|
var e = new B(6).fill('abcdef')
|
||||||
|
|
||||||
|
t.ok(b.equals(c))
|
||||||
|
t.ok(!c.equals(d))
|
||||||
|
t.ok(!d.equals(e))
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('buffer.equals argument validation', function (t) {
|
||||||
|
t.throws(function () {
|
||||||
|
var b = new B(1)
|
||||||
|
b.equals('abc')
|
||||||
|
})
|
||||||
|
t.end()
|
||||||
|
})
|
154
node_modules/buffer/test/constructor.js
generated
vendored
Normal file
154
node_modules/buffer/test/constructor.js
generated
vendored
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||||
|
var B = require('../').Buffer
|
||||||
|
var test = require('tape')
|
||||||
|
|
||||||
|
test('new buffer from array', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B([1, 2, 3]).toString(),
|
||||||
|
'\u0001\u0002\u0003'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('new buffer from array w/ negatives', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B([-1, -2, -3]).toString('hex'),
|
||||||
|
'fffefd'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('new buffer from array with mixed signed input', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B([-255, 255, -128, 128, 512, -512, 511, -511]).toString('hex'),
|
||||||
|
'01ff80800000ff01'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('new buffer from string', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('hey', 'utf8').toString(),
|
||||||
|
'hey'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('new buffer from buffer', function (t) {
|
||||||
|
var b1 = new B('asdf')
|
||||||
|
var b2 = new B(b1)
|
||||||
|
t.equal(b1.toString('hex'), b2.toString('hex'))
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('new buffer from Uint8Array', function (t) {
|
||||||
|
if (typeof Uint8Array !== 'undefined') {
|
||||||
|
var b1 = new Uint8Array([0, 1, 2, 3])
|
||||||
|
var b2 = new B(b1)
|
||||||
|
t.equal(b1.length, b2.length)
|
||||||
|
t.equal(b1[0], 0)
|
||||||
|
t.equal(b1[1], 1)
|
||||||
|
t.equal(b1[2], 2)
|
||||||
|
t.equal(b1[3], 3)
|
||||||
|
t.equal(b1[4], undefined)
|
||||||
|
}
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('new buffer from Uint16Array', function (t) {
|
||||||
|
if (typeof Uint16Array !== 'undefined') {
|
||||||
|
var b1 = new Uint16Array([0, 1, 2, 3])
|
||||||
|
var b2 = new B(b1)
|
||||||
|
t.equal(b1.length, b2.length)
|
||||||
|
t.equal(b1[0], 0)
|
||||||
|
t.equal(b1[1], 1)
|
||||||
|
t.equal(b1[2], 2)
|
||||||
|
t.equal(b1[3], 3)
|
||||||
|
t.equal(b1[4], undefined)
|
||||||
|
}
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('new buffer from Uint32Array', function (t) {
|
||||||
|
if (typeof Uint32Array !== 'undefined') {
|
||||||
|
var b1 = new Uint32Array([0, 1, 2, 3])
|
||||||
|
var b2 = new B(b1)
|
||||||
|
t.equal(b1.length, b2.length)
|
||||||
|
t.equal(b1[0], 0)
|
||||||
|
t.equal(b1[1], 1)
|
||||||
|
t.equal(b1[2], 2)
|
||||||
|
t.equal(b1[3], 3)
|
||||||
|
t.equal(b1[4], undefined)
|
||||||
|
}
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('new buffer from Int16Array', function (t) {
|
||||||
|
if (typeof Int16Array !== 'undefined') {
|
||||||
|
var b1 = new Int16Array([0, 1, 2, 3])
|
||||||
|
var b2 = new B(b1)
|
||||||
|
t.equal(b1.length, b2.length)
|
||||||
|
t.equal(b1[0], 0)
|
||||||
|
t.equal(b1[1], 1)
|
||||||
|
t.equal(b1[2], 2)
|
||||||
|
t.equal(b1[3], 3)
|
||||||
|
t.equal(b1[4], undefined)
|
||||||
|
}
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('new buffer from Int32Array', function (t) {
|
||||||
|
if (typeof Int32Array !== 'undefined') {
|
||||||
|
var b1 = new Int32Array([0, 1, 2, 3])
|
||||||
|
var b2 = new B(b1)
|
||||||
|
t.equal(b1.length, b2.length)
|
||||||
|
t.equal(b1[0], 0)
|
||||||
|
t.equal(b1[1], 1)
|
||||||
|
t.equal(b1[2], 2)
|
||||||
|
t.equal(b1[3], 3)
|
||||||
|
t.equal(b1[4], undefined)
|
||||||
|
}
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('new buffer from Float32Array', function (t) {
|
||||||
|
if (typeof Float32Array !== 'undefined') {
|
||||||
|
var b1 = new Float32Array([0, 1, 2, 3])
|
||||||
|
var b2 = new B(b1)
|
||||||
|
t.equal(b1.length, b2.length)
|
||||||
|
t.equal(b1[0], 0)
|
||||||
|
t.equal(b1[1], 1)
|
||||||
|
t.equal(b1[2], 2)
|
||||||
|
t.equal(b1[3], 3)
|
||||||
|
t.equal(b1[4], undefined)
|
||||||
|
}
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('new buffer from Float64Array', function (t) {
|
||||||
|
if (typeof Float64Array !== 'undefined') {
|
||||||
|
var b1 = new Float64Array([0, 1, 2, 3])
|
||||||
|
var b2 = new B(b1)
|
||||||
|
t.equal(b1.length, b2.length)
|
||||||
|
t.equal(b1[0], 0)
|
||||||
|
t.equal(b1[1], 1)
|
||||||
|
t.equal(b1[2], 2)
|
||||||
|
t.equal(b1[3], 3)
|
||||||
|
t.equal(b1[4], undefined)
|
||||||
|
}
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('new buffer from buffer.toJSON() output', function (t) {
|
||||||
|
if (typeof JSON === 'undefined') {
|
||||||
|
// ie6, ie7 lack support
|
||||||
|
t.end()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var buf = new B('test')
|
||||||
|
var json = JSON.stringify(buf)
|
||||||
|
var obj = JSON.parse(json)
|
||||||
|
var copy = new B(obj)
|
||||||
|
t.ok(buf.equals(copy))
|
||||||
|
t.end()
|
||||||
|
})
|
19
node_modules/buffer/test/deprecated.js
generated
vendored
Normal file
19
node_modules/buffer/test/deprecated.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||||
|
var B = require('../').Buffer
|
||||||
|
var test = require('tape')
|
||||||
|
|
||||||
|
test('.get (deprecated)', function (t) {
|
||||||
|
var b = new B([7, 42])
|
||||||
|
t.equal(b.get(0), 7)
|
||||||
|
t.equal(b.get(1), 42)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('.set (deprecated)', function (t) {
|
||||||
|
var b = new B(2)
|
||||||
|
b.set(7, 0)
|
||||||
|
b.set(42, 1)
|
||||||
|
t.equal(b[0], 7)
|
||||||
|
t.equal(b[1], 42)
|
||||||
|
t.end()
|
||||||
|
})
|
132
node_modules/buffer/test/from-string.js
generated
vendored
Normal file
132
node_modules/buffer/test/from-string.js
generated
vendored
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||||
|
var B = require('../').Buffer
|
||||||
|
var test = require('tape')
|
||||||
|
|
||||||
|
test('detect utf16 surrogate pairs', function (t) {
|
||||||
|
var text = '\uD83D\uDE38' + '\uD83D\uDCAD' + '\uD83D\uDC4D'
|
||||||
|
var buf = new B(text)
|
||||||
|
t.equal(text, buf.toString())
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('detect utf16 surrogate pairs over U+20000 until U+10FFFF', function (t) {
|
||||||
|
var text = '\uD842\uDFB7' + '\uD93D\uDCAD' + '\uDBFF\uDFFF'
|
||||||
|
var buf = new B(text)
|
||||||
|
t.equal(text, buf.toString())
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('replace orphaned utf16 surrogate lead code point', function (t) {
|
||||||
|
var text = '\uD83D\uDE38' + '\uD83D' + '\uD83D\uDC4D'
|
||||||
|
var buf = new B(text)
|
||||||
|
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0xef, 0xbf, 0xbd, 0xf0, 0x9f, 0x91, 0x8d ]))
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('replace orphaned utf16 surrogate trail code point', function (t) {
|
||||||
|
var text = '\uD83D\uDE38' + '\uDCAD' + '\uD83D\uDC4D'
|
||||||
|
var buf = new B(text)
|
||||||
|
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0xef, 0xbf, 0xbd, 0xf0, 0x9f, 0x91, 0x8d ]))
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('do not write partial utf16 code units', function (t) {
|
||||||
|
var f = new B([0, 0, 0, 0, 0])
|
||||||
|
t.equal(f.length, 5)
|
||||||
|
var size = f.write('あいうえお', 'utf16le')
|
||||||
|
t.equal(size, 4)
|
||||||
|
t.deepEqual(f, new B([0x42, 0x30, 0x44, 0x30, 0x00]))
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('handle partial utf16 code points when encoding to utf8 the way node does', function (t) {
|
||||||
|
var text = '\uD83D\uDE38' + '\uD83D\uDC4D'
|
||||||
|
|
||||||
|
var buf = new B(8)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0xf0, 0x9f, 0x91, 0x8d ]))
|
||||||
|
|
||||||
|
buf = new B(7)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0x00, 0x00, 0x00 ]))
|
||||||
|
|
||||||
|
buf = new B(6)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0x00, 0x00 ]))
|
||||||
|
|
||||||
|
buf = new B(5)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0x00 ]))
|
||||||
|
|
||||||
|
buf = new B(4)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8 ]))
|
||||||
|
|
||||||
|
buf = new B(3)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0x00, 0x00, 0x00 ]))
|
||||||
|
|
||||||
|
buf = new B(2)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0x00, 0x00 ]))
|
||||||
|
|
||||||
|
buf = new B(1)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0x00 ]))
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('handle invalid utf16 code points when encoding to utf8 the way node does', function (t) {
|
||||||
|
var text = 'a' + '\uDE38\uD83D' + 'b'
|
||||||
|
|
||||||
|
var buf = new B(8)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd, 0xef, 0xbf, 0xbd, 0x62 ]))
|
||||||
|
|
||||||
|
buf = new B(7)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd, 0xef, 0xbf, 0xbd ]))
|
||||||
|
|
||||||
|
buf = new B(6)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd, 0x00, 0x00 ]))
|
||||||
|
|
||||||
|
buf = new B(5)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd, 0x00 ]))
|
||||||
|
|
||||||
|
buf = new B(4)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd ]))
|
||||||
|
|
||||||
|
buf = new B(3)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0x61, 0x00, 0x00 ]))
|
||||||
|
|
||||||
|
buf = new B(2)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0x61, 0x00 ]))
|
||||||
|
|
||||||
|
buf = new B(1)
|
||||||
|
buf.fill(0)
|
||||||
|
buf.write(text)
|
||||||
|
t.deepEqual(buf, new B([ 0x61 ]))
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
127
node_modules/buffer/test/methods.js
generated
vendored
Normal file
127
node_modules/buffer/test/methods.js
generated
vendored
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||||
|
var B = require('../').Buffer
|
||||||
|
var test = require('tape')
|
||||||
|
|
||||||
|
test('buffer.toJSON', function (t) {
|
||||||
|
var data = [1, 2, 3, 4]
|
||||||
|
t.deepEqual(
|
||||||
|
new B(data).toJSON(),
|
||||||
|
{ type: 'Buffer', data: [ 1, 2, 3, 4 ] }
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('buffer.copy', function (t) {
|
||||||
|
// copied from nodejs.org example
|
||||||
|
var buf1 = new B(26)
|
||||||
|
var buf2 = new B(26)
|
||||||
|
|
||||||
|
for (var i = 0; i < 26; i++) {
|
||||||
|
buf1[i] = i + 97 // 97 is ASCII a
|
||||||
|
buf2[i] = 33 // ASCII !
|
||||||
|
}
|
||||||
|
|
||||||
|
buf1.copy(buf2, 8, 16, 20)
|
||||||
|
|
||||||
|
t.equal(
|
||||||
|
buf2.toString('ascii', 0, 25),
|
||||||
|
'!!!!!!!!qrst!!!!!!!!!!!!!'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('test offset returns are correct', function (t) {
|
||||||
|
var b = new B(16)
|
||||||
|
t.equal(4, b.writeUInt32LE(0, 0))
|
||||||
|
t.equal(6, b.writeUInt16LE(0, 4))
|
||||||
|
t.equal(7, b.writeUInt8(0, 6))
|
||||||
|
t.equal(8, b.writeInt8(0, 7))
|
||||||
|
t.equal(16, b.writeDoubleLE(0, 8))
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('concat() a varying number of buffers', function (t) {
|
||||||
|
var zero = []
|
||||||
|
var one = [ new B('asdf') ]
|
||||||
|
var long = []
|
||||||
|
for (var i = 0; i < 10; i++) {
|
||||||
|
long.push(new B('asdf'))
|
||||||
|
}
|
||||||
|
|
||||||
|
var flatZero = B.concat(zero)
|
||||||
|
var flatOne = B.concat(one)
|
||||||
|
var flatLong = B.concat(long)
|
||||||
|
var flatLongLen = B.concat(long, 40)
|
||||||
|
|
||||||
|
t.equal(flatZero.length, 0)
|
||||||
|
t.equal(flatOne.toString(), 'asdf')
|
||||||
|
t.deepEqual(flatOne, one[0])
|
||||||
|
t.equal(flatLong.toString(), (new Array(10 + 1).join('asdf')))
|
||||||
|
t.equal(flatLongLen.toString(), (new Array(10 + 1).join('asdf')))
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('fill', function (t) {
|
||||||
|
var b = new B(10)
|
||||||
|
b.fill(2)
|
||||||
|
t.equal(b.toString('hex'), '02020202020202020202')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('fill (string)', function (t) {
|
||||||
|
var b = new B(10)
|
||||||
|
b.fill('abc')
|
||||||
|
t.equal(b.toString(), 'abcabcabca')
|
||||||
|
b.fill('է')
|
||||||
|
t.equal(b.toString(), 'էէէէէ')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('copy() empty buffer with sourceEnd=0', function (t) {
|
||||||
|
var source = new B([42])
|
||||||
|
var destination = new B([43])
|
||||||
|
source.copy(destination, 0, 0, 0)
|
||||||
|
t.equal(destination.readUInt8(0), 43)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('copy() after slice()', function (t) {
|
||||||
|
var source = new B(200)
|
||||||
|
var dest = new B(200)
|
||||||
|
var expected = new B(200)
|
||||||
|
for (var i = 0; i < 200; i++) {
|
||||||
|
source[i] = i
|
||||||
|
dest[i] = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
source.slice(2).copy(dest)
|
||||||
|
source.copy(expected, 0, 2)
|
||||||
|
t.deepEqual(dest, expected)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('copy() ascending', function (t) {
|
||||||
|
var b = new B('abcdefghij')
|
||||||
|
b.copy(b, 0, 3, 10)
|
||||||
|
t.equal(b.toString(), 'defghijhij')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('copy() descending', function (t) {
|
||||||
|
var b = new B('abcdefghij')
|
||||||
|
b.copy(b, 3, 0, 7)
|
||||||
|
t.equal(b.toString(), 'abcabcdefg')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('buffer.slice sets indexes', function (t) {
|
||||||
|
t.equal((new B('hallo')).slice(0, 5).toString(), 'hallo')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('buffer.slice out of range', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
t.equal((new B('hallo')).slice(0, 10).toString(), 'hallo')
|
||||||
|
t.equal((new B('hallo')).slice(10, 2).toString(), '')
|
||||||
|
t.end()
|
||||||
|
})
|
1
node_modules/buffer/test/node-es6/README.txt
generated
vendored
Normal file
1
node_modules/buffer/test/node-es6/README.txt
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
node buffer tests that require ES6 (e.g. "for..of" construct)
|
49
node_modules/buffer/test/node-es6/test-buffer-arraybuffer.js
generated
vendored
Normal file
49
node_modules/buffer/test/node-es6/test-buffer-arraybuffer.js
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
'use strict';
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||||
|
var Buffer = require('../../').Buffer;
|
||||||
|
|
||||||
|
var common = {};
|
||||||
|
var assert = require('assert');
|
||||||
|
|
||||||
|
var Buffer = require('../../').Buffer;
|
||||||
|
var LENGTH = 16;
|
||||||
|
|
||||||
|
var ab = new ArrayBuffer(LENGTH);
|
||||||
|
var dv = new DataView(ab);
|
||||||
|
var ui = new Uint8Array(ab);
|
||||||
|
var buf = new Buffer(ab);
|
||||||
|
|
||||||
|
|
||||||
|
assert.ok(Buffer.isBuffer(buf));
|
||||||
|
// For backwards compatibility of old .parent property test that if buf is not
|
||||||
|
// a slice then .parent should be undefined.
|
||||||
|
assert.equal(buf.parent, undefined);
|
||||||
|
assert.equal(buf.buffer, ab);
|
||||||
|
assert.equal(buf.length, ab.byteLength);
|
||||||
|
|
||||||
|
|
||||||
|
buf.fill(0xC);
|
||||||
|
for (var i = 0; i < LENGTH; i++) {
|
||||||
|
assert.equal(ui[i], 0xC);
|
||||||
|
ui[i] = 0xF;
|
||||||
|
assert.equal(buf[i], 0xF);
|
||||||
|
}
|
||||||
|
|
||||||
|
buf.writeUInt32LE(0xF00, 0);
|
||||||
|
buf.writeUInt32BE(0xB47, 4);
|
||||||
|
buf.writeDoubleLE(3.1415, 8);
|
||||||
|
|
||||||
|
assert.equal(dv.getUint32(0, true), 0xF00);
|
||||||
|
assert.equal(dv.getUint32(4), 0xB47);
|
||||||
|
assert.equal(dv.getFloat64(8, true), 3.1415);
|
||||||
|
|
||||||
|
|
||||||
|
// Now test protecting users from doing stupid things
|
||||||
|
|
||||||
|
assert.throws(function() {
|
||||||
|
function AB() { }
|
||||||
|
AB.__proto__ = ArrayBuffer;
|
||||||
|
AB.prototype.__proto__ = ArrayBuffer.prototype;
|
||||||
|
new Buffer(new AB());
|
||||||
|
}, TypeError);
|
||||||
|
|
65
node_modules/buffer/test/node-es6/test-buffer-iterator.js
generated
vendored
Normal file
65
node_modules/buffer/test/node-es6/test-buffer-iterator.js
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
'use strict';
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||||
|
var Buffer = require('../../').Buffer;
|
||||||
|
var common = {};
|
||||||
|
var assert = require('assert');
|
||||||
|
|
||||||
|
var buffer = new Buffer([1, 2, 3, 4, 5]);
|
||||||
|
var arr;
|
||||||
|
var b;
|
||||||
|
|
||||||
|
// buffers should be iterable
|
||||||
|
|
||||||
|
arr = [];
|
||||||
|
|
||||||
|
for (b of buffer)
|
||||||
|
arr.push(b);
|
||||||
|
|
||||||
|
assert.deepEqual(arr, [1, 2, 3, 4, 5]);
|
||||||
|
|
||||||
|
|
||||||
|
// buffer iterators should be iterable
|
||||||
|
|
||||||
|
arr = [];
|
||||||
|
|
||||||
|
for (b of buffer[Symbol.iterator]())
|
||||||
|
arr.push(b);
|
||||||
|
|
||||||
|
assert.deepEqual(arr, [1, 2, 3, 4, 5]);
|
||||||
|
|
||||||
|
|
||||||
|
// buffer#values() should return iterator for values
|
||||||
|
|
||||||
|
arr = [];
|
||||||
|
|
||||||
|
for (b of buffer.values())
|
||||||
|
arr.push(b);
|
||||||
|
|
||||||
|
assert.deepEqual(arr, [1, 2, 3, 4, 5]);
|
||||||
|
|
||||||
|
|
||||||
|
// buffer#keys() should return iterator for keys
|
||||||
|
|
||||||
|
arr = [];
|
||||||
|
|
||||||
|
for (b of buffer.keys())
|
||||||
|
arr.push(b);
|
||||||
|
|
||||||
|
assert.deepEqual(arr, [0, 1, 2, 3, 4]);
|
||||||
|
|
||||||
|
|
||||||
|
// buffer#entries() should return iterator for entries
|
||||||
|
|
||||||
|
arr = [];
|
||||||
|
|
||||||
|
for (var b of buffer.entries())
|
||||||
|
arr.push(b);
|
||||||
|
|
||||||
|
assert.deepEqual(arr, [
|
||||||
|
[0, 1],
|
||||||
|
[1, 2],
|
||||||
|
[2, 3],
|
||||||
|
[3, 4],
|
||||||
|
[4, 5]
|
||||||
|
]);
|
||||||
|
|
1
node_modules/buffer/test/node/README.txt
generated
vendored
Normal file
1
node_modules/buffer/test/node/README.txt
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
node core buffer tests
|
28
node_modules/buffer/test/node/test-buffer-ascii.js
generated
vendored
Normal file
28
node_modules/buffer/test/node/test-buffer-ascii.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
'use strict';
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||||
|
var Buffer = require('../../').Buffer;
|
||||||
|
var common = {};
|
||||||
|
var assert = require('assert');
|
||||||
|
|
||||||
|
// ASCII conversion in node.js simply masks off the high bits,
|
||||||
|
// it doesn't do transliteration.
|
||||||
|
assert.equal(Buffer('hérité').toString('ascii'), 'hC)ritC)');
|
||||||
|
|
||||||
|
// 71 characters, 78 bytes. The ’ character is a triple-byte sequence.
|
||||||
|
var input = 'C’est, graphiquement, la réunion d’un accent aigu ' +
|
||||||
|
'et d’un accent grave.';
|
||||||
|
|
||||||
|
var expected = 'Cb\u0000\u0019est, graphiquement, la rC)union ' +
|
||||||
|
'db\u0000\u0019un accent aigu et db\u0000\u0019un ' +
|
||||||
|
'accent grave.';
|
||||||
|
|
||||||
|
var buf = Buffer(input);
|
||||||
|
|
||||||
|
for (var i = 0; i < expected.length; ++i) {
|
||||||
|
assert.equal(buf.slice(i).toString('ascii'), expected.slice(i));
|
||||||
|
|
||||||
|
// Skip remainder of multi-byte sequence.
|
||||||
|
if (input.charCodeAt(i) > 65535) ++i;
|
||||||
|
if (input.charCodeAt(i) > 127) ++i;
|
||||||
|
}
|
||||||
|
|
49
node_modules/buffer/test/node/test-buffer-bytelength.js
generated
vendored
Normal file
49
node_modules/buffer/test/node/test-buffer-bytelength.js
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
'use strict';
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||||
|
var Buffer = require('../../').Buffer;
|
||||||
|
|
||||||
|
var common = {};
|
||||||
|
var assert = require('assert');
|
||||||
|
var Buffer = require('../../').Buffer;
|
||||||
|
|
||||||
|
// coerce values to string
|
||||||
|
assert.equal(Buffer.byteLength(32, 'raw'), 2);
|
||||||
|
assert.equal(Buffer.byteLength(NaN, 'utf8'), 3);
|
||||||
|
assert.equal(Buffer.byteLength({}, 'raws'), 15);
|
||||||
|
assert.equal(Buffer.byteLength(), 9);
|
||||||
|
|
||||||
|
// special case: zero length string
|
||||||
|
assert.equal(Buffer.byteLength('', 'ascii'), 0);
|
||||||
|
assert.equal(Buffer.byteLength('', 'HeX'), 0);
|
||||||
|
|
||||||
|
// utf8
|
||||||
|
assert.equal(Buffer.byteLength('∑éllö wørl∂!', 'utf-8'), 19);
|
||||||
|
assert.equal(Buffer.byteLength('κλμνξο', 'utf8'), 12);
|
||||||
|
assert.equal(Buffer.byteLength('挵挶挷挸挹', 'utf-8'), 15);
|
||||||
|
assert.equal(Buffer.byteLength('𠝹𠱓𠱸', 'UTF8'), 12);
|
||||||
|
// without an encoding, utf8 should be assumed
|
||||||
|
assert.equal(Buffer.byteLength('hey there'), 9);
|
||||||
|
assert.equal(Buffer.byteLength('𠱸挶νξ#xx :)'), 17);
|
||||||
|
assert.equal(Buffer.byteLength('hello world', ''), 11);
|
||||||
|
// it should also be assumed with unrecognized encoding
|
||||||
|
assert.equal(Buffer.byteLength('hello world', 'abc'), 11);
|
||||||
|
assert.equal(Buffer.byteLength('ßœ∑≈', 'unkn0wn enc0ding'), 10);
|
||||||
|
|
||||||
|
// base64
|
||||||
|
assert.equal(Buffer.byteLength('aGVsbG8gd29ybGQ=', 'base64'), 11);
|
||||||
|
assert.equal(Buffer.byteLength('bm9kZS5qcyByb2NrcyE=', 'base64'), 14);
|
||||||
|
assert.equal(Buffer.byteLength('aGkk', 'base64'), 3);
|
||||||
|
assert.equal(Buffer.byteLength('bHNrZGZsa3NqZmtsc2xrZmFqc2RsZmtqcw==',
|
||||||
|
'base64'), 25);
|
||||||
|
// special padding
|
||||||
|
assert.equal(Buffer.byteLength('aaa=', 'base64'), 2);
|
||||||
|
assert.equal(Buffer.byteLength('aaaa==', 'base64'), 3);
|
||||||
|
|
||||||
|
assert.equal(Buffer.byteLength('Il était tué'), 14);
|
||||||
|
assert.equal(Buffer.byteLength('Il était tué', 'utf8'), 14);
|
||||||
|
assert.equal(Buffer.byteLength('Il était tué', 'ascii'), 12);
|
||||||
|
assert.equal(Buffer.byteLength('Il était tué', 'binary'), 12);
|
||||||
|
['ucs2', 'ucs-2', 'utf16le', 'utf-16le'].forEach(function(encoding) {
|
||||||
|
assert.equal(24, Buffer.byteLength('Il était tué', encoding));
|
||||||
|
});
|
||||||
|
|
30
node_modules/buffer/test/node/test-buffer-concat.js
generated
vendored
Normal file
30
node_modules/buffer/test/node/test-buffer-concat.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
'use strict';
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||||
|
var Buffer = require('../../').Buffer;
|
||||||
|
var common = {};
|
||||||
|
var assert = require('assert');
|
||||||
|
|
||||||
|
var zero = [];
|
||||||
|
var one = [ new Buffer('asdf') ];
|
||||||
|
var long = [];
|
||||||
|
for (var i = 0; i < 10; i++) long.push(new Buffer('asdf'));
|
||||||
|
|
||||||
|
var flatZero = Buffer.concat(zero);
|
||||||
|
var flatOne = Buffer.concat(one);
|
||||||
|
var flatLong = Buffer.concat(long);
|
||||||
|
var flatLongLen = Buffer.concat(long, 40);
|
||||||
|
|
||||||
|
assert(flatZero.length === 0);
|
||||||
|
assert(flatOne.toString() === 'asdf');
|
||||||
|
// A special case where concat used to return the first item,
|
||||||
|
// if the length is one. This check is to make sure that we don't do that.
|
||||||
|
assert(flatOne !== one[0]);
|
||||||
|
assert(flatLong.toString() === (new Array(10 + 1).join('asdf')));
|
||||||
|
assert(flatLongLen.toString() === (new Array(10 + 1).join('asdf')));
|
||||||
|
|
||||||
|
assert.throws(function() {
|
||||||
|
Buffer.concat([42]);
|
||||||
|
}, TypeError);
|
||||||
|
|
||||||
|
// console.log('ok');
|
||||||
|
|
79
node_modules/buffer/test/node/test-buffer-indexof.js
generated
vendored
Normal file
79
node_modules/buffer/test/node/test-buffer-indexof.js
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
'use strict';
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||||
|
var Buffer = require('../../').Buffer;
|
||||||
|
var common = {};
|
||||||
|
var assert = require('assert');
|
||||||
|
|
||||||
|
var Buffer = require('../../').Buffer;
|
||||||
|
|
||||||
|
var b = new Buffer('abcdef');
|
||||||
|
var buf_a = new Buffer('a');
|
||||||
|
var buf_bc = new Buffer('bc');
|
||||||
|
var buf_f = new Buffer('f');
|
||||||
|
var buf_z = new Buffer('z');
|
||||||
|
var buf_empty = new Buffer('');
|
||||||
|
|
||||||
|
assert.equal(b.indexOf('a'), 0);
|
||||||
|
assert.equal(b.indexOf('a', 1), -1);
|
||||||
|
assert.equal(b.indexOf('a', -1), -1);
|
||||||
|
assert.equal(b.indexOf('a', -4), -1);
|
||||||
|
assert.equal(b.indexOf('a', -b.length), 0);
|
||||||
|
assert.equal(b.indexOf('a', NaN), 0);
|
||||||
|
assert.equal(b.indexOf('a', -Infinity), 0);
|
||||||
|
assert.equal(b.indexOf('a', Infinity), -1);
|
||||||
|
assert.equal(b.indexOf('bc'), 1);
|
||||||
|
assert.equal(b.indexOf('bc', 2), -1);
|
||||||
|
assert.equal(b.indexOf('bc', -1), -1);
|
||||||
|
assert.equal(b.indexOf('bc', -3), -1);
|
||||||
|
assert.equal(b.indexOf('bc', -5), 1);
|
||||||
|
assert.equal(b.indexOf('bc', NaN), 1);
|
||||||
|
assert.equal(b.indexOf('bc', -Infinity), 1);
|
||||||
|
assert.equal(b.indexOf('bc', Infinity), -1);
|
||||||
|
assert.equal(b.indexOf('f'), b.length - 1);
|
||||||
|
assert.equal(b.indexOf('z'), -1);
|
||||||
|
assert.equal(b.indexOf(''), -1);
|
||||||
|
assert.equal(b.indexOf('', 1), -1);
|
||||||
|
assert.equal(b.indexOf('', b.length + 1), -1);
|
||||||
|
assert.equal(b.indexOf('', Infinity), -1);
|
||||||
|
assert.equal(b.indexOf(buf_a), 0);
|
||||||
|
assert.equal(b.indexOf(buf_a, 1), -1);
|
||||||
|
assert.equal(b.indexOf(buf_a, -1), -1);
|
||||||
|
assert.equal(b.indexOf(buf_a, -4), -1);
|
||||||
|
assert.equal(b.indexOf(buf_a, -b.length), 0);
|
||||||
|
assert.equal(b.indexOf(buf_a, NaN), 0);
|
||||||
|
assert.equal(b.indexOf(buf_a, -Infinity), 0);
|
||||||
|
assert.equal(b.indexOf(buf_a, Infinity), -1);
|
||||||
|
assert.equal(b.indexOf(buf_bc), 1);
|
||||||
|
assert.equal(b.indexOf(buf_bc, 2), -1);
|
||||||
|
assert.equal(b.indexOf(buf_bc, -1), -1);
|
||||||
|
assert.equal(b.indexOf(buf_bc, -3), -1);
|
||||||
|
assert.equal(b.indexOf(buf_bc, -5), 1);
|
||||||
|
assert.equal(b.indexOf(buf_bc, NaN), 1);
|
||||||
|
assert.equal(b.indexOf(buf_bc, -Infinity), 1);
|
||||||
|
assert.equal(b.indexOf(buf_bc, Infinity), -1);
|
||||||
|
assert.equal(b.indexOf(buf_f), b.length - 1);
|
||||||
|
assert.equal(b.indexOf(buf_z), -1);
|
||||||
|
assert.equal(b.indexOf(buf_empty), -1);
|
||||||
|
assert.equal(b.indexOf(buf_empty, 1), -1);
|
||||||
|
assert.equal(b.indexOf(buf_empty, b.length + 1), -1);
|
||||||
|
assert.equal(b.indexOf(buf_empty, Infinity), -1);
|
||||||
|
assert.equal(b.indexOf(0x61), 0);
|
||||||
|
assert.equal(b.indexOf(0x61, 1), -1);
|
||||||
|
assert.equal(b.indexOf(0x61, -1), -1);
|
||||||
|
assert.equal(b.indexOf(0x61, -4), -1);
|
||||||
|
assert.equal(b.indexOf(0x61, -b.length), 0);
|
||||||
|
assert.equal(b.indexOf(0x61, NaN), 0);
|
||||||
|
assert.equal(b.indexOf(0x61, -Infinity), 0);
|
||||||
|
assert.equal(b.indexOf(0x61, Infinity), -1);
|
||||||
|
assert.equal(b.indexOf(0x0), -1);
|
||||||
|
|
||||||
|
assert.throws(function() {
|
||||||
|
b.indexOf(function() { });
|
||||||
|
});
|
||||||
|
assert.throws(function() {
|
||||||
|
b.indexOf({});
|
||||||
|
});
|
||||||
|
assert.throws(function() {
|
||||||
|
b.indexOf([]);
|
||||||
|
});
|
||||||
|
|
41
node_modules/buffer/test/node/test-buffer-inspect.js
generated
vendored
Normal file
41
node_modules/buffer/test/node/test-buffer-inspect.js
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
'use strict';
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||||
|
var Buffer = require('../../').Buffer;
|
||||||
|
var common = {};
|
||||||
|
var assert = require('assert');
|
||||||
|
|
||||||
|
var util = require('util');
|
||||||
|
|
||||||
|
var buffer = require('../../');
|
||||||
|
|
||||||
|
buffer.INSPECT_MAX_BYTES = 2;
|
||||||
|
|
||||||
|
var b = new Buffer(4);
|
||||||
|
b.fill('1234');
|
||||||
|
|
||||||
|
var s = new buffer.SlowBuffer(4);
|
||||||
|
s.fill('1234');
|
||||||
|
|
||||||
|
var expected = '<Buffer 31 32 ... >';
|
||||||
|
|
||||||
|
assert.strictEqual(util.inspect(b), expected);
|
||||||
|
assert.strictEqual(util.inspect(s), expected);
|
||||||
|
|
||||||
|
b = new Buffer(2);
|
||||||
|
b.fill('12');
|
||||||
|
|
||||||
|
s = new buffer.SlowBuffer(2);
|
||||||
|
s.fill('12');
|
||||||
|
|
||||||
|
expected = '<Buffer 31 32>';
|
||||||
|
|
||||||
|
assert.strictEqual(util.inspect(b), expected);
|
||||||
|
assert.strictEqual(util.inspect(s), expected);
|
||||||
|
|
||||||
|
buffer.INSPECT_MAX_BYTES = Infinity;
|
||||||
|
|
||||||
|
assert.doesNotThrow(function() {
|
||||||
|
assert.strictEqual(util.inspect(b), expected);
|
||||||
|
assert.strictEqual(util.inspect(s), expected);
|
||||||
|
});
|
||||||
|
|
1194
node_modules/buffer/test/node/test-buffer.js
generated
vendored
Normal file
1194
node_modules/buffer/test/node/test-buffer.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
37
node_modules/buffer/test/slice.js
generated
vendored
Normal file
37
node_modules/buffer/test/slice.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||||
|
var B = require('../').Buffer
|
||||||
|
var test = require('tape')
|
||||||
|
|
||||||
|
test('modifying buffer created by .slice() modifies original memory', function (t) {
|
||||||
|
if (!B.TYPED_ARRAY_SUPPORT) return t.end()
|
||||||
|
|
||||||
|
var buf1 = new B(26)
|
||||||
|
for (var i = 0; i < 26; i++) {
|
||||||
|
buf1[i] = i + 97 // 97 is ASCII a
|
||||||
|
}
|
||||||
|
|
||||||
|
var buf2 = buf1.slice(0, 3)
|
||||||
|
t.equal(buf2.toString('ascii', 0, buf2.length), 'abc')
|
||||||
|
|
||||||
|
buf2[0] = '!'.charCodeAt(0)
|
||||||
|
t.equal(buf1.toString('ascii', 0, buf2.length), '!bc')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('modifying parent buffer modifies .slice() buffer\'s memory', function (t) {
|
||||||
|
if (!B.TYPED_ARRAY_SUPPORT) return t.end()
|
||||||
|
|
||||||
|
var buf1 = new B(26)
|
||||||
|
for (var i = 0; i < 26; i++) {
|
||||||
|
buf1[i] = i + 97 // 97 is ASCII a
|
||||||
|
}
|
||||||
|
|
||||||
|
var buf2 = buf1.slice(0, 3)
|
||||||
|
t.equal(buf2.toString('ascii', 0, buf2.length), 'abc')
|
||||||
|
|
||||||
|
buf1[0] = '!'.charCodeAt(0)
|
||||||
|
t.equal(buf2.toString('ascii', 0, buf2.length), '!bc')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
31
node_modules/buffer/test/static.js
generated
vendored
Normal file
31
node_modules/buffer/test/static.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||||
|
var B = require('../').Buffer
|
||||||
|
var test = require('tape')
|
||||||
|
|
||||||
|
test('Buffer.isEncoding', function (t) {
|
||||||
|
t.equal(B.isEncoding('HEX'), true)
|
||||||
|
t.equal(B.isEncoding('hex'), true)
|
||||||
|
t.equal(B.isEncoding('bad'), false)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('Buffer.isBuffer', function (t) {
|
||||||
|
t.equal(B.isBuffer(new B('hey', 'utf8')), true)
|
||||||
|
t.equal(B.isBuffer(new B([1, 2, 3], 'utf8')), true)
|
||||||
|
t.equal(B.isBuffer('hey'), false)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('Buffer.toArrayBuffer', function (t) {
|
||||||
|
var data = [1, 2, 3, 4, 5, 6, 7, 8]
|
||||||
|
if (typeof Uint8Array !== 'undefined') {
|
||||||
|
var result = new B(data).toArrayBuffer()
|
||||||
|
var expected = new Uint8Array(data).buffer
|
||||||
|
for (var i = 0; i < expected.byteLength; i++) {
|
||||||
|
t.equal(result[i], expected[i])
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
t.pass('No toArrayBuffer() method provided in old browsers')
|
||||||
|
}
|
||||||
|
t.end()
|
||||||
|
})
|
233
node_modules/buffer/test/to-string.js
generated
vendored
Normal file
233
node_modules/buffer/test/to-string.js
generated
vendored
Normal file
|
@ -0,0 +1,233 @@
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||||
|
var B = require('../').Buffer
|
||||||
|
var test = require('tape')
|
||||||
|
|
||||||
|
test('utf8 buffer to base64', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('Ձאab', 'utf8').toString('base64'),
|
||||||
|
'1YHXkGFi'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('utf8 buffer to hex', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('Ձאab', 'utf8').toString('hex'),
|
||||||
|
'd581d7906162'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('utf8 to utf8', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('öäüõÖÄÜÕ', 'utf8').toString('utf8'),
|
||||||
|
'öäüõÖÄÜÕ'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('utf16le to utf16', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B(new B('abcd', 'utf8').toString('utf16le'), 'utf16le').toString('utf8'),
|
||||||
|
'abcd'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('utf16le to hex', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('abcd', 'utf16le').toString('hex'),
|
||||||
|
'6100620063006400'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('ascii buffer to base64', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('123456!@#$%^', 'ascii').toString('base64'),
|
||||||
|
'MTIzNDU2IUAjJCVe'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('ascii buffer to hex', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('123456!@#$%^', 'ascii').toString('hex'),
|
||||||
|
'31323334353621402324255e'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('base64 buffer to utf8', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('1YHXkGFi', 'base64').toString('utf8'),
|
||||||
|
'Ձאab'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('hex buffer to utf8', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('d581d7906162', 'hex').toString('utf8'),
|
||||||
|
'Ձאab'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('base64 buffer to ascii', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('MTIzNDU2IUAjJCVe', 'base64').toString('ascii'),
|
||||||
|
'123456!@#$%^'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('hex buffer to ascii', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('31323334353621402324255e', 'hex').toString('ascii'),
|
||||||
|
'123456!@#$%^'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('base64 buffer to binary', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('MTIzNDU2IUAjJCVe', 'base64').toString('binary'),
|
||||||
|
'123456!@#$%^'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('hex buffer to binary', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('31323334353621402324255e', 'hex').toString('binary'),
|
||||||
|
'123456!@#$%^'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('utf8 to binary', function (t) {
|
||||||
|
/* jshint -W100 */
|
||||||
|
t.equal(
|
||||||
|
new B('öäüõÖÄÜÕ', 'utf8').toString('binary'),
|
||||||
|
'öäüõÃÃÃÃ'
|
||||||
|
)
|
||||||
|
/* jshint +W100 */
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('utf8 replacement chars (1 byte sequence)', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B([ 0x80 ]).toString(),
|
||||||
|
'\uFFFD'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0x7F ]).toString(),
|
||||||
|
'\u007F'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('utf8 replacement chars (2 byte sequences)', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xC7 ]).toString(),
|
||||||
|
'\uFFFD'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xC7, 0xB1 ]).toString(),
|
||||||
|
'\u01F1'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xC0, 0xB1 ]).toString(),
|
||||||
|
'\uFFFD\uFFFD'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xC1, 0xB1 ]).toString(),
|
||||||
|
'\uFFFD\uFFFD'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('utf8 replacement chars (3 byte sequences)', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xE0 ]).toString(),
|
||||||
|
'\uFFFD'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xE0, 0xAC ]).toString(),
|
||||||
|
'\uFFFD\uFFFD'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xE0, 0xAC, 0xB9 ]).toString(),
|
||||||
|
'\u0B39'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('utf8 replacement chars (4 byte sequences)', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xF4 ]).toString(),
|
||||||
|
'\uFFFD'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xF4, 0x8F ]).toString(),
|
||||||
|
'\uFFFD\uFFFD'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xF4, 0x8F, 0x80 ]).toString(),
|
||||||
|
'\uFFFD\uFFFD\uFFFD'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xF4, 0x8F, 0x80, 0x84 ]).toString(),
|
||||||
|
'\uDBFC\uDC04'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xFF ]).toString(),
|
||||||
|
'\uFFFD'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xFF, 0x8F, 0x80, 0x84 ]).toString(),
|
||||||
|
'\uFFFD\uFFFD\uFFFD\uFFFD'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('utf8 replacement chars on 256 random bytes', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B([ 152, 130, 206, 23, 243, 238, 197, 44, 27, 86, 208, 36, 163, 184, 164, 21, 94, 242, 178, 46, 25, 26, 253, 178, 72, 147, 207, 112, 236, 68, 179, 190, 29, 83, 239, 147, 125, 55, 143, 19, 157, 68, 157, 58, 212, 224, 150, 39, 128, 24, 94, 225, 120, 121, 75, 192, 112, 19, 184, 142, 203, 36, 43, 85, 26, 147, 227, 139, 242, 186, 57, 78, 11, 102, 136, 117, 180, 210, 241, 92, 3, 215, 54, 167, 249, 1, 44, 225, 146, 86, 2, 42, 68, 21, 47, 238, 204, 153, 216, 252, 183, 66, 222, 255, 15, 202, 16, 51, 134, 1, 17, 19, 209, 76, 238, 38, 76, 19, 7, 103, 249, 5, 107, 137, 64, 62, 170, 57, 16, 85, 179, 193, 97, 86, 166, 196, 36, 148, 138, 193, 210, 69, 187, 38, 242, 97, 195, 219, 252, 244, 38, 1, 197, 18, 31, 246, 53, 47, 134, 52, 105, 72, 43, 239, 128, 203, 73, 93, 199, 75, 222, 220, 166, 34, 63, 236, 11, 212, 76, 243, 171, 110, 78, 39, 205, 204, 6, 177, 233, 212, 243, 0, 33, 41, 122, 118, 92, 252, 0, 157, 108, 120, 70, 137, 100, 223, 243, 171, 232, 66, 126, 111, 142, 33, 3, 39, 117, 27, 107, 54, 1, 217, 227, 132, 13, 166, 3, 73, 53, 127, 225, 236, 134, 219, 98, 214, 125, 148, 24, 64, 142, 111, 231, 194, 42, 150, 185, 10, 182, 163, 244, 19, 4, 59, 135, 16 ]).toString(),
|
||||||
|
'\uFFFD\uFFFD\uFFFD\u0017\uFFFD\uFFFD\uFFFD\u002C\u001B\u0056\uFFFD\u0024\uFFFD\uFFFD\uFFFD\u0015\u005E\uFFFD\uFFFD\u002E\u0019\u001A\uFFFD\uFFFD\u0048\uFFFD\uFFFD\u0070\uFFFD\u0044\uFFFD\uFFFD\u001D\u0053\uFFFD\uFFFD\u007D\u0037\uFFFD\u0013\uFFFD\u0044\uFFFD\u003A\uFFFD\uFFFD\uFFFD\u0027\uFFFD\u0018\u005E\uFFFD\u0078\u0079\u004B\uFFFD\u0070\u0013\uFFFD\uFFFD\uFFFD\u0024\u002B\u0055\u001A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0039\u004E\u000B\u0066\uFFFD\u0075\uFFFD\uFFFD\uFFFD\u005C\u0003\uFFFD\u0036\uFFFD\uFFFD\u0001\u002C\uFFFD\uFFFD\u0056\u0002\u002A\u0044\u0015\u002F\uFFFD\u0319\uFFFD\uFFFD\uFFFD\u0042\uFFFD\uFFFD\u000F\uFFFD\u0010\u0033\uFFFD\u0001\u0011\u0013\uFFFD\u004C\uFFFD\u0026\u004C\u0013\u0007\u0067\uFFFD\u0005\u006B\uFFFD\u0040\u003E\uFFFD\u0039\u0010\u0055\uFFFD\uFFFD\u0061\u0056\uFFFD\uFFFD\u0024\uFFFD\uFFFD\uFFFD\uFFFD\u0045\uFFFD\u0026\uFFFD\u0061\uFFFD\uFFFD\uFFFD\uFFFD\u0026\u0001\uFFFD\u0012\u001F\uFFFD\u0035\u002F\uFFFD\u0034\u0069\u0048\u002B\uFFFD\uFFFD\uFFFD\u0049\u005D\uFFFD\u004B\uFFFD\u0726\u0022\u003F\uFFFD\u000B\uFFFD\u004C\uFFFD\uFFFD\u006E\u004E\u0027\uFFFD\uFFFD\u0006\uFFFD\uFFFD\uFFFD\uFFFD\u0000\u0021\u0029\u007A\u0076\u005C\uFFFD\u0000\uFFFD\u006C\u0078\u0046\uFFFD\u0064\uFFFD\uFFFD\uFFFD\uFFFD\u0042\u007E\u006F\uFFFD\u0021\u0003\u0027\u0075\u001B\u006B\u0036\u0001\uFFFD\uFFFD\uFFFD\u000D\uFFFD\u0003\u0049\u0035\u007F\uFFFD\uFFFD\uFFFD\uFFFD\u0062\uFFFD\u007D\uFFFD\u0018\u0040\uFFFD\u006F\uFFFD\uFFFD\u002A\uFFFD\uFFFD\u000A\uFFFD\uFFFD\uFFFD\u0013\u0004\u003B\uFFFD\u0010'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('utf8 replacement chars for anything in the surrogate pair range', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xED, 0x9F, 0xBF ]).toString(),
|
||||||
|
'\uD7FF'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xED, 0xA0, 0x80 ]).toString(),
|
||||||
|
'\uFFFD\uFFFD\uFFFD'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xED, 0xBE, 0x8B ]).toString(),
|
||||||
|
'\uFFFD\uFFFD\uFFFD'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xED, 0xBF, 0xBF ]).toString(),
|
||||||
|
'\uFFFD\uFFFD\uFFFD'
|
||||||
|
)
|
||||||
|
t.equal(
|
||||||
|
new B([ 0xEE, 0x80, 0x80 ]).toString(),
|
||||||
|
'\uE000'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('utf8 don\'t replace the replacement char', function (t) {
|
||||||
|
t.equal(
|
||||||
|
new B('\uFFFD').toString(),
|
||||||
|
'\uFFFD'
|
||||||
|
)
|
||||||
|
t.end()
|
||||||
|
})
|
131
node_modules/buffer/test/write.js
generated
vendored
Normal file
131
node_modules/buffer/test/write.js
generated
vendored
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||||
|
var B = require('../').Buffer
|
||||||
|
var test = require('tape')
|
||||||
|
var isnan = require('is-nan')
|
||||||
|
|
||||||
|
test('buffer.write string should get parsed as number', function (t) {
|
||||||
|
var b = new B(64)
|
||||||
|
b.writeUInt16LE('1003', 0)
|
||||||
|
t.equal(b.readUInt16LE(0), 1003)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('buffer.writeUInt8 a fractional number will get Math.floored', function (t) {
|
||||||
|
// Some extra work is necessary to make this test pass with the Object implementation
|
||||||
|
|
||||||
|
var b = new B(1)
|
||||||
|
b.writeInt8(5.5, 0)
|
||||||
|
t.equal(b[0], 5)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('writeUint8 with a negative number throws', function (t) {
|
||||||
|
var buf = new B(1)
|
||||||
|
|
||||||
|
t.throws(function () {
|
||||||
|
buf.writeUInt8(-3, 0)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('hex of write{Uint,Int}{8,16,32}{LE,BE}', function (t) {
|
||||||
|
t.plan(2 * (2 * 2 * 2 + 2))
|
||||||
|
var hex = [
|
||||||
|
'03', '0300', '0003', '03000000', '00000003',
|
||||||
|
'fd', 'fdff', 'fffd', 'fdffffff', 'fffffffd'
|
||||||
|
]
|
||||||
|
var reads = [ 3, 3, 3, 3, 3, -3, -3, -3, -3, -3 ]
|
||||||
|
var xs = ['UInt', 'Int']
|
||||||
|
var ys = [8, 16, 32]
|
||||||
|
for (var i = 0; i < xs.length; i++) {
|
||||||
|
var x = xs[i]
|
||||||
|
for (var j = 0; j < ys.length; j++) {
|
||||||
|
var y = ys[j]
|
||||||
|
var endianesses = (y === 8) ? [''] : ['LE', 'BE']
|
||||||
|
for (var k = 0; k < endianesses.length; k++) {
|
||||||
|
var z = endianesses[k]
|
||||||
|
|
||||||
|
var v1 = new B(y / 8)
|
||||||
|
var writefn = 'write' + x + y + z
|
||||||
|
var val = (x === 'Int') ? -3 : 3
|
||||||
|
v1[writefn](val, 0)
|
||||||
|
t.equal(
|
||||||
|
v1.toString('hex'),
|
||||||
|
hex.shift()
|
||||||
|
)
|
||||||
|
var readfn = 'read' + x + y + z
|
||||||
|
t.equal(
|
||||||
|
v1[readfn](0),
|
||||||
|
reads.shift()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('hex of write{Uint,Int}{8,16,32}{LE,BE} with overflow', function (t) {
|
||||||
|
if (!B.TYPED_ARRAY_SUPPORT) {
|
||||||
|
t.pass('object impl: skipping overflow test')
|
||||||
|
t.end()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
t.plan(3 * (2 * 2 * 2 + 2))
|
||||||
|
var hex = [
|
||||||
|
'', '03', '00', '030000', '000000',
|
||||||
|
'', 'fd', 'ff', 'fdffff', 'ffffff'
|
||||||
|
]
|
||||||
|
var reads = [
|
||||||
|
undefined, 3, 0, NaN, 0,
|
||||||
|
undefined, 253, -256, 16777213, -256
|
||||||
|
]
|
||||||
|
var xs = ['UInt', 'Int']
|
||||||
|
var ys = [8, 16, 32]
|
||||||
|
for (var i = 0; i < xs.length; i++) {
|
||||||
|
var x = xs[i]
|
||||||
|
for (var j = 0; j < ys.length; j++) {
|
||||||
|
var y = ys[j]
|
||||||
|
var endianesses = (y === 8) ? [''] : ['LE', 'BE']
|
||||||
|
for (var k = 0; k < endianesses.length; k++) {
|
||||||
|
var z = endianesses[k]
|
||||||
|
|
||||||
|
var v1 = new B(y / 8 - 1)
|
||||||
|
var next = new B(4)
|
||||||
|
next.writeUInt32BE(0, 0)
|
||||||
|
var writefn = 'write' + x + y + z
|
||||||
|
var val = (x === 'Int') ? -3 : 3
|
||||||
|
v1[writefn](val, 0, true)
|
||||||
|
t.equal(
|
||||||
|
v1.toString('hex'),
|
||||||
|
hex.shift()
|
||||||
|
)
|
||||||
|
// check that nothing leaked to next buffer.
|
||||||
|
t.equal(next.readUInt32BE(0), 0)
|
||||||
|
// check that no bytes are read from next buffer.
|
||||||
|
next.writeInt32BE(~0, 0)
|
||||||
|
var readfn = 'read' + x + y + z
|
||||||
|
var r = reads.shift()
|
||||||
|
if (isnan(r)) t.pass('equal')
|
||||||
|
else t.equal(v1[readfn](0, true), r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
test('large values do not imporoperly roll over (ref #80)', function (t) {
|
||||||
|
var nums = [-25589992, -633756690, -898146932]
|
||||||
|
var out = new B(12)
|
||||||
|
out.fill(0)
|
||||||
|
out.writeInt32BE(nums[0], 0)
|
||||||
|
var newNum = out.readInt32BE(0)
|
||||||
|
t.equal(nums[0], newNum)
|
||||||
|
out.writeInt32BE(nums[1], 4)
|
||||||
|
newNum = out.readInt32BE(4)
|
||||||
|
t.equal(nums[1], newNum)
|
||||||
|
out.writeInt32BE(nums[2], 8)
|
||||||
|
newNum = out.readInt32BE(8)
|
||||||
|
t.equal(nums[2], newNum)
|
||||||
|
t.end()
|
||||||
|
})
|
389
node_modules/commander/CHANGELOG.md
generated
vendored
Normal file
389
node_modules/commander/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,389 @@
|
||||||
|
|
||||||
|
2.18.0 / 2018-09-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Standardize help output (#853)
|
||||||
|
* chmod 644 travis.yml (#851)
|
||||||
|
* add support for execute typescript subcommand via ts-node (#849)
|
||||||
|
|
||||||
|
2.17.1 / 2018-08-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix bug in command emit (#844)
|
||||||
|
|
||||||
|
2.17.0 / 2018-08-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fixed newline output after help information (#833)
|
||||||
|
* Fix to emit the action even without command (#778)
|
||||||
|
* npm update (#823)
|
||||||
|
|
||||||
|
2.16.0 / 2018-06-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Remove Makefile and `test/run` (#821)
|
||||||
|
* Make 'npm test' run on Windows (#820)
|
||||||
|
* Add badge to display install size (#807)
|
||||||
|
* chore: cache node_modules (#814)
|
||||||
|
* chore: remove Node.js 4 (EOL), add Node.js 10 (#813)
|
||||||
|
* fixed typo in readme (#812)
|
||||||
|
* Fix types (#804)
|
||||||
|
* Update eslint to resolve vulnerabilities in lodash (#799)
|
||||||
|
* updated readme with custom event listeners. (#791)
|
||||||
|
* fix tests (#794)
|
||||||
|
|
||||||
|
2.15.0 / 2018-03-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Update downloads badge to point to graph of downloads over time instead of duplicating link to npm
|
||||||
|
* Arguments description
|
||||||
|
|
||||||
|
2.14.1 / 2018-02-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix typing of help function
|
||||||
|
|
||||||
|
2.14.0 / 2018-02-05
|
||||||
|
==================
|
||||||
|
|
||||||
|
* only register the option:version event once
|
||||||
|
* Fixes issue #727: Passing empty string for option on command is set to undefined
|
||||||
|
* enable eqeqeq rule
|
||||||
|
* resolves #754 add linter configuration to project
|
||||||
|
* resolves #560 respect custom name for version option
|
||||||
|
* document how to override the version flag
|
||||||
|
* document using options per command
|
||||||
|
|
||||||
|
2.13.0 / 2018-01-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Do not print default for --no-
|
||||||
|
* remove trailing spaces in command help
|
||||||
|
* Update CI's Node.js to LTS and latest version
|
||||||
|
* typedefs: Command and Option types added to commander namespace
|
||||||
|
|
||||||
|
2.12.2 / 2017-11-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix: typings are not shipped
|
||||||
|
|
||||||
|
2.12.1 / 2017-11-23
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Move @types/node to dev dependency
|
||||||
|
|
||||||
|
2.12.0 / 2017-11-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add attributeName() method to Option objects
|
||||||
|
* Documentation updated for options with --no prefix
|
||||||
|
* typings: `outputHelp` takes a string as the first parameter
|
||||||
|
* typings: use overloads
|
||||||
|
* feat(typings): update to match js api
|
||||||
|
* Print default value in option help
|
||||||
|
* Fix translation error
|
||||||
|
* Fail when using same command and alias (#491)
|
||||||
|
* feat(typings): add help callback
|
||||||
|
* fix bug when description is add after command with options (#662)
|
||||||
|
* Format js code
|
||||||
|
* Rename History.md to CHANGELOG.md (#668)
|
||||||
|
* feat(typings): add typings to support TypeScript (#646)
|
||||||
|
* use current node
|
||||||
|
|
||||||
|
2.11.0 / 2017-07-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix help section order and padding (#652)
|
||||||
|
* feature: support for signals to subcommands (#632)
|
||||||
|
* Fixed #37, --help should not display first (#447)
|
||||||
|
* Fix translation errors. (#570)
|
||||||
|
* Add package-lock.json
|
||||||
|
* Remove engines
|
||||||
|
* Upgrade package version
|
||||||
|
* Prefix events to prevent conflicts between commands and options (#494)
|
||||||
|
* Removing dependency on graceful-readlink
|
||||||
|
* Support setting name in #name function and make it chainable
|
||||||
|
* Add .vscode directory to .gitignore (Visual Studio Code metadata)
|
||||||
|
* Updated link to ruby commander in readme files
|
||||||
|
|
||||||
|
2.10.0 / 2017-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Update .travis.yml. drop support for older node.js versions.
|
||||||
|
* Fix require arguments in README.md
|
||||||
|
* On SemVer you do not start from 0.0.1
|
||||||
|
* Add missing semi colon in readme
|
||||||
|
* Add save param to npm install
|
||||||
|
* node v6 travis test
|
||||||
|
* Update Readme_zh-CN.md
|
||||||
|
* Allow literal '--' to be passed-through as an argument
|
||||||
|
* Test subcommand alias help
|
||||||
|
* link build badge to master branch
|
||||||
|
* Support the alias of Git style sub-command
|
||||||
|
* added keyword commander for better search result on npm
|
||||||
|
* Fix Sub-Subcommands
|
||||||
|
* test node.js stable
|
||||||
|
* Fixes TypeError when a command has an option called `--description`
|
||||||
|
* Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets.
|
||||||
|
* Add chinese Readme file
|
||||||
|
|
||||||
|
2.9.0 / 2015-10-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Add option `isDefault` to set default subcommand #415 @Qix-
|
||||||
|
* Add callback to allow filtering or post-processing of help text #434 @djulien
|
||||||
|
* Fix `undefined` text in help information close #414 #416 @zhiyelee
|
||||||
|
|
||||||
|
2.8.1 / 2015-04-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Back out `support multiline description` Close #396 #397
|
||||||
|
|
||||||
|
2.8.0 / 2015-04-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee
|
||||||
|
* Fix bug in Git-style sub-commands #372 @zhiyelee
|
||||||
|
* Allow commands to be hidden from help #383 @tonylukasavage
|
||||||
|
* When git-style sub-commands are in use, yet none are called, display help #382 @claylo
|
||||||
|
* Add ability to specify arguments syntax for top-level command #258 @rrthomas
|
||||||
|
* Support multiline descriptions #208 @zxqfox
|
||||||
|
|
||||||
|
2.7.1 / 2015-03-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367.
|
||||||
|
|
||||||
|
2.7.0 / 2015-03-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix git-style bug when installed globally. Close #335 #349 @zhiyelee
|
||||||
|
* Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage
|
||||||
|
* Add support for camelCase on `opts()`. Close #353 @nkzawa
|
||||||
|
* Add node.js 0.12 and io.js to travis.yml
|
||||||
|
* Allow RegEx options. #337 @palanik
|
||||||
|
* Fixes exit code when sub-command failing. Close #260 #332 @pirelenito
|
||||||
|
* git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee
|
||||||
|
|
||||||
|
2.6.0 / 2014-12-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee
|
||||||
|
* Add application description to the help msg. Close #112 @dalssoft
|
||||||
|
|
||||||
|
2.5.1 / 2014-12-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee
|
||||||
|
|
||||||
|
2.5.0 / 2014-10-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add support for variadic arguments. Closes #277 @whitlockjc
|
||||||
|
|
||||||
|
2.4.0 / 2014-10-17
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fixed a bug on executing the coercion function of subcommands option. Closes #270
|
||||||
|
* added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage
|
||||||
|
* added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage
|
||||||
|
* fixed a bug on subcommand name. Closes #248 @jonathandelgado
|
||||||
|
* fixed function normalize doesn’t honor option terminator. Closes #216 @abbr
|
||||||
|
|
||||||
|
2.3.0 / 2014-07-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add command alias'. Closes PR #210
|
||||||
|
* fix: Typos. Closes #99
|
||||||
|
* fix: Unused fs module. Closes #217
|
||||||
|
|
||||||
|
2.2.0 / 2014-03-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add passing of previous option value
|
||||||
|
* fix: support subcommands on windows. Closes #142
|
||||||
|
* Now the defaultValue passed as the second argument of the coercion function.
|
||||||
|
|
||||||
|
2.1.0 / 2013-11-21
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add: allow cflag style option params, unit test, fixes #174
|
||||||
|
|
||||||
|
2.0.0 / 2013-07-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* remove input methods (.prompt, .confirm, etc)
|
||||||
|
|
||||||
|
1.3.2 / 2013-07-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add support for sub-commands to co-exist with the original command
|
||||||
|
|
||||||
|
1.3.1 / 2013-07-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add quick .runningCommand hack so you can opt-out of other logic when running a sub command
|
||||||
|
|
||||||
|
1.3.0 / 2013-07-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add EACCES error handling
|
||||||
|
* fix sub-command --help
|
||||||
|
|
||||||
|
1.2.0 / 2013-06-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* allow "-" hyphen as an option argument
|
||||||
|
* support for RegExp coercion
|
||||||
|
|
||||||
|
1.1.1 / 2012-11-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add more sub-command padding
|
||||||
|
* fix .usage() when args are present. Closes #106
|
||||||
|
|
||||||
|
1.1.0 / 2012-11-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add git-style executable subcommand support. Closes #94
|
||||||
|
|
||||||
|
1.0.5 / 2012-10-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix `--name` clobbering. Closes #92
|
||||||
|
* fix examples/help. Closes #89
|
||||||
|
|
||||||
|
1.0.4 / 2012-09-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `outputHelp()` method.
|
||||||
|
|
||||||
|
1.0.3 / 2012-08-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* remove invalid .version() defaulting
|
||||||
|
|
||||||
|
1.0.2 / 2012-08-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add `--foo=bar` support [arv]
|
||||||
|
* fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
|
||||||
|
|
||||||
|
1.0.1 / 2012-08-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix issue #56
|
||||||
|
* fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
|
||||||
|
|
||||||
|
1.0.0 / 2012-07-05
|
||||||
|
==================
|
||||||
|
|
||||||
|
* add support for optional option descriptions
|
||||||
|
* add defaulting of `.version()` to package.json's version
|
||||||
|
|
||||||
|
0.6.1 / 2012-06-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added: append (yes or no) on confirmation
|
||||||
|
* Added: allow node.js v0.7.x
|
||||||
|
|
||||||
|
0.6.0 / 2012-04-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added `.prompt(obj, callback)` support. Closes #49
|
||||||
|
* Added default support to .choose(). Closes #41
|
||||||
|
* Fixed the choice example
|
||||||
|
|
||||||
|
0.5.1 / 2011-12-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fixed `password()` for recent nodes. Closes #36
|
||||||
|
|
||||||
|
0.5.0 / 2011-12-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added sub-command option support [itay]
|
||||||
|
|
||||||
|
0.4.3 / 2011-12-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fixed custom help ordering. Closes #32
|
||||||
|
|
||||||
|
0.4.2 / 2011-11-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added travis support
|
||||||
|
* Fixed: line-buffered input automatically trimmed. Closes #31
|
||||||
|
|
||||||
|
0.4.1 / 2011-11-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Removed listening for "close" on --help
|
||||||
|
|
||||||
|
0.4.0 / 2011-11-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added support for `--`. Closes #24
|
||||||
|
|
||||||
|
0.3.3 / 2011-11-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fixed: wait for close event when writing help info [Jerry Hamlet]
|
||||||
|
|
||||||
|
0.3.2 / 2011-11-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fixed long flag definitions with values [felixge]
|
||||||
|
|
||||||
|
0.3.1 / 2011-10-31
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Changed `--version` short flag to `-V` from `-v`
|
||||||
|
* Changed `.version()` so it's configurable [felixge]
|
||||||
|
|
||||||
|
0.3.0 / 2011-10-31
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added support for long flags only. Closes #18
|
||||||
|
|
||||||
|
0.2.1 / 2011-10-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* "node": ">= 0.4.x < 0.7.0". Closes #20
|
||||||
|
|
||||||
|
0.2.0 / 2011-09-26
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
|
||||||
|
|
||||||
|
0.1.0 / 2011-08-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added support for custom `--help` output
|
||||||
|
|
||||||
|
0.0.5 / 2011-08-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Changed: when the user enters nothing prompt for password again
|
||||||
|
* Fixed issue with passwords beginning with numbers [NuckChorris]
|
||||||
|
|
||||||
|
0.0.4 / 2011-08-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fixed `Commander#args`
|
||||||
|
|
||||||
|
0.0.3 / 2011-08-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added default option value support
|
||||||
|
|
||||||
|
0.0.2 / 2011-08-15
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Added mask support to `Command#password(str[, mask], fn)`
|
||||||
|
* Added `Command#password(str, fn)`
|
||||||
|
|
||||||
|
0.0.1 / 2010-01-03
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Initial release
|
22
node_modules/commander/LICENSE
generated
vendored
Normal file
22
node_modules/commander/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||||
|
|
||||||
|
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.
|
421
node_modules/commander/Readme.md
generated
vendored
Normal file
421
node_modules/commander/Readme.md
generated
vendored
Normal file
|
@ -0,0 +1,421 @@
|
||||||
|
# Commander.js
|
||||||
|
|
||||||
|
|
||||||
|
[![Build Status](https://api.travis-ci.org/tj/commander.js.svg?branch=master)](http://travis-ci.org/tj/commander.js)
|
||||||
|
[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
|
||||||
|
[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true)
|
||||||
|
[![Install Size](https://packagephobia.now.sh/badge?p=commander)](https://packagephobia.now.sh/result?p=commander)
|
||||||
|
[![Join the chat at https://gitter.im/tj/commander.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
||||||
|
The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/commander-rb/commander).
|
||||||
|
[API documentation](http://tj.github.com/commander.js/)
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
$ npm install commander --save
|
||||||
|
|
||||||
|
## Option parsing
|
||||||
|
|
||||||
|
Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
|
||||||
|
|
||||||
|
```js
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.option('-p, --peppers', 'Add peppers')
|
||||||
|
.option('-P, --pineapple', 'Add pineapple')
|
||||||
|
.option('-b, --bbq-sauce', 'Add bbq sauce')
|
||||||
|
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
|
||||||
|
.parse(process.argv);
|
||||||
|
|
||||||
|
console.log('you ordered a pizza with:');
|
||||||
|
if (program.peppers) console.log(' - peppers');
|
||||||
|
if (program.pineapple) console.log(' - pineapple');
|
||||||
|
if (program.bbqSauce) console.log(' - bbq');
|
||||||
|
console.log(' - %s cheese', program.cheese);
|
||||||
|
```
|
||||||
|
|
||||||
|
Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
|
||||||
|
|
||||||
|
Note that multi-word options starting with `--no` prefix negate the boolean value of the following word. For example, `--no-sauce` sets the value of `program.sauce` to false.
|
||||||
|
|
||||||
|
```js
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.option('--no-sauce', 'Remove sauce')
|
||||||
|
.parse(process.argv);
|
||||||
|
|
||||||
|
console.log('you ordered a pizza');
|
||||||
|
if (program.sauce) console.log(' with sauce');
|
||||||
|
else console.log(' without sauce');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version option
|
||||||
|
|
||||||
|
Calling the `version` implicitly adds the `-V` and `--version` options to the command.
|
||||||
|
When either of these options is present, the command prints the version number and exits.
|
||||||
|
|
||||||
|
$ ./examples/pizza -V
|
||||||
|
0.0.1
|
||||||
|
|
||||||
|
If you want your program to respond to the `-v` option instead of the `-V` option, simply pass custom flags to the `version` method using the same syntax as the `option` method.
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.version('0.0.1', '-v, --version')
|
||||||
|
```
|
||||||
|
|
||||||
|
The version flags can be named anything, but the long option is required.
|
||||||
|
|
||||||
|
## Command-specific options
|
||||||
|
|
||||||
|
You can attach options to a command.
|
||||||
|
|
||||||
|
```js
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('rm <dir>')
|
||||||
|
.option('-r, --recursive', 'Remove recursively')
|
||||||
|
.action(function (dir, cmd) {
|
||||||
|
console.log('remove ' + dir + (cmd.recursive ? ' recursively' : ''))
|
||||||
|
})
|
||||||
|
|
||||||
|
program.parse(process.argv)
|
||||||
|
```
|
||||||
|
|
||||||
|
A command's options are validated when the command is used. Any unknown options will be reported as an error. However, if an action-based command does not define an action, then the options are not validated.
|
||||||
|
|
||||||
|
## Coercion
|
||||||
|
|
||||||
|
```js
|
||||||
|
function range(val) {
|
||||||
|
return val.split('..').map(Number);
|
||||||
|
}
|
||||||
|
|
||||||
|
function list(val) {
|
||||||
|
return val.split(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
function collect(val, memo) {
|
||||||
|
memo.push(val);
|
||||||
|
return memo;
|
||||||
|
}
|
||||||
|
|
||||||
|
function increaseVerbosity(v, total) {
|
||||||
|
return total + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.usage('[options] <file ...>')
|
||||||
|
.option('-i, --integer <n>', 'An integer argument', parseInt)
|
||||||
|
.option('-f, --float <n>', 'A float argument', parseFloat)
|
||||||
|
.option('-r, --range <a>..<b>', 'A range', range)
|
||||||
|
.option('-l, --list <items>', 'A list', list)
|
||||||
|
.option('-o, --optional [value]', 'An optional value')
|
||||||
|
.option('-c, --collect [value]', 'A repeatable value', collect, [])
|
||||||
|
.option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
|
||||||
|
.parse(process.argv);
|
||||||
|
|
||||||
|
console.log(' int: %j', program.integer);
|
||||||
|
console.log(' float: %j', program.float);
|
||||||
|
console.log(' optional: %j', program.optional);
|
||||||
|
program.range = program.range || [];
|
||||||
|
console.log(' range: %j..%j', program.range[0], program.range[1]);
|
||||||
|
console.log(' list: %j', program.list);
|
||||||
|
console.log(' collect: %j', program.collect);
|
||||||
|
console.log(' verbosity: %j', program.verbose);
|
||||||
|
console.log(' args: %j', program.args);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Regular Expression
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.option('-s --size <size>', 'Pizza size', /^(large|medium|small)$/i, 'medium')
|
||||||
|
.option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i)
|
||||||
|
.parse(process.argv);
|
||||||
|
|
||||||
|
console.log(' size: %j', program.size);
|
||||||
|
console.log(' drink: %j', program.drink);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Variadic arguments
|
||||||
|
|
||||||
|
The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to
|
||||||
|
append `...` to the argument name. Here is an example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.command('rmdir <dir> [otherDirs...]')
|
||||||
|
.action(function (dir, otherDirs) {
|
||||||
|
console.log('rmdir %s', dir);
|
||||||
|
if (otherDirs) {
|
||||||
|
otherDirs.forEach(function (oDir) {
|
||||||
|
console.log('rmdir %s', oDir);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
```
|
||||||
|
|
||||||
|
An `Array` is used for the value of a variadic argument. This applies to `program.args` as well as the argument passed
|
||||||
|
to your action as demonstrated above.
|
||||||
|
|
||||||
|
## Specify the argument syntax
|
||||||
|
|
||||||
|
```js
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.arguments('<cmd> [env]')
|
||||||
|
.action(function (cmd, env) {
|
||||||
|
cmdValue = cmd;
|
||||||
|
envValue = env;
|
||||||
|
});
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
|
||||||
|
if (typeof cmdValue === 'undefined') {
|
||||||
|
console.error('no command given!');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
console.log('command:', cmdValue);
|
||||||
|
console.log('environment:', envValue || "no environment given");
|
||||||
|
```
|
||||||
|
Angled brackets (e.g. `<cmd>`) indicate required input. Square brackets (e.g. `[env]`) indicate optional input.
|
||||||
|
|
||||||
|
## Git-style sub-commands
|
||||||
|
|
||||||
|
```js
|
||||||
|
// file: ./examples/pm
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.command('install [name]', 'install one or more packages')
|
||||||
|
.command('search [query]', 'search with optional query')
|
||||||
|
.command('list', 'list packages installed', {isDefault: true})
|
||||||
|
.parse(process.argv);
|
||||||
|
```
|
||||||
|
|
||||||
|
When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools.
|
||||||
|
The commander will try to search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-command`, like `pm-install`, `pm-search`.
|
||||||
|
|
||||||
|
Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the subcommand from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified.
|
||||||
|
|
||||||
|
If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.
|
||||||
|
|
||||||
|
### `--harmony`
|
||||||
|
|
||||||
|
You can enable `--harmony` option in two ways:
|
||||||
|
* Use `#! /usr/bin/env node --harmony` in the sub-commands scripts. Note some os version don’t support this pattern.
|
||||||
|
* Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning sub-command process.
|
||||||
|
|
||||||
|
## Automated --help
|
||||||
|
|
||||||
|
The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./examples/pizza --help
|
||||||
|
Usage: pizza [options]
|
||||||
|
|
||||||
|
An application for pizzas ordering
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
-h, --help output usage information
|
||||||
|
-V, --version output the version number
|
||||||
|
-p, --peppers Add peppers
|
||||||
|
-P, --pineapple Add pineapple
|
||||||
|
-b, --bbq Add bbq sauce
|
||||||
|
-c, --cheese <type> Add the specified type of cheese [marble]
|
||||||
|
-C, --no-cheese You do not want any cheese
|
||||||
|
```
|
||||||
|
|
||||||
|
## Custom help
|
||||||
|
|
||||||
|
You can display arbitrary `-h, --help` information
|
||||||
|
by listening for "--help". Commander will automatically
|
||||||
|
exit once you are done so that the remainder of your program
|
||||||
|
does not execute causing undesired behaviors, for example
|
||||||
|
in the following executable "stuff" will not output when
|
||||||
|
`--help` is used.
|
||||||
|
|
||||||
|
```js
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.option('-f, --foo', 'enable some foo')
|
||||||
|
.option('-b, --bar', 'enable some bar')
|
||||||
|
.option('-B, --baz', 'enable some baz');
|
||||||
|
|
||||||
|
// must be before .parse() since
|
||||||
|
// node's emit() is immediate
|
||||||
|
|
||||||
|
program.on('--help', function(){
|
||||||
|
console.log('')
|
||||||
|
console.log('Examples:');
|
||||||
|
console.log('');
|
||||||
|
console.log(' $ custom-help --help');
|
||||||
|
console.log(' $ custom-help -h');
|
||||||
|
});
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
|
||||||
|
console.log('stuff');
|
||||||
|
```
|
||||||
|
|
||||||
|
Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run:
|
||||||
|
|
||||||
|
```
|
||||||
|
Usage: custom-help [options]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
-h, --help output usage information
|
||||||
|
-V, --version output the version number
|
||||||
|
-f, --foo enable some foo
|
||||||
|
-b, --bar enable some bar
|
||||||
|
-B, --baz enable some baz
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
$ custom-help --help
|
||||||
|
$ custom-help -h
|
||||||
|
```
|
||||||
|
|
||||||
|
## .outputHelp(cb)
|
||||||
|
|
||||||
|
Output help information without exiting.
|
||||||
|
Optional callback cb allows post-processing of help text before it is displayed.
|
||||||
|
|
||||||
|
If you want to display help by default (e.g. if no command was provided), you can use something like:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var program = require('commander');
|
||||||
|
var colors = require('colors');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.command('getstream [url]', 'get stream URL')
|
||||||
|
.parse(process.argv);
|
||||||
|
|
||||||
|
if (!process.argv.slice(2).length) {
|
||||||
|
program.outputHelp(make_red);
|
||||||
|
}
|
||||||
|
|
||||||
|
function make_red(txt) {
|
||||||
|
return colors.red(txt); //display the help text in red on the console
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## .help(cb)
|
||||||
|
|
||||||
|
Output help information and exit immediately.
|
||||||
|
Optional callback cb allows post-processing of help text before it is displayed.
|
||||||
|
|
||||||
|
|
||||||
|
## Custom event listeners
|
||||||
|
You can execute custom actions by listening to command and option events.
|
||||||
|
|
||||||
|
```js
|
||||||
|
program.on('option:verbose', function () {
|
||||||
|
process.env.VERBOSE = this.verbose;
|
||||||
|
});
|
||||||
|
|
||||||
|
// error on unknown commands
|
||||||
|
program.on('command:*', function () {
|
||||||
|
console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' '));
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
```js
|
||||||
|
var program = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.option('-C, --chdir <path>', 'change the working directory')
|
||||||
|
.option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||||
|
.option('-T, --no-tests', 'ignore test hook');
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('setup [env]')
|
||||||
|
.description('run setup commands for all envs')
|
||||||
|
.option("-s, --setup_mode [mode]", "Which setup mode to use")
|
||||||
|
.action(function(env, options){
|
||||||
|
var mode = options.setup_mode || "normal";
|
||||||
|
env = env || 'all';
|
||||||
|
console.log('setup for %s env(s) with %s mode', env, mode);
|
||||||
|
});
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('exec <cmd>')
|
||||||
|
.alias('ex')
|
||||||
|
.description('execute the given remote cmd')
|
||||||
|
.option("-e, --exec_mode <mode>", "Which exec mode to use")
|
||||||
|
.action(function(cmd, options){
|
||||||
|
console.log('exec "%s" using %s mode', cmd, options.exec_mode);
|
||||||
|
}).on('--help', function() {
|
||||||
|
console.log('');
|
||||||
|
console.log('Examples:');
|
||||||
|
console.log('');
|
||||||
|
console.log(' $ deploy exec sequential');
|
||||||
|
console.log(' $ deploy exec async');
|
||||||
|
});
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('*')
|
||||||
|
.action(function(env){
|
||||||
|
console.log('deploying "%s"', env);
|
||||||
|
});
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
```
|
||||||
|
|
||||||
|
More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
1237
node_modules/commander/index.js
generated
vendored
Normal file
1237
node_modules/commander/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
309
node_modules/commander/typings/index.d.ts
generated
vendored
Normal file
309
node_modules/commander/typings/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,309 @@
|
||||||
|
// Type definitions for commander 2.11
|
||||||
|
// Project: https://github.com/visionmedia/commander.js
|
||||||
|
// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
|
||||||
|
declare namespace local {
|
||||||
|
|
||||||
|
class Option {
|
||||||
|
flags: string;
|
||||||
|
required: boolean;
|
||||||
|
optional: boolean;
|
||||||
|
bool: boolean;
|
||||||
|
short?: string;
|
||||||
|
long: string;
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize a new `Option` with the given `flags` and `description`.
|
||||||
|
*
|
||||||
|
* @param {string} flags
|
||||||
|
* @param {string} [description]
|
||||||
|
*/
|
||||||
|
constructor(flags: string, description?: string);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Command extends NodeJS.EventEmitter {
|
||||||
|
[key: string]: any;
|
||||||
|
|
||||||
|
args: string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize a new `Command`.
|
||||||
|
*
|
||||||
|
* @param {string} [name]
|
||||||
|
*/
|
||||||
|
constructor(name?: string);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the program version to `str`.
|
||||||
|
*
|
||||||
|
* This method auto-registers the "-V, --version" flag
|
||||||
|
* which will print the version number when passed.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @param {string} [flags]
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
version(str: string, flags?: string): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add command `name`.
|
||||||
|
*
|
||||||
|
* The `.action()` callback is invoked when the
|
||||||
|
* command `name` is specified via __ARGV__,
|
||||||
|
* and the remaining arguments are applied to the
|
||||||
|
* function for access.
|
||||||
|
*
|
||||||
|
* When the `name` is "*" an un-matched command
|
||||||
|
* will be passed as the first arg, followed by
|
||||||
|
* the rest of __ARGV__ remaining.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* program
|
||||||
|
* .version('0.0.1')
|
||||||
|
* .option('-C, --chdir <path>', 'change the working directory')
|
||||||
|
* .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||||
|
* .option('-T, --no-tests', 'ignore test hook')
|
||||||
|
*
|
||||||
|
* program
|
||||||
|
* .command('setup')
|
||||||
|
* .description('run remote setup commands')
|
||||||
|
* .action(function() {
|
||||||
|
* console.log('setup');
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* program
|
||||||
|
* .command('exec <cmd>')
|
||||||
|
* .description('run the given remote command')
|
||||||
|
* .action(function(cmd) {
|
||||||
|
* console.log('exec "%s"', cmd);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* program
|
||||||
|
* .command('teardown <dir> [otherDirs...]')
|
||||||
|
* .description('run teardown commands')
|
||||||
|
* .action(function(dir, otherDirs) {
|
||||||
|
* console.log('dir "%s"', dir);
|
||||||
|
* if (otherDirs) {
|
||||||
|
* otherDirs.forEach(function (oDir) {
|
||||||
|
* console.log('dir "%s"', oDir);
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* program
|
||||||
|
* .command('*')
|
||||||
|
* .description('deploy the given env')
|
||||||
|
* .action(function(env) {
|
||||||
|
* console.log('deploying "%s"', env);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* program.parse(process.argv);
|
||||||
|
*
|
||||||
|
* @param {string} name
|
||||||
|
* @param {string} [desc] for git-style sub-commands
|
||||||
|
* @param {CommandOptions} [opts] command options
|
||||||
|
* @returns {Command} the new command
|
||||||
|
*/
|
||||||
|
command(name: string, desc?: string, opts?: commander.CommandOptions): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define argument syntax for the top-level command.
|
||||||
|
*
|
||||||
|
* @param {string} desc
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
arguments(desc: string): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse expected `args`.
|
||||||
|
*
|
||||||
|
* For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
|
||||||
|
*
|
||||||
|
* @param {string[]} args
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
parseExpectedArgs(args: string[]): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register callback `fn` for the command.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* program
|
||||||
|
* .command('help')
|
||||||
|
* .description('display verbose help')
|
||||||
|
* .action(function() {
|
||||||
|
* // output help here
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* @param {(...args: any[]) => void} fn
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
action(fn: (...args: any[]) => void): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define option with `flags`, `description` and optional
|
||||||
|
* coercion `fn`.
|
||||||
|
*
|
||||||
|
* The `flags` string should contain both the short and long flags,
|
||||||
|
* separated by comma, a pipe or space. The following are all valid
|
||||||
|
* all will output this way when `--help` is used.
|
||||||
|
*
|
||||||
|
* "-p, --pepper"
|
||||||
|
* "-p|--pepper"
|
||||||
|
* "-p --pepper"
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // simple boolean defaulting to false
|
||||||
|
* program.option('-p, --pepper', 'add pepper');
|
||||||
|
*
|
||||||
|
* --pepper
|
||||||
|
* program.pepper
|
||||||
|
* // => Boolean
|
||||||
|
*
|
||||||
|
* // simple boolean defaulting to true
|
||||||
|
* program.option('-C, --no-cheese', 'remove cheese');
|
||||||
|
*
|
||||||
|
* program.cheese
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* --no-cheese
|
||||||
|
* program.cheese
|
||||||
|
* // => false
|
||||||
|
*
|
||||||
|
* // required argument
|
||||||
|
* program.option('-C, --chdir <path>', 'change the working directory');
|
||||||
|
*
|
||||||
|
* --chdir /tmp
|
||||||
|
* program.chdir
|
||||||
|
* // => "/tmp"
|
||||||
|
*
|
||||||
|
* // optional argument
|
||||||
|
* program.option('-c, --cheese [type]', 'add cheese [marble]');
|
||||||
|
*
|
||||||
|
* @param {string} flags
|
||||||
|
* @param {string} [description]
|
||||||
|
* @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default
|
||||||
|
* @param {*} [defaultValue]
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command;
|
||||||
|
option(flags: string, description?: string, defaultValue?: any): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow unknown options on the command line.
|
||||||
|
*
|
||||||
|
* @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options.
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
allowUnknownOption(arg?: boolean): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse `argv`, settings options and invoking commands when defined.
|
||||||
|
*
|
||||||
|
* @param {string[]} argv
|
||||||
|
* @returns {Command} for chaining
|
||||||
|
*/
|
||||||
|
parse(argv: string[]): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse options from `argv` returning `argv` void of these options.
|
||||||
|
*
|
||||||
|
* @param {string[]} argv
|
||||||
|
* @returns {ParseOptionsResult}
|
||||||
|
*/
|
||||||
|
parseOptions(argv: string[]): commander.ParseOptionsResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an object containing options as key-value pairs
|
||||||
|
*
|
||||||
|
* @returns {{[key: string]: any}}
|
||||||
|
*/
|
||||||
|
opts(): { [key: string]: any };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the description to `str`.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @return {(Command | string)}
|
||||||
|
*/
|
||||||
|
description(str: string): Command;
|
||||||
|
description(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an alias for the command.
|
||||||
|
*
|
||||||
|
* @param {string} alias
|
||||||
|
* @return {(Command | string)}
|
||||||
|
*/
|
||||||
|
alias(alias: string): Command;
|
||||||
|
alias(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set or get the command usage.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @return {(Command | string)}
|
||||||
|
*/
|
||||||
|
usage(str: string): Command;
|
||||||
|
usage(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the name of the command.
|
||||||
|
*
|
||||||
|
* @param {string} str
|
||||||
|
* @return {Command}
|
||||||
|
*/
|
||||||
|
name(str: string): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the command.
|
||||||
|
*
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
name(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output help information for this command.
|
||||||
|
*
|
||||||
|
* @param {(str: string) => string} [cb]
|
||||||
|
*/
|
||||||
|
outputHelp(cb?: (str: string) => string): void;
|
||||||
|
|
||||||
|
/** Output help information and exit.
|
||||||
|
*
|
||||||
|
* @param {(str: string) => string} [cb]
|
||||||
|
*/
|
||||||
|
help(cb?: (str: string) => string): never;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
declare namespace commander {
|
||||||
|
|
||||||
|
type Command = local.Command
|
||||||
|
|
||||||
|
type Option = local.Option
|
||||||
|
|
||||||
|
interface CommandOptions {
|
||||||
|
noHelp?: boolean;
|
||||||
|
isDefault?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ParseOptionsResult {
|
||||||
|
args: string[];
|
||||||
|
unknown: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CommanderStatic extends Command {
|
||||||
|
Command: typeof local.Command;
|
||||||
|
Option: typeof local.Option;
|
||||||
|
CommandOptions: CommandOptions;
|
||||||
|
ParseOptionsResult: ParseOptionsResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const commander: commander.CommanderStatic;
|
||||||
|
export = commander;
|
1
node_modules/common-tags/dist/common-tags.min.js
generated
vendored
Normal file
1
node_modules/common-tags/dist/common-tags.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
165
node_modules/common-tags/es/TemplateTag/TemplateTag.js
generated
vendored
Normal file
165
node_modules/common-tags/es/TemplateTag/TemplateTag.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/common-tags/es/TemplateTag/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/TemplateTag/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './TemplateTag';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9UZW1wbGF0ZVRhZy9pbmRleC5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0Il0sIm1hcHBpbmdzIjoicUJBQW9CLGU7cUJBQWJBLE8iLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCBmcm9tICcuL1RlbXBsYXRlVGFnJztcbiJdfQ==
|
3
node_modules/common-tags/es/codeBlock/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/codeBlock/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from '../html';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb2RlQmxvY2svaW5kZXguanMiXSwibmFtZXMiOlsiZGVmYXVsdCJdLCJtYXBwaW5ncyI6InFCQUFvQixTO3FCQUFiQSxPIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQgZnJvbSAnLi4vaHRtbCc7XG4iXX0=
|
9
node_modules/common-tags/es/commaLists/commaLists.js
generated
vendored
Normal file
9
node_modules/common-tags/es/commaLists/commaLists.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import TemplateTag from '../TemplateTag';
|
||||||
|
import stripIndentTransformer from '../stripIndentTransformer';
|
||||||
|
import inlineArrayTransformer from '../inlineArrayTransformer';
|
||||||
|
import trimResultTransformer from '../trimResultTransformer';
|
||||||
|
|
||||||
|
var commaLists = new TemplateTag(inlineArrayTransformer({ separator: ',' }), stripIndentTransformer, trimResultTransformer);
|
||||||
|
|
||||||
|
export default commaLists;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tYUxpc3RzL2NvbW1hTGlzdHMuanMiXSwibmFtZXMiOlsiVGVtcGxhdGVUYWciLCJzdHJpcEluZGVudFRyYW5zZm9ybWVyIiwiaW5saW5lQXJyYXlUcmFuc2Zvcm1lciIsInRyaW1SZXN1bHRUcmFuc2Zvcm1lciIsImNvbW1hTGlzdHMiLCJzZXBhcmF0b3IiXSwibWFwcGluZ3MiOiJBQUFBLE9BQU9BLFdBQVAsTUFBd0IsZ0JBQXhCO0FBQ0EsT0FBT0Msc0JBQVAsTUFBbUMsMkJBQW5DO0FBQ0EsT0FBT0Msc0JBQVAsTUFBbUMsMkJBQW5DO0FBQ0EsT0FBT0MscUJBQVAsTUFBa0MsMEJBQWxDOztBQUVBLElBQU1DLGFBQWEsSUFBSUosV0FBSixDQUNqQkUsdUJBQXVCLEVBQUVHLFdBQVcsR0FBYixFQUF2QixDQURpQixFQUVqQkosc0JBRmlCLEVBR2pCRSxxQkFIaUIsQ0FBbkI7O0FBTUEsZUFBZUMsVUFBZiIsImZpbGUiOiJjb21tYUxpc3RzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFRlbXBsYXRlVGFnIGZyb20gJy4uL1RlbXBsYXRlVGFnJztcbmltcG9ydCBzdHJpcEluZGVudFRyYW5zZm9ybWVyIGZyb20gJy4uL3N0cmlwSW5kZW50VHJhbnNmb3JtZXInO1xuaW1wb3J0IGlubGluZUFycmF5VHJhbnNmb3JtZXIgZnJvbSAnLi4vaW5saW5lQXJyYXlUcmFuc2Zvcm1lcic7XG5pbXBvcnQgdHJpbVJlc3VsdFRyYW5zZm9ybWVyIGZyb20gJy4uL3RyaW1SZXN1bHRUcmFuc2Zvcm1lcic7XG5cbmNvbnN0IGNvbW1hTGlzdHMgPSBuZXcgVGVtcGxhdGVUYWcoXG4gIGlubGluZUFycmF5VHJhbnNmb3JtZXIoeyBzZXBhcmF0b3I6ICcsJyB9KSxcbiAgc3RyaXBJbmRlbnRUcmFuc2Zvcm1lcixcbiAgdHJpbVJlc3VsdFRyYW5zZm9ybWVyLFxuKTtcblxuZXhwb3J0IGRlZmF1bHQgY29tbWFMaXN0cztcbiJdfQ==
|
3
node_modules/common-tags/es/commaLists/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/commaLists/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './commaLists';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tYUxpc3RzL2luZGV4LmpzIl0sIm5hbWVzIjpbImRlZmF1bHQiXSwibWFwcGluZ3MiOiJxQkFBb0IsYztxQkFBYkEsTyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZyb20gJy4vY29tbWFMaXN0cyc7XG4iXX0=
|
9
node_modules/common-tags/es/commaListsAnd/commaListsAnd.js
generated
vendored
Normal file
9
node_modules/common-tags/es/commaListsAnd/commaListsAnd.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import TemplateTag from '../TemplateTag';
|
||||||
|
import stripIndentTransformer from '../stripIndentTransformer';
|
||||||
|
import inlineArrayTransformer from '../inlineArrayTransformer';
|
||||||
|
import trimResultTransformer from '../trimResultTransformer';
|
||||||
|
|
||||||
|
var commaListsAnd = new TemplateTag(inlineArrayTransformer({ separator: ',', conjunction: 'and' }), stripIndentTransformer, trimResultTransformer);
|
||||||
|
|
||||||
|
export default commaListsAnd;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tYUxpc3RzQW5kL2NvbW1hTGlzdHNBbmQuanMiXSwibmFtZXMiOlsiVGVtcGxhdGVUYWciLCJzdHJpcEluZGVudFRyYW5zZm9ybWVyIiwiaW5saW5lQXJyYXlUcmFuc2Zvcm1lciIsInRyaW1SZXN1bHRUcmFuc2Zvcm1lciIsImNvbW1hTGlzdHNBbmQiLCJzZXBhcmF0b3IiLCJjb25qdW5jdGlvbiJdLCJtYXBwaW5ncyI6IkFBQUEsT0FBT0EsV0FBUCxNQUF3QixnQkFBeEI7QUFDQSxPQUFPQyxzQkFBUCxNQUFtQywyQkFBbkM7QUFDQSxPQUFPQyxzQkFBUCxNQUFtQywyQkFBbkM7QUFDQSxPQUFPQyxxQkFBUCxNQUFrQywwQkFBbEM7O0FBRUEsSUFBTUMsZ0JBQWdCLElBQUlKLFdBQUosQ0FDcEJFLHVCQUF1QixFQUFFRyxXQUFXLEdBQWIsRUFBa0JDLGFBQWEsS0FBL0IsRUFBdkIsQ0FEb0IsRUFFcEJMLHNCQUZvQixFQUdwQkUscUJBSG9CLENBQXRCOztBQU1BLGVBQWVDLGFBQWYiLCJmaWxlIjoiY29tbWFMaXN0c0FuZC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBUZW1wbGF0ZVRhZyBmcm9tICcuLi9UZW1wbGF0ZVRhZyc7XG5pbXBvcnQgc3RyaXBJbmRlbnRUcmFuc2Zvcm1lciBmcm9tICcuLi9zdHJpcEluZGVudFRyYW5zZm9ybWVyJztcbmltcG9ydCBpbmxpbmVBcnJheVRyYW5zZm9ybWVyIGZyb20gJy4uL2lubGluZUFycmF5VHJhbnNmb3JtZXInO1xuaW1wb3J0IHRyaW1SZXN1bHRUcmFuc2Zvcm1lciBmcm9tICcuLi90cmltUmVzdWx0VHJhbnNmb3JtZXInO1xuXG5jb25zdCBjb21tYUxpc3RzQW5kID0gbmV3IFRlbXBsYXRlVGFnKFxuICBpbmxpbmVBcnJheVRyYW5zZm9ybWVyKHsgc2VwYXJhdG9yOiAnLCcsIGNvbmp1bmN0aW9uOiAnYW5kJyB9KSxcbiAgc3RyaXBJbmRlbnRUcmFuc2Zvcm1lcixcbiAgdHJpbVJlc3VsdFRyYW5zZm9ybWVyLFxuKTtcblxuZXhwb3J0IGRlZmF1bHQgY29tbWFMaXN0c0FuZDtcbiJdfQ==
|
3
node_modules/common-tags/es/commaListsAnd/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/commaListsAnd/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './commaListsAnd';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tYUxpc3RzQW5kL2luZGV4LmpzIl0sIm5hbWVzIjpbImRlZmF1bHQiXSwibWFwcGluZ3MiOiJxQkFBb0IsaUI7cUJBQWJBLE8iLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCBmcm9tICcuL2NvbW1hTGlzdHNBbmQnO1xuIl19
|
9
node_modules/common-tags/es/commaListsOr/commaListsOr.js
generated
vendored
Normal file
9
node_modules/common-tags/es/commaListsOr/commaListsOr.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import TemplateTag from '../TemplateTag';
|
||||||
|
import stripIndentTransformer from '../stripIndentTransformer';
|
||||||
|
import inlineArrayTransformer from '../inlineArrayTransformer';
|
||||||
|
import trimResultTransformer from '../trimResultTransformer';
|
||||||
|
|
||||||
|
var commaListsOr = new TemplateTag(inlineArrayTransformer({ separator: ',', conjunction: 'or' }), stripIndentTransformer, trimResultTransformer);
|
||||||
|
|
||||||
|
export default commaListsOr;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tYUxpc3RzT3IvY29tbWFMaXN0c09yLmpzIl0sIm5hbWVzIjpbIlRlbXBsYXRlVGFnIiwic3RyaXBJbmRlbnRUcmFuc2Zvcm1lciIsImlubGluZUFycmF5VHJhbnNmb3JtZXIiLCJ0cmltUmVzdWx0VHJhbnNmb3JtZXIiLCJjb21tYUxpc3RzT3IiLCJzZXBhcmF0b3IiLCJjb25qdW5jdGlvbiJdLCJtYXBwaW5ncyI6IkFBQUEsT0FBT0EsV0FBUCxNQUF3QixnQkFBeEI7QUFDQSxPQUFPQyxzQkFBUCxNQUFtQywyQkFBbkM7QUFDQSxPQUFPQyxzQkFBUCxNQUFtQywyQkFBbkM7QUFDQSxPQUFPQyxxQkFBUCxNQUFrQywwQkFBbEM7O0FBRUEsSUFBTUMsZUFBZSxJQUFJSixXQUFKLENBQ25CRSx1QkFBdUIsRUFBRUcsV0FBVyxHQUFiLEVBQWtCQyxhQUFhLElBQS9CLEVBQXZCLENBRG1CLEVBRW5CTCxzQkFGbUIsRUFHbkJFLHFCQUhtQixDQUFyQjs7QUFNQSxlQUFlQyxZQUFmIiwiZmlsZSI6ImNvbW1hTGlzdHNPci5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBUZW1wbGF0ZVRhZyBmcm9tICcuLi9UZW1wbGF0ZVRhZyc7XG5pbXBvcnQgc3RyaXBJbmRlbnRUcmFuc2Zvcm1lciBmcm9tICcuLi9zdHJpcEluZGVudFRyYW5zZm9ybWVyJztcbmltcG9ydCBpbmxpbmVBcnJheVRyYW5zZm9ybWVyIGZyb20gJy4uL2lubGluZUFycmF5VHJhbnNmb3JtZXInO1xuaW1wb3J0IHRyaW1SZXN1bHRUcmFuc2Zvcm1lciBmcm9tICcuLi90cmltUmVzdWx0VHJhbnNmb3JtZXInO1xuXG5jb25zdCBjb21tYUxpc3RzT3IgPSBuZXcgVGVtcGxhdGVUYWcoXG4gIGlubGluZUFycmF5VHJhbnNmb3JtZXIoeyBzZXBhcmF0b3I6ICcsJywgY29uanVuY3Rpb246ICdvcicgfSksXG4gIHN0cmlwSW5kZW50VHJhbnNmb3JtZXIsXG4gIHRyaW1SZXN1bHRUcmFuc2Zvcm1lcixcbik7XG5cbmV4cG9ydCBkZWZhdWx0IGNvbW1hTGlzdHNPcjtcbiJdfQ==
|
3
node_modules/common-tags/es/commaListsOr/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/commaListsOr/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './commaListsOr';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tYUxpc3RzT3IvaW5kZXguanMiXSwibmFtZXMiOlsiZGVmYXVsdCJdLCJtYXBwaW5ncyI6InFCQUFvQixnQjtxQkFBYkEsTyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZyb20gJy4vY29tbWFMaXN0c09yJztcbiJdfQ==
|
11
node_modules/common-tags/es/html/html.js
generated
vendored
Normal file
11
node_modules/common-tags/es/html/html.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import TemplateTag from '../TemplateTag';
|
||||||
|
import stripIndentTransformer from '../stripIndentTransformer';
|
||||||
|
import inlineArrayTransformer from '../inlineArrayTransformer';
|
||||||
|
import trimResultTransformer from '../trimResultTransformer';
|
||||||
|
import splitStringTransformer from '../splitStringTransformer';
|
||||||
|
import removeNonPrintingValuesTransformer from '../removeNonPrintingValuesTransformer';
|
||||||
|
|
||||||
|
var html = new TemplateTag(splitStringTransformer('\n'), removeNonPrintingValuesTransformer, inlineArrayTransformer, stripIndentTransformer, trimResultTransformer);
|
||||||
|
|
||||||
|
export default html;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9odG1sL2h0bWwuanMiXSwibmFtZXMiOlsiVGVtcGxhdGVUYWciLCJzdHJpcEluZGVudFRyYW5zZm9ybWVyIiwiaW5saW5lQXJyYXlUcmFuc2Zvcm1lciIsInRyaW1SZXN1bHRUcmFuc2Zvcm1lciIsInNwbGl0U3RyaW5nVHJhbnNmb3JtZXIiLCJyZW1vdmVOb25QcmludGluZ1ZhbHVlc1RyYW5zZm9ybWVyIiwiaHRtbCJdLCJtYXBwaW5ncyI6IkFBQUEsT0FBT0EsV0FBUCxNQUF3QixnQkFBeEI7QUFDQSxPQUFPQyxzQkFBUCxNQUFtQywyQkFBbkM7QUFDQSxPQUFPQyxzQkFBUCxNQUFtQywyQkFBbkM7QUFDQSxPQUFPQyxxQkFBUCxNQUFrQywwQkFBbEM7QUFDQSxPQUFPQyxzQkFBUCxNQUFtQywyQkFBbkM7QUFDQSxPQUFPQyxrQ0FBUCxNQUErQyx1Q0FBL0M7O0FBRUEsSUFBTUMsT0FBTyxJQUFJTixXQUFKLENBQ1hJLHVCQUF1QixJQUF2QixDQURXLEVBRVhDLGtDQUZXLEVBR1hILHNCQUhXLEVBSVhELHNCQUpXLEVBS1hFLHFCQUxXLENBQWI7O0FBUUEsZUFBZUcsSUFBZiIsImZpbGUiOiJodG1sLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFRlbXBsYXRlVGFnIGZyb20gJy4uL1RlbXBsYXRlVGFnJztcbmltcG9ydCBzdHJpcEluZGVudFRyYW5zZm9ybWVyIGZyb20gJy4uL3N0cmlwSW5kZW50VHJhbnNmb3JtZXInO1xuaW1wb3J0IGlubGluZUFycmF5VHJhbnNmb3JtZXIgZnJvbSAnLi4vaW5saW5lQXJyYXlUcmFuc2Zvcm1lcic7XG5pbXBvcnQgdHJpbVJlc3VsdFRyYW5zZm9ybWVyIGZyb20gJy4uL3RyaW1SZXN1bHRUcmFuc2Zvcm1lcic7XG5pbXBvcnQgc3BsaXRTdHJpbmdUcmFuc2Zvcm1lciBmcm9tICcuLi9zcGxpdFN0cmluZ1RyYW5zZm9ybWVyJztcbmltcG9ydCByZW1vdmVOb25QcmludGluZ1ZhbHVlc1RyYW5zZm9ybWVyIGZyb20gJy4uL3JlbW92ZU5vblByaW50aW5nVmFsdWVzVHJhbnNmb3JtZXInO1xuXG5jb25zdCBodG1sID0gbmV3IFRlbXBsYXRlVGFnKFxuICBzcGxpdFN0cmluZ1RyYW5zZm9ybWVyKCdcXG4nKSxcbiAgcmVtb3ZlTm9uUHJpbnRpbmdWYWx1ZXNUcmFuc2Zvcm1lcixcbiAgaW5saW5lQXJyYXlUcmFuc2Zvcm1lcixcbiAgc3RyaXBJbmRlbnRUcmFuc2Zvcm1lcixcbiAgdHJpbVJlc3VsdFRyYW5zZm9ybWVyLFxuKTtcblxuZXhwb3J0IGRlZmF1bHQgaHRtbDtcbiJdfQ==
|
3
node_modules/common-tags/es/html/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/html/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './html';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9odG1sL2luZGV4LmpzIl0sIm5hbWVzIjpbImRlZmF1bHQiXSwibWFwcGluZ3MiOiJxQkFBb0IsUTtxQkFBYkEsTyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZyb20gJy4vaHRtbCc7XG4iXX0=
|
58
node_modules/common-tags/es/index.js
generated
vendored
Normal file
58
node_modules/common-tags/es/index.js
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
// core
|
||||||
|
import _TemplateTag from './TemplateTag';
|
||||||
|
export { _TemplateTag as TemplateTag };
|
||||||
|
|
||||||
|
// transformers
|
||||||
|
|
||||||
|
import _trimResultTransformer from './trimResultTransformer';
|
||||||
|
export { _trimResultTransformer as trimResultTransformer };
|
||||||
|
import _stripIndentTransformer from './stripIndentTransformer';
|
||||||
|
export { _stripIndentTransformer as stripIndentTransformer };
|
||||||
|
import _replaceResultTransformer from './replaceResultTransformer';
|
||||||
|
export { _replaceResultTransformer as replaceResultTransformer };
|
||||||
|
import _replaceSubstitutionTransformer from './replaceSubstitutionTransformer';
|
||||||
|
export { _replaceSubstitutionTransformer as replaceSubstitutionTransformer };
|
||||||
|
import _replaceStringTransformer from './replaceStringTransformer';
|
||||||
|
export { _replaceStringTransformer as replaceStringTransformer };
|
||||||
|
import _inlineArrayTransformer from './inlineArrayTransformer';
|
||||||
|
export { _inlineArrayTransformer as inlineArrayTransformer };
|
||||||
|
import _splitStringTransformer from './splitStringTransformer';
|
||||||
|
export { _splitStringTransformer as splitStringTransformer };
|
||||||
|
import _removeNonPrintingValuesTransformer from './removeNonPrintingValuesTransformer';
|
||||||
|
export { _removeNonPrintingValuesTransformer as removeNonPrintingValuesTransformer };
|
||||||
|
|
||||||
|
// tags
|
||||||
|
|
||||||
|
import _commaLists from './commaLists';
|
||||||
|
export { _commaLists as commaLists };
|
||||||
|
import _commaListsAnd from './commaListsAnd';
|
||||||
|
export { _commaListsAnd as commaListsAnd };
|
||||||
|
import _commaListsOr from './commaListsOr';
|
||||||
|
export { _commaListsOr as commaListsOr };
|
||||||
|
import _html from './html';
|
||||||
|
export { _html as html };
|
||||||
|
import _codeBlock from './codeBlock';
|
||||||
|
export { _codeBlock as codeBlock };
|
||||||
|
import _source from './source';
|
||||||
|
export { _source as source };
|
||||||
|
import _safeHtml from './safeHtml';
|
||||||
|
export { _safeHtml as safeHtml };
|
||||||
|
import _oneLine from './oneLine';
|
||||||
|
export { _oneLine as oneLine };
|
||||||
|
import _oneLineTrim from './oneLineTrim';
|
||||||
|
export { _oneLineTrim as oneLineTrim };
|
||||||
|
import _oneLineCommaLists from './oneLineCommaLists';
|
||||||
|
export { _oneLineCommaLists as oneLineCommaLists };
|
||||||
|
import _oneLineCommaListsOr from './oneLineCommaListsOr';
|
||||||
|
export { _oneLineCommaListsOr as oneLineCommaListsOr };
|
||||||
|
import _oneLineCommaListsAnd from './oneLineCommaListsAnd';
|
||||||
|
export { _oneLineCommaListsAnd as oneLineCommaListsAnd };
|
||||||
|
import _inlineLists from './inlineLists';
|
||||||
|
export { _inlineLists as inlineLists };
|
||||||
|
import _oneLineInlineLists from './oneLineInlineLists';
|
||||||
|
export { _oneLineInlineLists as oneLineInlineLists };
|
||||||
|
import _stripIndent from './stripIndent';
|
||||||
|
export { _stripIndent as stripIndent };
|
||||||
|
import _stripIndents from './stripIndents';
|
||||||
|
export { _stripIndents as stripIndents };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJUZW1wbGF0ZVRhZyIsInRyaW1SZXN1bHRUcmFuc2Zvcm1lciIsInN0cmlwSW5kZW50VHJhbnNmb3JtZXIiLCJyZXBsYWNlUmVzdWx0VHJhbnNmb3JtZXIiLCJyZXBsYWNlU3Vic3RpdHV0aW9uVHJhbnNmb3JtZXIiLCJyZXBsYWNlU3RyaW5nVHJhbnNmb3JtZXIiLCJpbmxpbmVBcnJheVRyYW5zZm9ybWVyIiwic3BsaXRTdHJpbmdUcmFuc2Zvcm1lciIsInJlbW92ZU5vblByaW50aW5nVmFsdWVzVHJhbnNmb3JtZXIiLCJjb21tYUxpc3RzIiwiY29tbWFMaXN0c0FuZCIsImNvbW1hTGlzdHNPciIsImh0bWwiLCJjb2RlQmxvY2siLCJzb3VyY2UiLCJzYWZlSHRtbCIsIm9uZUxpbmUiLCJvbmVMaW5lVHJpbSIsIm9uZUxpbmVDb21tYUxpc3RzIiwib25lTGluZUNvbW1hTGlzdHNPciIsIm9uZUxpbmVDb21tYUxpc3RzQW5kIiwiaW5saW5lTGlzdHMiLCJvbmVMaW5lSW5saW5lTGlzdHMiLCJzdHJpcEluZGVudCIsInN0cmlwSW5kZW50cyJdLCJtYXBwaW5ncyI6IkFBQUE7eUJBQ3dCLGU7eUJBQWpCQSxXOztBQUVQOzttQ0FDa0MseUI7bUNBQTNCQyxxQjtvQ0FDNEIsMEI7b0NBQTVCQyxzQjtzQ0FDOEIsNEI7c0NBQTlCQyx3Qjs0Q0FDb0Msa0M7NENBQXBDQyw4QjtzQ0FDOEIsNEI7c0NBQTlCQyx3QjtvQ0FDNEIsMEI7b0NBQTVCQyxzQjtvQ0FDNEIsMEI7b0NBQTVCQyxzQjtnREFDd0Msc0M7Z0RBQXhDQyxrQzs7QUFFUDs7d0JBQ3VCLGM7d0JBQWhCQyxVOzJCQUNtQixpQjsyQkFBbkJDLGE7MEJBQ2tCLGdCOzBCQUFsQkMsWTtrQkFDVSxRO2tCQUFWQyxJO3VCQUNlLGE7dUJBQWZDLFM7b0JBQ1ksVTtvQkFBWkMsTTtzQkFDYyxZO3NCQUFkQyxRO3FCQUNhLFc7cUJBQWJDLE87eUJBQ2lCLGU7eUJBQWpCQyxXOytCQUN1QixxQjsrQkFBdkJDLGlCO2lDQUN5Qix1QjtpQ0FBekJDLG1CO2tDQUMwQix3QjtrQ0FBMUJDLG9CO3lCQUNpQixlO3lCQUFqQkMsVztnQ0FDd0Isc0I7Z0NBQXhCQyxrQjt5QkFDaUIsZTt5QkFBakJDLFc7MEJBQ2tCLGdCOzBCQUFsQkMsWSIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vIGNvcmVcbmV4cG9ydCBUZW1wbGF0ZVRhZyBmcm9tICcuL1RlbXBsYXRlVGFnJztcblxuLy8gdHJhbnNmb3JtZXJzXG5leHBvcnQgdHJpbVJlc3VsdFRyYW5zZm9ybWVyIGZyb20gJy4vdHJpbVJlc3VsdFRyYW5zZm9ybWVyJztcbmV4cG9ydCBzdHJpcEluZGVudFRyYW5zZm9ybWVyIGZyb20gJy4vc3RyaXBJbmRlbnRUcmFuc2Zvcm1lcic7XG5leHBvcnQgcmVwbGFjZVJlc3VsdFRyYW5zZm9ybWVyIGZyb20gJy4vcmVwbGFjZVJlc3VsdFRyYW5zZm9ybWVyJztcbmV4cG9ydCByZXBsYWNlU3Vic3RpdHV0aW9uVHJhbnNmb3JtZXIgZnJvbSAnLi9yZXBsYWNlU3Vic3RpdHV0aW9uVHJhbnNmb3JtZXInO1xuZXhwb3J0IHJlcGxhY2VTdHJpbmdUcmFuc2Zvcm1lciBmcm9tICcuL3JlcGxhY2VTdHJpbmdUcmFuc2Zvcm1lcic7XG5leHBvcnQgaW5saW5lQXJyYXlUcmFuc2Zvcm1lciBmcm9tICcuL2lubGluZUFycmF5VHJhbnNmb3JtZXInO1xuZXhwb3J0IHNwbGl0U3RyaW5nVHJhbnNmb3JtZXIgZnJvbSAnLi9zcGxpdFN0cmluZ1RyYW5zZm9ybWVyJztcbmV4cG9ydCByZW1vdmVOb25QcmludGluZ1ZhbHVlc1RyYW5zZm9ybWVyIGZyb20gJy4vcmVtb3ZlTm9uUHJpbnRpbmdWYWx1ZXNUcmFuc2Zvcm1lcic7XG5cbi8vIHRhZ3NcbmV4cG9ydCBjb21tYUxpc3RzIGZyb20gJy4vY29tbWFMaXN0cyc7XG5leHBvcnQgY29tbWFMaXN0c0FuZCBmcm9tICcuL2NvbW1hTGlzdHNBbmQnO1xuZXhwb3J0IGNvbW1hTGlzdHNPciBmcm9tICcuL2NvbW1hTGlzdHNPcic7XG5leHBvcnQgaHRtbCBmcm9tICcuL2h0bWwnO1xuZXhwb3J0IGNvZGVCbG9jayBmcm9tICcuL2NvZGVCbG9jayc7XG5leHBvcnQgc291cmNlIGZyb20gJy4vc291cmNlJztcbmV4cG9ydCBzYWZlSHRtbCBmcm9tICcuL3NhZmVIdG1sJztcbmV4cG9ydCBvbmVMaW5lIGZyb20gJy4vb25lTGluZSc7XG5leHBvcnQgb25lTGluZVRyaW0gZnJvbSAnLi9vbmVMaW5lVHJpbSc7XG5leHBvcnQgb25lTGluZUNvbW1hTGlzdHMgZnJvbSAnLi9vbmVMaW5lQ29tbWFMaXN0cyc7XG5leHBvcnQgb25lTGluZUNvbW1hTGlzdHNPciBmcm9tICcuL29uZUxpbmVDb21tYUxpc3RzT3InO1xuZXhwb3J0IG9uZUxpbmVDb21tYUxpc3RzQW5kIGZyb20gJy4vb25lTGluZUNvbW1hTGlzdHNBbmQnO1xuZXhwb3J0IGlubGluZUxpc3RzIGZyb20gJy4vaW5saW5lTGlzdHMnO1xuZXhwb3J0IG9uZUxpbmVJbmxpbmVMaXN0cyBmcm9tICcuL29uZUxpbmVJbmxpbmVMaXN0cyc7XG5leHBvcnQgc3RyaXBJbmRlbnQgZnJvbSAnLi9zdHJpcEluZGVudCc7XG5leHBvcnQgc3RyaXBJbmRlbnRzIGZyb20gJy4vc3RyaXBJbmRlbnRzJztcbiJdfQ==
|
3
node_modules/common-tags/es/inlineArrayTransformer/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/inlineArrayTransformer/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './inlineArrayTransformer';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbmxpbmVBcnJheVRyYW5zZm9ybWVyL2luZGV4LmpzIl0sIm5hbWVzIjpbImRlZmF1bHQiXSwibWFwcGluZ3MiOiJxQkFBb0IsMEI7cUJBQWJBLE8iLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCBmcm9tICcuL2lubGluZUFycmF5VHJhbnNmb3JtZXInO1xuIl19
|
45
node_modules/common-tags/es/inlineArrayTransformer/inlineArrayTransformer.js
generated
vendored
Normal file
45
node_modules/common-tags/es/inlineArrayTransformer/inlineArrayTransformer.js
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
var defaults = {
|
||||||
|
separator: '',
|
||||||
|
conjunction: '',
|
||||||
|
serial: false
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts an array substitution to a string containing a list
|
||||||
|
* @param {String} [opts.separator = ''] - the character that separates each item
|
||||||
|
* @param {String} [opts.conjunction = ''] - replace the last separator with this
|
||||||
|
* @param {Boolean} [opts.serial = false] - include the separator before the conjunction? (Oxford comma use-case)
|
||||||
|
*
|
||||||
|
* @return {Object} - a TemplateTag transformer
|
||||||
|
*/
|
||||||
|
var inlineArrayTransformer = function inlineArrayTransformer() {
|
||||||
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaults;
|
||||||
|
return {
|
||||||
|
onSubstitution: function onSubstitution(substitution, resultSoFar) {
|
||||||
|
// only operate on arrays
|
||||||
|
if (Array.isArray(substitution)) {
|
||||||
|
var arrayLength = substitution.length;
|
||||||
|
var separator = opts.separator;
|
||||||
|
var conjunction = opts.conjunction;
|
||||||
|
var serial = opts.serial;
|
||||||
|
// join each item in the array into a string where each item is separated by separator
|
||||||
|
// be sure to maintain indentation
|
||||||
|
var indent = resultSoFar.match(/(\n?[^\S\n]+)$/);
|
||||||
|
if (indent) {
|
||||||
|
substitution = substitution.join(separator + indent[1]);
|
||||||
|
} else {
|
||||||
|
substitution = substitution.join(separator + ' ');
|
||||||
|
}
|
||||||
|
// if conjunction is set, replace the last separator with conjunction, but only if there is more than one substitution
|
||||||
|
if (conjunction && arrayLength > 1) {
|
||||||
|
var separatorIndex = substitution.lastIndexOf(separator);
|
||||||
|
substitution = substitution.slice(0, separatorIndex) + (serial ? separator : '') + ' ' + conjunction + substitution.slice(separatorIndex + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return substitution;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default inlineArrayTransformer;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbmxpbmVBcnJheVRyYW5zZm9ybWVyL2lubGluZUFycmF5VHJhbnNmb3JtZXIuanMiXSwibmFtZXMiOlsiZGVmYXVsdHMiLCJzZXBhcmF0b3IiLCJjb25qdW5jdGlvbiIsInNlcmlhbCIsImlubGluZUFycmF5VHJhbnNmb3JtZXIiLCJvcHRzIiwib25TdWJzdGl0dXRpb24iLCJzdWJzdGl0dXRpb24iLCJyZXN1bHRTb0ZhciIsIkFycmF5IiwiaXNBcnJheSIsImFycmF5TGVuZ3RoIiwibGVuZ3RoIiwiaW5kZW50IiwibWF0Y2giLCJqb2luIiwic2VwYXJhdG9ySW5kZXgiLCJsYXN0SW5kZXhPZiIsInNsaWNlIl0sIm1hcHBpbmdzIjoiQUFBQSxJQUFNQSxXQUFXO0FBQ2ZDLGFBQVcsRUFESTtBQUVmQyxlQUFhLEVBRkU7QUFHZkMsVUFBUTtBQUhPLENBQWpCOztBQU1BOzs7Ozs7OztBQVFBLElBQU1DLHlCQUF5QixTQUF6QkEsc0JBQXlCO0FBQUEsTUFBQ0MsSUFBRCx1RUFBUUwsUUFBUjtBQUFBLFNBQXNCO0FBQ25ETSxrQkFEbUQsMEJBQ3BDQyxZQURvQyxFQUN0QkMsV0FEc0IsRUFDVDtBQUN4QztBQUNBLFVBQUlDLE1BQU1DLE9BQU4sQ0FBY0gsWUFBZCxDQUFKLEVBQWlDO0FBQy9CLFlBQU1JLGNBQWNKLGFBQWFLLE1BQWpDO0FBQ0EsWUFBTVgsWUFBWUksS0FBS0osU0FBdkI7QUFDQSxZQUFNQyxjQUFjRyxLQUFLSCxXQUF6QjtBQUNBLFlBQU1DLFNBQVNFLEtBQUtGLE1BQXBCO0FBQ0E7QUFDQTtBQUNBLFlBQU1VLFNBQVNMLFlBQVlNLEtBQVosQ0FBa0IsZ0JBQWxCLENBQWY7QUFDQSxZQUFJRCxNQUFKLEVBQVk7QUFDVk4seUJBQWVBLGFBQWFRLElBQWIsQ0FBa0JkLFlBQVlZLE9BQU8sQ0FBUCxDQUE5QixDQUFmO0FBQ0QsU0FGRCxNQUVPO0FBQ0xOLHlCQUFlQSxhQUFhUSxJQUFiLENBQWtCZCxZQUFZLEdBQTlCLENBQWY7QUFDRDtBQUNEO0FBQ0EsWUFBSUMsZUFBZVMsY0FBYyxDQUFqQyxFQUFvQztBQUNsQyxjQUFNSyxpQkFBaUJULGFBQWFVLFdBQWIsQ0FBeUJoQixTQUF6QixDQUF2QjtBQUNBTSx5QkFDRUEsYUFBYVcsS0FBYixDQUFtQixDQUFuQixFQUFzQkYsY0FBdEIsS0FDQ2IsU0FBU0YsU0FBVCxHQUFxQixFQUR0QixJQUVBLEdBRkEsR0FHQUMsV0FIQSxHQUlBSyxhQUFhVyxLQUFiLENBQW1CRixpQkFBaUIsQ0FBcEMsQ0FMRjtBQU1EO0FBQ0Y7QUFDRCxhQUFPVCxZQUFQO0FBQ0Q7QUE1QmtELEdBQXRCO0FBQUEsQ0FBL0I7O0FBK0JBLGVBQWVILHNCQUFmIiwiZmlsZSI6ImlubGluZUFycmF5VHJhbnNmb3JtZXIuanMiLCJzb3VyY2VzQ29udGVudCI6WyJjb25zdCBkZWZhdWx0cyA9IHtcbiAgc2VwYXJhdG9yOiAnJyxcbiAgY29uanVuY3Rpb246ICcnLFxuICBzZXJpYWw6IGZhbHNlLFxufTtcblxuLyoqXG4gKiBDb252ZXJ0cyBhbiBhcnJheSBzdWJzdGl0dXRpb24gdG8gYSBzdHJpbmcgY29udGFpbmluZyBhIGxpc3RcbiAqIEBwYXJhbSAge1N0cmluZ30gW29wdHMuc2VwYXJhdG9yID0gJyddIC0gdGhlIGNoYXJhY3RlciB0aGF0IHNlcGFyYXRlcyBlYWNoIGl0ZW1cbiAqIEBwYXJhbSAge1N0cmluZ30gW29wdHMuY29uanVuY3Rpb24gPSAnJ10gIC0gcmVwbGFjZSB0aGUgbGFzdCBzZXBhcmF0b3Igd2l0aCB0aGlzXG4gKiBAcGFyYW0gIHtCb29sZWFufSBbb3B0cy5zZXJpYWwgPSBmYWxzZV0gLSBpbmNsdWRlIHRoZSBzZXBhcmF0b3IgYmVmb3JlIHRoZSBjb25qdW5jdGlvbj8gKE94Zm9yZCBjb21tYSB1c2UtY2FzZSlcbiAqXG4gKiBAcmV0dXJuIHtPYmplY3R9ICAgICAgICAgICAgICAgICAgICAgLSBhIFRlbXBsYXRlVGFnIHRyYW5zZm9ybWVyXG4gKi9cbmNvbnN0IGlubGluZUFycmF5VHJhbnNmb3JtZXIgPSAob3B0cyA9IGRlZmF1bHRzKSA9PiAoe1xuICBvblN1YnN0aXR1dGlvbihzdWJzdGl0dXRpb24sIHJlc3VsdFNvRmFyKSB7XG4gICAgLy8gb25seSBvcGVyYXRlIG9uIGFycmF5c1xuICAgIGlmIChBcnJheS5pc0FycmF5KHN1YnN0aXR1dGlvbikpIHtcbiAgICAgIGNvbnN0IGFycmF5TGVuZ3RoID0gc3Vic3RpdHV0aW9uLmxlbmd0aDtcbiAgICAgIGNvbnN0IHNlcGFyYXRvciA9IG9wdHMuc2VwYXJhdG9yO1xuICAgICAgY29uc3QgY29uanVuY3Rpb24gPSBvcHRzLmNvbmp1bmN0aW9uO1xuICAgICAgY29uc3Qgc2VyaWFsID0gb3B0cy5zZXJpYWw7XG4gICAgICAvLyBqb2luIGVhY2ggaXRlbSBpbiB0aGUgYXJyYXkgaW50byBhIHN0cmluZyB3aGVyZSBlYWNoIGl0ZW0gaXMgc2VwYXJhdGVkIGJ5IHNlcGFyYXRvclxuICAgICAgLy8gYmUgc3VyZSB0byBtYWludGFpbiBpbmRlbnRhdGlvblxuICAgICAgY29uc3QgaW5kZW50ID0gcmVzdWx0U29GYXIubWF0Y2goLyhcXG4/W15cXFNcXG5dKykkLyk7XG4gICAgICBpZiAoaW5kZW50KSB7XG4gICAgICAgIHN1YnN0aXR1dGlvbiA9IHN1YnN0aXR1dGlvbi5qb2luKHNlcGFyYXRvciArIGluZGVudFsxXSk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBzdWJzdGl0dXRpb24gPSBzdWJzdGl0dXRpb24uam9pbihzZXBhcmF0b3IgKyAnICcpO1xuICAgICAgfVxuICAgICAgLy8gaWYgY29uanVuY3Rpb24gaXMgc2V0LCByZXBsYWNlIHRoZSBsYXN0IHNlcGFyYXRvciB3aXRoIGNvbmp1bmN0aW9uLCBidXQgb25seSBpZiB0aGVyZSBpcyBtb3JlIHRoYW4gb25lIHN1YnN0aXR1dGlvblxuICAgICAgaWYgKGNvbmp1bmN0aW9uICYmIGFycmF5TGVuZ3RoID4gMSkge1xuICAgICAgICBjb25zdCBzZXBhcmF0b3JJbmRleCA9IHN1YnN0aXR1dGlvbi5sYXN0SW5kZXhPZihzZXBhcmF0b3IpO1xuICAgICAgICBzdWJzdGl0dXRpb24gPVxuICAgICAgICAgIHN1YnN0aXR1dGlvbi5zbGljZSgwLCBzZXBhcmF0b3JJbmRleCkgK1xuICAgICAgICAgIChzZXJpYWwgPyBzZXBhcmF0b3IgOiAnJykgK1xuICAgICAgICAgICcgJyArXG4gICAgICAgICAgY29uanVuY3Rpb24gK1xuICAgICAgICAgIHN1YnN0aXR1dGlvbi5zbGljZShzZXBhcmF0b3JJbmRleCArIDEpO1xuICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gc3Vic3RpdHV0aW9uO1xuICB9LFxufSk7XG5cbmV4cG9ydCBkZWZhdWx0IGlubGluZUFycmF5VHJhbnNmb3JtZXI7XG4iXX0=
|
3
node_modules/common-tags/es/inlineLists/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/inlineLists/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './inlineLists';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbmxpbmVMaXN0cy9pbmRleC5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0Il0sIm1hcHBpbmdzIjoicUJBQW9CLGU7cUJBQWJBLE8iLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCBmcm9tICcuL2lubGluZUxpc3RzJztcbiJdfQ==
|
9
node_modules/common-tags/es/inlineLists/inlineLists.js
generated
vendored
Normal file
9
node_modules/common-tags/es/inlineLists/inlineLists.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import TemplateTag from '../TemplateTag';
|
||||||
|
import stripIndentTransformer from '../stripIndentTransformer';
|
||||||
|
import inlineArrayTransformer from '../inlineArrayTransformer';
|
||||||
|
import trimResultTransformer from '../trimResultTransformer';
|
||||||
|
|
||||||
|
var inlineLists = new TemplateTag(inlineArrayTransformer, stripIndentTransformer, trimResultTransformer);
|
||||||
|
|
||||||
|
export default inlineLists;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbmxpbmVMaXN0cy9pbmxpbmVMaXN0cy5qcyJdLCJuYW1lcyI6WyJUZW1wbGF0ZVRhZyIsInN0cmlwSW5kZW50VHJhbnNmb3JtZXIiLCJpbmxpbmVBcnJheVRyYW5zZm9ybWVyIiwidHJpbVJlc3VsdFRyYW5zZm9ybWVyIiwiaW5saW5lTGlzdHMiXSwibWFwcGluZ3MiOiJBQUFBLE9BQU9BLFdBQVAsTUFBd0IsZ0JBQXhCO0FBQ0EsT0FBT0Msc0JBQVAsTUFBbUMsMkJBQW5DO0FBQ0EsT0FBT0Msc0JBQVAsTUFBbUMsMkJBQW5DO0FBQ0EsT0FBT0MscUJBQVAsTUFBa0MsMEJBQWxDOztBQUVBLElBQU1DLGNBQWMsSUFBSUosV0FBSixDQUNsQkUsc0JBRGtCLEVBRWxCRCxzQkFGa0IsRUFHbEJFLHFCQUhrQixDQUFwQjs7QUFNQSxlQUFlQyxXQUFmIiwiZmlsZSI6ImlubGluZUxpc3RzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFRlbXBsYXRlVGFnIGZyb20gJy4uL1RlbXBsYXRlVGFnJztcbmltcG9ydCBzdHJpcEluZGVudFRyYW5zZm9ybWVyIGZyb20gJy4uL3N0cmlwSW5kZW50VHJhbnNmb3JtZXInO1xuaW1wb3J0IGlubGluZUFycmF5VHJhbnNmb3JtZXIgZnJvbSAnLi4vaW5saW5lQXJyYXlUcmFuc2Zvcm1lcic7XG5pbXBvcnQgdHJpbVJlc3VsdFRyYW5zZm9ybWVyIGZyb20gJy4uL3RyaW1SZXN1bHRUcmFuc2Zvcm1lcic7XG5cbmNvbnN0IGlubGluZUxpc3RzID0gbmV3IFRlbXBsYXRlVGFnKFxuICBpbmxpbmVBcnJheVRyYW5zZm9ybWVyLFxuICBzdHJpcEluZGVudFRyYW5zZm9ybWVyLFxuICB0cmltUmVzdWx0VHJhbnNmb3JtZXIsXG4pO1xuXG5leHBvcnQgZGVmYXVsdCBpbmxpbmVMaXN0cztcbiJdfQ==
|
3
node_modules/common-tags/es/oneLine/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/oneLine/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './oneLine';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vbmVMaW5lL2luZGV4LmpzIl0sIm5hbWVzIjpbImRlZmF1bHQiXSwibWFwcGluZ3MiOiJxQkFBb0IsVztxQkFBYkEsTyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZyb20gJy4vb25lTGluZSc7XG4iXX0=
|
8
node_modules/common-tags/es/oneLine/oneLine.js
generated
vendored
Normal file
8
node_modules/common-tags/es/oneLine/oneLine.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import TemplateTag from '../TemplateTag';
|
||||||
|
import trimResultTransformer from '../trimResultTransformer';
|
||||||
|
import replaceResultTransformer from '../replaceResultTransformer';
|
||||||
|
|
||||||
|
var oneLine = new TemplateTag(replaceResultTransformer(/(?:\n(?:\s*))+/g, ' '), trimResultTransformer);
|
||||||
|
|
||||||
|
export default oneLine;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vbmVMaW5lL29uZUxpbmUuanMiXSwibmFtZXMiOlsiVGVtcGxhdGVUYWciLCJ0cmltUmVzdWx0VHJhbnNmb3JtZXIiLCJyZXBsYWNlUmVzdWx0VHJhbnNmb3JtZXIiLCJvbmVMaW5lIl0sIm1hcHBpbmdzIjoiQUFBQSxPQUFPQSxXQUFQLE1BQXdCLGdCQUF4QjtBQUNBLE9BQU9DLHFCQUFQLE1BQWtDLDBCQUFsQztBQUNBLE9BQU9DLHdCQUFQLE1BQXFDLDZCQUFyQzs7QUFFQSxJQUFNQyxVQUFVLElBQUlILFdBQUosQ0FDZEUseUJBQXlCLGlCQUF6QixFQUE0QyxHQUE1QyxDQURjLEVBRWRELHFCQUZjLENBQWhCOztBQUtBLGVBQWVFLE9BQWYiLCJmaWxlIjoib25lTGluZS5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBUZW1wbGF0ZVRhZyBmcm9tICcuLi9UZW1wbGF0ZVRhZyc7XG5pbXBvcnQgdHJpbVJlc3VsdFRyYW5zZm9ybWVyIGZyb20gJy4uL3RyaW1SZXN1bHRUcmFuc2Zvcm1lcic7XG5pbXBvcnQgcmVwbGFjZVJlc3VsdFRyYW5zZm9ybWVyIGZyb20gJy4uL3JlcGxhY2VSZXN1bHRUcmFuc2Zvcm1lcic7XG5cbmNvbnN0IG9uZUxpbmUgPSBuZXcgVGVtcGxhdGVUYWcoXG4gIHJlcGxhY2VSZXN1bHRUcmFuc2Zvcm1lcigvKD86XFxuKD86XFxzKikpKy9nLCAnICcpLFxuICB0cmltUmVzdWx0VHJhbnNmb3JtZXIsXG4pO1xuXG5leHBvcnQgZGVmYXVsdCBvbmVMaW5lO1xuIl19
|
3
node_modules/common-tags/es/oneLineCommaLists/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/oneLineCommaLists/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './oneLineCommaLists';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vbmVMaW5lQ29tbWFMaXN0cy9pbmRleC5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0Il0sIm1hcHBpbmdzIjoicUJBQW9CLHFCO3FCQUFiQSxPIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQgZnJvbSAnLi9vbmVMaW5lQ29tbWFMaXN0cyc7XG4iXX0=
|
9
node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.js
generated
vendored
Normal file
9
node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import TemplateTag from '../TemplateTag';
|
||||||
|
import inlineArrayTransformer from '../inlineArrayTransformer';
|
||||||
|
import trimResultTransformer from '../trimResultTransformer';
|
||||||
|
import replaceResultTransformer from '../replaceResultTransformer';
|
||||||
|
|
||||||
|
var oneLineCommaLists = new TemplateTag(inlineArrayTransformer({ separator: ',' }), replaceResultTransformer(/(?:\s+)/g, ' '), trimResultTransformer);
|
||||||
|
|
||||||
|
export default oneLineCommaLists;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vbmVMaW5lQ29tbWFMaXN0cy9vbmVMaW5lQ29tbWFMaXN0cy5qcyJdLCJuYW1lcyI6WyJUZW1wbGF0ZVRhZyIsImlubGluZUFycmF5VHJhbnNmb3JtZXIiLCJ0cmltUmVzdWx0VHJhbnNmb3JtZXIiLCJyZXBsYWNlUmVzdWx0VHJhbnNmb3JtZXIiLCJvbmVMaW5lQ29tbWFMaXN0cyIsInNlcGFyYXRvciJdLCJtYXBwaW5ncyI6IkFBQUEsT0FBT0EsV0FBUCxNQUF3QixnQkFBeEI7QUFDQSxPQUFPQyxzQkFBUCxNQUFtQywyQkFBbkM7QUFDQSxPQUFPQyxxQkFBUCxNQUFrQywwQkFBbEM7QUFDQSxPQUFPQyx3QkFBUCxNQUFxQyw2QkFBckM7O0FBRUEsSUFBTUMsb0JBQW9CLElBQUlKLFdBQUosQ0FDeEJDLHVCQUF1QixFQUFFSSxXQUFXLEdBQWIsRUFBdkIsQ0FEd0IsRUFFeEJGLHlCQUF5QixVQUF6QixFQUFxQyxHQUFyQyxDQUZ3QixFQUd4QkQscUJBSHdCLENBQTFCOztBQU1BLGVBQWVFLGlCQUFmIiwiZmlsZSI6Im9uZUxpbmVDb21tYUxpc3RzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFRlbXBsYXRlVGFnIGZyb20gJy4uL1RlbXBsYXRlVGFnJztcbmltcG9ydCBpbmxpbmVBcnJheVRyYW5zZm9ybWVyIGZyb20gJy4uL2lubGluZUFycmF5VHJhbnNmb3JtZXInO1xuaW1wb3J0IHRyaW1SZXN1bHRUcmFuc2Zvcm1lciBmcm9tICcuLi90cmltUmVzdWx0VHJhbnNmb3JtZXInO1xuaW1wb3J0IHJlcGxhY2VSZXN1bHRUcmFuc2Zvcm1lciBmcm9tICcuLi9yZXBsYWNlUmVzdWx0VHJhbnNmb3JtZXInO1xuXG5jb25zdCBvbmVMaW5lQ29tbWFMaXN0cyA9IG5ldyBUZW1wbGF0ZVRhZyhcbiAgaW5saW5lQXJyYXlUcmFuc2Zvcm1lcih7IHNlcGFyYXRvcjogJywnIH0pLFxuICByZXBsYWNlUmVzdWx0VHJhbnNmb3JtZXIoLyg/OlxccyspL2csICcgJyksXG4gIHRyaW1SZXN1bHRUcmFuc2Zvcm1lcixcbik7XG5cbmV4cG9ydCBkZWZhdWx0IG9uZUxpbmVDb21tYUxpc3RzO1xuIl19
|
3
node_modules/common-tags/es/oneLineCommaListsAnd/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/oneLineCommaListsAnd/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './oneLineCommaListsAnd';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vbmVMaW5lQ29tbWFMaXN0c0FuZC9pbmRleC5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0Il0sIm1hcHBpbmdzIjoicUJBQW9CLHdCO3FCQUFiQSxPIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQgZnJvbSAnLi9vbmVMaW5lQ29tbWFMaXN0c0FuZCc7XG4iXX0=
|
9
node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.js
generated
vendored
Normal file
9
node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import TemplateTag from '../TemplateTag';
|
||||||
|
import inlineArrayTransformer from '../inlineArrayTransformer';
|
||||||
|
import trimResultTransformer from '../trimResultTransformer';
|
||||||
|
import replaceResultTransformer from '../replaceResultTransformer';
|
||||||
|
|
||||||
|
var oneLineCommaListsAnd = new TemplateTag(inlineArrayTransformer({ separator: ',', conjunction: 'and' }), replaceResultTransformer(/(?:\s+)/g, ' '), trimResultTransformer);
|
||||||
|
|
||||||
|
export default oneLineCommaListsAnd;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vbmVMaW5lQ29tbWFMaXN0c0FuZC9vbmVMaW5lQ29tbWFMaXN0c0FuZC5qcyJdLCJuYW1lcyI6WyJUZW1wbGF0ZVRhZyIsImlubGluZUFycmF5VHJhbnNmb3JtZXIiLCJ0cmltUmVzdWx0VHJhbnNmb3JtZXIiLCJyZXBsYWNlUmVzdWx0VHJhbnNmb3JtZXIiLCJvbmVMaW5lQ29tbWFMaXN0c0FuZCIsInNlcGFyYXRvciIsImNvbmp1bmN0aW9uIl0sIm1hcHBpbmdzIjoiQUFBQSxPQUFPQSxXQUFQLE1BQXdCLGdCQUF4QjtBQUNBLE9BQU9DLHNCQUFQLE1BQW1DLDJCQUFuQztBQUNBLE9BQU9DLHFCQUFQLE1BQWtDLDBCQUFsQztBQUNBLE9BQU9DLHdCQUFQLE1BQXFDLDZCQUFyQzs7QUFFQSxJQUFNQyx1QkFBdUIsSUFBSUosV0FBSixDQUMzQkMsdUJBQXVCLEVBQUVJLFdBQVcsR0FBYixFQUFrQkMsYUFBYSxLQUEvQixFQUF2QixDQUQyQixFQUUzQkgseUJBQXlCLFVBQXpCLEVBQXFDLEdBQXJDLENBRjJCLEVBRzNCRCxxQkFIMkIsQ0FBN0I7O0FBTUEsZUFBZUUsb0JBQWYiLCJmaWxlIjoib25lTGluZUNvbW1hTGlzdHNBbmQuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgVGVtcGxhdGVUYWcgZnJvbSAnLi4vVGVtcGxhdGVUYWcnO1xuaW1wb3J0IGlubGluZUFycmF5VHJhbnNmb3JtZXIgZnJvbSAnLi4vaW5saW5lQXJyYXlUcmFuc2Zvcm1lcic7XG5pbXBvcnQgdHJpbVJlc3VsdFRyYW5zZm9ybWVyIGZyb20gJy4uL3RyaW1SZXN1bHRUcmFuc2Zvcm1lcic7XG5pbXBvcnQgcmVwbGFjZVJlc3VsdFRyYW5zZm9ybWVyIGZyb20gJy4uL3JlcGxhY2VSZXN1bHRUcmFuc2Zvcm1lcic7XG5cbmNvbnN0IG9uZUxpbmVDb21tYUxpc3RzQW5kID0gbmV3IFRlbXBsYXRlVGFnKFxuICBpbmxpbmVBcnJheVRyYW5zZm9ybWVyKHsgc2VwYXJhdG9yOiAnLCcsIGNvbmp1bmN0aW9uOiAnYW5kJyB9KSxcbiAgcmVwbGFjZVJlc3VsdFRyYW5zZm9ybWVyKC8oPzpcXHMrKS9nLCAnICcpLFxuICB0cmltUmVzdWx0VHJhbnNmb3JtZXIsXG4pO1xuXG5leHBvcnQgZGVmYXVsdCBvbmVMaW5lQ29tbWFMaXN0c0FuZDtcbiJdfQ==
|
3
node_modules/common-tags/es/oneLineCommaListsOr/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/oneLineCommaListsOr/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './oneLineCommaListsOr';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vbmVMaW5lQ29tbWFMaXN0c09yL2luZGV4LmpzIl0sIm5hbWVzIjpbImRlZmF1bHQiXSwibWFwcGluZ3MiOiJxQkFBb0IsdUI7cUJBQWJBLE8iLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCBmcm9tICcuL29uZUxpbmVDb21tYUxpc3RzT3InO1xuIl19
|
9
node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.js
generated
vendored
Normal file
9
node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import TemplateTag from '../TemplateTag';
|
||||||
|
import inlineArrayTransformer from '../inlineArrayTransformer';
|
||||||
|
import trimResultTransformer from '../trimResultTransformer';
|
||||||
|
import replaceResultTransformer from '../replaceResultTransformer';
|
||||||
|
|
||||||
|
var oneLineCommaListsOr = new TemplateTag(inlineArrayTransformer({ separator: ',', conjunction: 'or' }), replaceResultTransformer(/(?:\s+)/g, ' '), trimResultTransformer);
|
||||||
|
|
||||||
|
export default oneLineCommaListsOr;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vbmVMaW5lQ29tbWFMaXN0c09yL29uZUxpbmVDb21tYUxpc3RzT3IuanMiXSwibmFtZXMiOlsiVGVtcGxhdGVUYWciLCJpbmxpbmVBcnJheVRyYW5zZm9ybWVyIiwidHJpbVJlc3VsdFRyYW5zZm9ybWVyIiwicmVwbGFjZVJlc3VsdFRyYW5zZm9ybWVyIiwib25lTGluZUNvbW1hTGlzdHNPciIsInNlcGFyYXRvciIsImNvbmp1bmN0aW9uIl0sIm1hcHBpbmdzIjoiQUFBQSxPQUFPQSxXQUFQLE1BQXdCLGdCQUF4QjtBQUNBLE9BQU9DLHNCQUFQLE1BQW1DLDJCQUFuQztBQUNBLE9BQU9DLHFCQUFQLE1BQWtDLDBCQUFsQztBQUNBLE9BQU9DLHdCQUFQLE1BQXFDLDZCQUFyQzs7QUFFQSxJQUFNQyxzQkFBc0IsSUFBSUosV0FBSixDQUMxQkMsdUJBQXVCLEVBQUVJLFdBQVcsR0FBYixFQUFrQkMsYUFBYSxJQUEvQixFQUF2QixDQUQwQixFQUUxQkgseUJBQXlCLFVBQXpCLEVBQXFDLEdBQXJDLENBRjBCLEVBRzFCRCxxQkFIMEIsQ0FBNUI7O0FBTUEsZUFBZUUsbUJBQWYiLCJmaWxlIjoib25lTGluZUNvbW1hTGlzdHNPci5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBUZW1wbGF0ZVRhZyBmcm9tICcuLi9UZW1wbGF0ZVRhZyc7XG5pbXBvcnQgaW5saW5lQXJyYXlUcmFuc2Zvcm1lciBmcm9tICcuLi9pbmxpbmVBcnJheVRyYW5zZm9ybWVyJztcbmltcG9ydCB0cmltUmVzdWx0VHJhbnNmb3JtZXIgZnJvbSAnLi4vdHJpbVJlc3VsdFRyYW5zZm9ybWVyJztcbmltcG9ydCByZXBsYWNlUmVzdWx0VHJhbnNmb3JtZXIgZnJvbSAnLi4vcmVwbGFjZVJlc3VsdFRyYW5zZm9ybWVyJztcblxuY29uc3Qgb25lTGluZUNvbW1hTGlzdHNPciA9IG5ldyBUZW1wbGF0ZVRhZyhcbiAgaW5saW5lQXJyYXlUcmFuc2Zvcm1lcih7IHNlcGFyYXRvcjogJywnLCBjb25qdW5jdGlvbjogJ29yJyB9KSxcbiAgcmVwbGFjZVJlc3VsdFRyYW5zZm9ybWVyKC8oPzpcXHMrKS9nLCAnICcpLFxuICB0cmltUmVzdWx0VHJhbnNmb3JtZXIsXG4pO1xuXG5leHBvcnQgZGVmYXVsdCBvbmVMaW5lQ29tbWFMaXN0c09yO1xuIl19
|
3
node_modules/common-tags/es/oneLineInlineLists/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/oneLineInlineLists/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './oneLineInlineLists';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vbmVMaW5lSW5saW5lTGlzdHMvaW5kZXguanMiXSwibmFtZXMiOlsiZGVmYXVsdCJdLCJtYXBwaW5ncyI6InFCQUFvQixzQjtxQkFBYkEsTyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZyb20gJy4vb25lTGluZUlubGluZUxpc3RzJztcbiJdfQ==
|
9
node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.js
generated
vendored
Normal file
9
node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import TemplateTag from '../TemplateTag';
|
||||||
|
import inlineArrayTransformer from '../inlineArrayTransformer';
|
||||||
|
import trimResultTransformer from '../trimResultTransformer';
|
||||||
|
import replaceResultTransformer from '../replaceResultTransformer';
|
||||||
|
|
||||||
|
var oneLineInlineLists = new TemplateTag(inlineArrayTransformer, replaceResultTransformer(/(?:\s+)/g, ' '), trimResultTransformer);
|
||||||
|
|
||||||
|
export default oneLineInlineLists;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vbmVMaW5lSW5saW5lTGlzdHMvb25lTGluZUlubGluZUxpc3RzLmpzIl0sIm5hbWVzIjpbIlRlbXBsYXRlVGFnIiwiaW5saW5lQXJyYXlUcmFuc2Zvcm1lciIsInRyaW1SZXN1bHRUcmFuc2Zvcm1lciIsInJlcGxhY2VSZXN1bHRUcmFuc2Zvcm1lciIsIm9uZUxpbmVJbmxpbmVMaXN0cyJdLCJtYXBwaW5ncyI6IkFBQUEsT0FBT0EsV0FBUCxNQUF3QixnQkFBeEI7QUFDQSxPQUFPQyxzQkFBUCxNQUFtQywyQkFBbkM7QUFDQSxPQUFPQyxxQkFBUCxNQUFrQywwQkFBbEM7QUFDQSxPQUFPQyx3QkFBUCxNQUFxQyw2QkFBckM7O0FBRUEsSUFBTUMscUJBQXFCLElBQUlKLFdBQUosQ0FDekJDLHNCQUR5QixFQUV6QkUseUJBQXlCLFVBQXpCLEVBQXFDLEdBQXJDLENBRnlCLEVBR3pCRCxxQkFIeUIsQ0FBM0I7O0FBTUEsZUFBZUUsa0JBQWYiLCJmaWxlIjoib25lTGluZUlubGluZUxpc3RzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFRlbXBsYXRlVGFnIGZyb20gJy4uL1RlbXBsYXRlVGFnJztcbmltcG9ydCBpbmxpbmVBcnJheVRyYW5zZm9ybWVyIGZyb20gJy4uL2lubGluZUFycmF5VHJhbnNmb3JtZXInO1xuaW1wb3J0IHRyaW1SZXN1bHRUcmFuc2Zvcm1lciBmcm9tICcuLi90cmltUmVzdWx0VHJhbnNmb3JtZXInO1xuaW1wb3J0IHJlcGxhY2VSZXN1bHRUcmFuc2Zvcm1lciBmcm9tICcuLi9yZXBsYWNlUmVzdWx0VHJhbnNmb3JtZXInO1xuXG5jb25zdCBvbmVMaW5lSW5saW5lTGlzdHMgPSBuZXcgVGVtcGxhdGVUYWcoXG4gIGlubGluZUFycmF5VHJhbnNmb3JtZXIsXG4gIHJlcGxhY2VSZXN1bHRUcmFuc2Zvcm1lcigvKD86XFxzKykvZywgJyAnKSxcbiAgdHJpbVJlc3VsdFRyYW5zZm9ybWVyLFxuKTtcblxuZXhwb3J0IGRlZmF1bHQgb25lTGluZUlubGluZUxpc3RzO1xuIl19
|
3
node_modules/common-tags/es/oneLineTrim/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/oneLineTrim/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './oneLineTrim';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vbmVMaW5lVHJpbS9pbmRleC5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0Il0sIm1hcHBpbmdzIjoicUJBQW9CLGU7cUJBQWJBLE8iLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCBmcm9tICcuL29uZUxpbmVUcmltJztcbiJdfQ==
|
8
node_modules/common-tags/es/oneLineTrim/oneLineTrim.js
generated
vendored
Normal file
8
node_modules/common-tags/es/oneLineTrim/oneLineTrim.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import TemplateTag from '../TemplateTag';
|
||||||
|
import trimResultTransformer from '../trimResultTransformer';
|
||||||
|
import replaceResultTransformer from '../replaceResultTransformer';
|
||||||
|
|
||||||
|
var oneLineTrim = new TemplateTag(replaceResultTransformer(/(?:\n\s*)/g, ''), trimResultTransformer);
|
||||||
|
|
||||||
|
export default oneLineTrim;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vbmVMaW5lVHJpbS9vbmVMaW5lVHJpbS5qcyJdLCJuYW1lcyI6WyJUZW1wbGF0ZVRhZyIsInRyaW1SZXN1bHRUcmFuc2Zvcm1lciIsInJlcGxhY2VSZXN1bHRUcmFuc2Zvcm1lciIsIm9uZUxpbmVUcmltIl0sIm1hcHBpbmdzIjoiQUFBQSxPQUFPQSxXQUFQLE1BQXdCLGdCQUF4QjtBQUNBLE9BQU9DLHFCQUFQLE1BQWtDLDBCQUFsQztBQUNBLE9BQU9DLHdCQUFQLE1BQXFDLDZCQUFyQzs7QUFFQSxJQUFNQyxjQUFjLElBQUlILFdBQUosQ0FDbEJFLHlCQUF5QixZQUF6QixFQUF1QyxFQUF2QyxDQURrQixFQUVsQkQscUJBRmtCLENBQXBCOztBQUtBLGVBQWVFLFdBQWYiLCJmaWxlIjoib25lTGluZVRyaW0uanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgVGVtcGxhdGVUYWcgZnJvbSAnLi4vVGVtcGxhdGVUYWcnO1xuaW1wb3J0IHRyaW1SZXN1bHRUcmFuc2Zvcm1lciBmcm9tICcuLi90cmltUmVzdWx0VHJhbnNmb3JtZXInO1xuaW1wb3J0IHJlcGxhY2VSZXN1bHRUcmFuc2Zvcm1lciBmcm9tICcuLi9yZXBsYWNlUmVzdWx0VHJhbnNmb3JtZXInO1xuXG5jb25zdCBvbmVMaW5lVHJpbSA9IG5ldyBUZW1wbGF0ZVRhZyhcbiAgcmVwbGFjZVJlc3VsdFRyYW5zZm9ybWVyKC8oPzpcXG5cXHMqKS9nLCAnJyksXG4gIHRyaW1SZXN1bHRUcmFuc2Zvcm1lcixcbik7XG5cbmV4cG9ydCBkZWZhdWx0IG9uZUxpbmVUcmltO1xuIl19
|
3
node_modules/common-tags/es/removeNonPrintingValuesTransformer/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/removeNonPrintingValuesTransformer/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './removeNonPrintingValuesTransformer';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9yZW1vdmVOb25QcmludGluZ1ZhbHVlc1RyYW5zZm9ybWVyL2luZGV4LmpzIl0sIm5hbWVzIjpbImRlZmF1bHQiXSwibWFwcGluZ3MiOiJxQkFBb0Isc0M7cUJBQWJBLE8iLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCBmcm9tICcuL3JlbW92ZU5vblByaW50aW5nVmFsdWVzVHJhbnNmb3JtZXInO1xuIl19
|
20
node_modules/common-tags/es/removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.js
generated
vendored
Normal file
20
node_modules/common-tags/es/removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
var isValidValue = function isValidValue(x) {
|
||||||
|
return x != null && !Number.isNaN(x) && typeof x !== 'boolean';
|
||||||
|
};
|
||||||
|
|
||||||
|
var removeNonPrintingValuesTransformer = function removeNonPrintingValuesTransformer() {
|
||||||
|
return {
|
||||||
|
onSubstitution: function onSubstitution(substitution) {
|
||||||
|
if (Array.isArray(substitution)) {
|
||||||
|
return substitution.filter(isValidValue);
|
||||||
|
}
|
||||||
|
if (isValidValue(substitution)) {
|
||||||
|
return substitution;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default removeNonPrintingValuesTransformer;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9yZW1vdmVOb25QcmludGluZ1ZhbHVlc1RyYW5zZm9ybWVyL3JlbW92ZU5vblByaW50aW5nVmFsdWVzVHJhbnNmb3JtZXIuanMiXSwibmFtZXMiOlsiaXNWYWxpZFZhbHVlIiwieCIsIk51bWJlciIsImlzTmFOIiwicmVtb3ZlTm9uUHJpbnRpbmdWYWx1ZXNUcmFuc2Zvcm1lciIsIm9uU3Vic3RpdHV0aW9uIiwic3Vic3RpdHV0aW9uIiwiQXJyYXkiLCJpc0FycmF5IiwiZmlsdGVyIl0sIm1hcHBpbmdzIjoiQUFBQSxJQUFNQSxlQUFlLFNBQWZBLFlBQWU7QUFBQSxTQUNuQkMsS0FBSyxJQUFMLElBQWEsQ0FBQ0MsT0FBT0MsS0FBUCxDQUFhRixDQUFiLENBQWQsSUFBaUMsT0FBT0EsQ0FBUCxLQUFhLFNBRDNCO0FBQUEsQ0FBckI7O0FBR0EsSUFBTUcscUNBQXFDLFNBQXJDQSxrQ0FBcUM7QUFBQSxTQUFPO0FBQ2hEQyxrQkFEZ0QsMEJBQ2pDQyxZQURpQyxFQUNuQjtBQUMzQixVQUFJQyxNQUFNQyxPQUFOLENBQWNGLFlBQWQsQ0FBSixFQUFpQztBQUMvQixlQUFPQSxhQUFhRyxNQUFiLENBQW9CVCxZQUFwQixDQUFQO0FBQ0Q7QUFDRCxVQUFJQSxhQUFhTSxZQUFiLENBQUosRUFBZ0M7QUFDOUIsZUFBT0EsWUFBUDtBQUNEO0FBQ0QsYUFBTyxFQUFQO0FBQ0Q7QUFUK0MsR0FBUDtBQUFBLENBQTNDOztBQVlBLGVBQWVGLGtDQUFmIiwiZmlsZSI6InJlbW92ZU5vblByaW50aW5nVmFsdWVzVHJhbnNmb3JtZXIuanMiLCJzb3VyY2VzQ29udGVudCI6WyJjb25zdCBpc1ZhbGlkVmFsdWUgPSB4ID0+XG4gIHggIT0gbnVsbCAmJiAhTnVtYmVyLmlzTmFOKHgpICYmIHR5cGVvZiB4ICE9PSAnYm9vbGVhbic7XG5cbmNvbnN0IHJlbW92ZU5vblByaW50aW5nVmFsdWVzVHJhbnNmb3JtZXIgPSAoKSA9PiAoe1xuICBvblN1YnN0aXR1dGlvbihzdWJzdGl0dXRpb24pIHtcbiAgICBpZiAoQXJyYXkuaXNBcnJheShzdWJzdGl0dXRpb24pKSB7XG4gICAgICByZXR1cm4gc3Vic3RpdHV0aW9uLmZpbHRlcihpc1ZhbGlkVmFsdWUpO1xuICAgIH1cbiAgICBpZiAoaXNWYWxpZFZhbHVlKHN1YnN0aXR1dGlvbikpIHtcbiAgICAgIHJldHVybiBzdWJzdGl0dXRpb247XG4gICAgfVxuICAgIHJldHVybiAnJztcbiAgfSxcbn0pO1xuXG5leHBvcnQgZGVmYXVsdCByZW1vdmVOb25QcmludGluZ1ZhbHVlc1RyYW5zZm9ybWVyO1xuIl19
|
3
node_modules/common-tags/es/replaceResultTransformer/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/replaceResultTransformer/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './replaceResultTransformer';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9yZXBsYWNlUmVzdWx0VHJhbnNmb3JtZXIvaW5kZXguanMiXSwibmFtZXMiOlsiZGVmYXVsdCJdLCJtYXBwaW5ncyI6InFCQUFvQiw0QjtxQkFBYkEsTyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZyb20gJy4vcmVwbGFjZVJlc3VsdFRyYW5zZm9ybWVyJztcbiJdfQ==
|
19
node_modules/common-tags/es/replaceResultTransformer/replaceResultTransformer.js
generated
vendored
Normal file
19
node_modules/common-tags/es/replaceResultTransformer/replaceResultTransformer.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/**
|
||||||
|
* Replaces tabs, newlines and spaces with the chosen value when they occur in sequences
|
||||||
|
* @param {(String|RegExp)} replaceWhat - the value or pattern that should be replaced
|
||||||
|
* @param {*} replaceWith - the replacement value
|
||||||
|
* @return {Object} - a TemplateTag transformer
|
||||||
|
*/
|
||||||
|
var replaceResultTransformer = function replaceResultTransformer(replaceWhat, replaceWith) {
|
||||||
|
return {
|
||||||
|
onEndResult: function onEndResult(endResult) {
|
||||||
|
if (replaceWhat == null || replaceWith == null) {
|
||||||
|
throw new Error('replaceResultTransformer requires at least 2 arguments.');
|
||||||
|
}
|
||||||
|
return endResult.replace(replaceWhat, replaceWith);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default replaceResultTransformer;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9yZXBsYWNlUmVzdWx0VHJhbnNmb3JtZXIvcmVwbGFjZVJlc3VsdFRyYW5zZm9ybWVyLmpzIl0sIm5hbWVzIjpbInJlcGxhY2VSZXN1bHRUcmFuc2Zvcm1lciIsInJlcGxhY2VXaGF0IiwicmVwbGFjZVdpdGgiLCJvbkVuZFJlc3VsdCIsImVuZFJlc3VsdCIsIkVycm9yIiwicmVwbGFjZSJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztBQU1BLElBQU1BLDJCQUEyQixTQUEzQkEsd0JBQTJCLENBQUNDLFdBQUQsRUFBY0MsV0FBZDtBQUFBLFNBQStCO0FBQzlEQyxlQUQ4RCx1QkFDbERDLFNBRGtELEVBQ3ZDO0FBQ3JCLFVBQUlILGVBQWUsSUFBZixJQUF1QkMsZUFBZSxJQUExQyxFQUFnRDtBQUM5QyxjQUFNLElBQUlHLEtBQUosQ0FDSix5REFESSxDQUFOO0FBR0Q7QUFDRCxhQUFPRCxVQUFVRSxPQUFWLENBQWtCTCxXQUFsQixFQUErQkMsV0FBL0IsQ0FBUDtBQUNEO0FBUjZELEdBQS9CO0FBQUEsQ0FBakM7O0FBV0EsZUFBZUYsd0JBQWYiLCJmaWxlIjoicmVwbGFjZVJlc3VsdFRyYW5zZm9ybWVyLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBSZXBsYWNlcyB0YWJzLCBuZXdsaW5lcyBhbmQgc3BhY2VzIHdpdGggdGhlIGNob3NlbiB2YWx1ZSB3aGVuIHRoZXkgb2NjdXIgaW4gc2VxdWVuY2VzXG4gKiBAcGFyYW0gIHsoU3RyaW5nfFJlZ0V4cCl9IHJlcGxhY2VXaGF0IC0gdGhlIHZhbHVlIG9yIHBhdHRlcm4gdGhhdCBzaG91bGQgYmUgcmVwbGFjZWRcbiAqIEBwYXJhbSAgeyp9ICAgICAgICAgICAgICAgcmVwbGFjZVdpdGggLSB0aGUgcmVwbGFjZW1lbnQgdmFsdWVcbiAqIEByZXR1cm4ge09iamVjdH0gICAgICAgICAgICAgICAgICAgICAgLSBhIFRlbXBsYXRlVGFnIHRyYW5zZm9ybWVyXG4gKi9cbmNvbnN0IHJlcGxhY2VSZXN1bHRUcmFuc2Zvcm1lciA9IChyZXBsYWNlV2hhdCwgcmVwbGFjZVdpdGgpID0+ICh7XG4gIG9uRW5kUmVzdWx0KGVuZFJlc3VsdCkge1xuICAgIGlmIChyZXBsYWNlV2hhdCA9PSBudWxsIHx8IHJlcGxhY2VXaXRoID09IG51bGwpIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcihcbiAgICAgICAgJ3JlcGxhY2VSZXN1bHRUcmFuc2Zvcm1lciByZXF1aXJlcyBhdCBsZWFzdCAyIGFyZ3VtZW50cy4nLFxuICAgICAgKTtcbiAgICB9XG4gICAgcmV0dXJuIGVuZFJlc3VsdC5yZXBsYWNlKHJlcGxhY2VXaGF0LCByZXBsYWNlV2l0aCk7XG4gIH0sXG59KTtcblxuZXhwb3J0IGRlZmF1bHQgcmVwbGFjZVJlc3VsdFRyYW5zZm9ybWVyO1xuIl19
|
3
node_modules/common-tags/es/replaceStringTransformer/index.js
generated
vendored
Normal file
3
node_modules/common-tags/es/replaceStringTransformer/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import _default from './replaceStringTransformer';
|
||||||
|
export { _default as default };
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9yZXBsYWNlU3RyaW5nVHJhbnNmb3JtZXIvaW5kZXguanMiXSwibmFtZXMiOlsiZGVmYXVsdCJdLCJtYXBwaW5ncyI6InFCQUFvQiw0QjtxQkFBYkEsTyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZyb20gJy4vcmVwbGFjZVN0cmluZ1RyYW5zZm9ybWVyJztcbiJdfQ==
|
14
node_modules/common-tags/es/replaceStringTransformer/replaceStringTransformer.js
generated
vendored
Normal file
14
node_modules/common-tags/es/replaceStringTransformer/replaceStringTransformer.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
var replaceStringTransformer = function replaceStringTransformer(replaceWhat, replaceWith) {
|
||||||
|
return {
|
||||||
|
onString: function onString(str) {
|
||||||
|
if (replaceWhat == null || replaceWith == null) {
|
||||||
|
throw new Error('replaceStringTransformer requires at least 2 arguments.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return str.replace(replaceWhat, replaceWith);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default replaceStringTransformer;
|
||||||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9yZXBsYWNlU3RyaW5nVHJhbnNmb3JtZXIvcmVwbGFjZVN0cmluZ1RyYW5zZm9ybWVyLmpzIl0sIm5hbWVzIjpbInJlcGxhY2VTdHJpbmdUcmFuc2Zvcm1lciIsInJlcGxhY2VXaGF0IiwicmVwbGFjZVdpdGgiLCJvblN0cmluZyIsInN0ciIsIkVycm9yIiwicmVwbGFjZSJdLCJtYXBwaW5ncyI6IkFBQUEsSUFBTUEsMkJBQTJCLFNBQTNCQSx3QkFBMkIsQ0FBQ0MsV0FBRCxFQUFjQyxXQUFkO0FBQUEsU0FBK0I7QUFDOURDLFlBRDhELG9CQUNyREMsR0FEcUQsRUFDaEQ7QUFDWixVQUFJSCxlQUFlLElBQWYsSUFBdUJDLGVBQWUsSUFBMUMsRUFBZ0Q7QUFDOUMsY0FBTSxJQUFJRyxLQUFKLENBQ0oseURBREksQ0FBTjtBQUdEOztBQUVELGFBQU9ELElBQUlFLE9BQUosQ0FBWUwsV0FBWixFQUF5QkMsV0FBekIsQ0FBUDtBQUNEO0FBVDZELEdBQS9CO0FBQUEsQ0FBakM7O0FBWUEsZUFBZUYsd0JBQWYiLCJmaWxlIjoicmVwbGFjZVN0cmluZ1RyYW5zZm9ybWVyLmpzIiwic291cmNlc0NvbnRlbnQiOlsiY29uc3QgcmVwbGFjZVN0cmluZ1RyYW5zZm9ybWVyID0gKHJlcGxhY2VXaGF0LCByZXBsYWNlV2l0aCkgPT4gKHtcbiAgb25TdHJpbmcoc3RyKSB7XG4gICAgaWYgKHJlcGxhY2VXaGF0ID09IG51bGwgfHwgcmVwbGFjZVdpdGggPT0gbnVsbCkge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKFxuICAgICAgICAncmVwbGFjZVN0cmluZ1RyYW5zZm9ybWVyIHJlcXVpcmVzIGF0IGxlYXN0IDIgYXJndW1lbnRzLicsXG4gICAgICApO1xuICAgIH1cblxuICAgIHJldHVybiBzdHIucmVwbGFjZShyZXBsYWNlV2hhdCwgcmVwbGFjZVdpdGgpO1xuICB9LFxufSk7XG5cbmV4cG9ydCBkZWZhdWx0IHJlcGxhY2VTdHJpbmdUcmFuc2Zvcm1lcjtcbiJdfQ==
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue