mirror of
https://github.com/cachix/install-nix-action.git
synced 2025-06-08 09:54:28 +00:00
v6
This commit is contained in:
parent
cd5893b2c6
commit
70742d22d9
6774 changed files with 1602535 additions and 1 deletions
17
node_modules/object-inspect/.nycrc
generated
vendored
Normal file
17
node_modules/object-inspect/.nycrc
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"all": true,
|
||||
"check-coverage": true,
|
||||
"instrumentation": false,
|
||||
"sourceMap": false,
|
||||
"reporter": "html",
|
||||
"lines": 94.94,
|
||||
"statements": 94.25,
|
||||
"functions": 96,
|
||||
"branches": 91.02,
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"example",
|
||||
"test",
|
||||
"test-core-js.js"
|
||||
]
|
||||
}
|
216
node_modules/object-inspect/.travis.yml
generated
vendored
Normal file
216
node_modules/object-inspect/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,216 @@
|
|||
language: node_js
|
||||
os:
|
||||
- linux
|
||||
node_js:
|
||||
- "10.0"
|
||||
- "9.11"
|
||||
- "8.11"
|
||||
- "7.10"
|
||||
- "6.14"
|
||||
- "5.12"
|
||||
- "4.9"
|
||||
- "iojs-v3.3"
|
||||
- "iojs-v2.5"
|
||||
- "iojs-v1.8"
|
||||
- "0.12"
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
- "0.6"
|
||||
before_install:
|
||||
- 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac'
|
||||
- 'nvm install-latest-npm'
|
||||
install:
|
||||
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;'
|
||||
script:
|
||||
- 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi'
|
||||
- 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi'
|
||||
- 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi'
|
||||
- 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi'
|
||||
- 'if [ -n "${BIGINT-}" ]; then npm run test:bigint ; fi'
|
||||
sudo: false
|
||||
env:
|
||||
- TEST=true
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- node_js: "10.0"
|
||||
env: BIGINT=true
|
||||
- node_js: "node"
|
||||
env: COVERAGE=true
|
||||
- node_js: "9.10"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "9.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "9.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "9.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "9.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "9.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "9.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "9.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "9.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "9.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "9.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.10"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.13"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.12"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.11"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.10"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.11"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.10"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v3.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v3.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v3.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.11"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
allow_failures:
|
||||
- os: osx
|
||||
- env: TEST=true ALLOW_FAILURE=true
|
18
node_modules/object-inspect/LICENSE
generated
vendored
Normal file
18
node_modules/object-inspect/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
This software is released under the MIT license:
|
||||
|
||||
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.
|
19
node_modules/object-inspect/example/all.js
generated
vendored
Normal file
19
node_modules/object-inspect/example/all.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
var inspect = require('../');
|
||||
var Buffer = require('safer-buffer').Buffer;
|
||||
|
||||
var holes = [ 'a', 'b' ];
|
||||
holes[4] = 'e', holes[6] = 'g';
|
||||
var obj = {
|
||||
a: 1,
|
||||
b: [ 3, 4, undefined, null ],
|
||||
c: undefined,
|
||||
d: null,
|
||||
e: {
|
||||
regex: /^x/i,
|
||||
buf: Buffer.from('abc'),
|
||||
holes: holes
|
||||
},
|
||||
now: new Date
|
||||
};
|
||||
obj.self = obj;
|
||||
console.log(inspect(obj));
|
4
node_modules/object-inspect/example/circular.js
generated
vendored
Normal file
4
node_modules/object-inspect/example/circular.js
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
var inspect = require('../');
|
||||
var obj = { a: 1, b: [3,4] };
|
||||
obj.c = obj;
|
||||
console.log(inspect(obj));
|
3
node_modules/object-inspect/example/fn.js
generated
vendored
Normal file
3
node_modules/object-inspect/example/fn.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
var inspect = require('../');
|
||||
var obj = [ 1, 2, function f (n) { return n + 5 }, 4 ];
|
||||
console.log(inspect(obj));
|
7
node_modules/object-inspect/example/inspect.js
generated
vendored
Normal file
7
node_modules/object-inspect/example/inspect.js
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
var inspect = require('../');
|
||||
|
||||
var d = document.createElement('div');
|
||||
d.setAttribute('id', 'beep');
|
||||
d.innerHTML = '<b>wooo</b><i>iiiii</i>';
|
||||
|
||||
console.log(inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ]));
|
257
node_modules/object-inspect/index.js
generated
vendored
Normal file
257
node_modules/object-inspect/index.js
generated
vendored
Normal file
|
@ -0,0 +1,257 @@
|
|||
var hasMap = typeof Map === 'function' && Map.prototype;
|
||||
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
||||
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
||||
var mapForEach = hasMap && Map.prototype.forEach;
|
||||
var hasSet = typeof Set === 'function' && Set.prototype;
|
||||
var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
|
||||
var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
|
||||
var setForEach = hasSet && Set.prototype.forEach;
|
||||
var booleanValueOf = Boolean.prototype.valueOf;
|
||||
var objectToString = Object.prototype.toString;
|
||||
var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
|
||||
|
||||
var inspectCustom = require('./util.inspect').custom;
|
||||
var inspectSymbol = (inspectCustom && isSymbol(inspectCustom)) ? inspectCustom : null;
|
||||
|
||||
module.exports = function inspect_ (obj, opts, depth, seen) {
|
||||
if (!opts) opts = {};
|
||||
|
||||
if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
|
||||
throw new TypeError('option "quoteStyle" must be "single" or "double"');
|
||||
}
|
||||
|
||||
if (typeof obj === 'undefined') {
|
||||
return 'undefined';
|
||||
}
|
||||
if (obj === null) {
|
||||
return 'null';
|
||||
}
|
||||
if (typeof obj === 'boolean') {
|
||||
return obj ? 'true' : 'false';
|
||||
}
|
||||
|
||||
if (typeof obj === 'string') {
|
||||
return inspectString(obj, opts);
|
||||
}
|
||||
if (typeof obj === 'number') {
|
||||
if (obj === 0) {
|
||||
return Infinity / obj > 0 ? '0' : '-0';
|
||||
}
|
||||
return String(obj);
|
||||
}
|
||||
if (typeof obj === 'bigint') {
|
||||
return String(obj) + 'n';
|
||||
}
|
||||
|
||||
var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
|
||||
if (typeof depth === 'undefined') depth = 0;
|
||||
if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
|
||||
return '[Object]';
|
||||
}
|
||||
|
||||
if (typeof seen === 'undefined') seen = [];
|
||||
else if (indexOf(seen, obj) >= 0) {
|
||||
return '[Circular]';
|
||||
}
|
||||
|
||||
function inspect (value, from) {
|
||||
if (from) {
|
||||
seen = seen.slice();
|
||||
seen.push(from);
|
||||
}
|
||||
return inspect_(value, opts, depth + 1, seen);
|
||||
}
|
||||
|
||||
if (typeof obj === 'function') {
|
||||
var name = nameOf(obj);
|
||||
return '[Function' + (name ? ': ' + name : '') + ']';
|
||||
}
|
||||
if (isSymbol(obj)) {
|
||||
var symString = Symbol.prototype.toString.call(obj);
|
||||
return typeof obj === 'object' ? markBoxed(symString) : symString;
|
||||
}
|
||||
if (isElement(obj)) {
|
||||
var s = '<' + String(obj.nodeName).toLowerCase();
|
||||
var attrs = obj.attributes || [];
|
||||
for (var i = 0; i < attrs.length; i++) {
|
||||
s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
|
||||
}
|
||||
s += '>';
|
||||
if (obj.childNodes && obj.childNodes.length) s += '...';
|
||||
s += '</' + String(obj.nodeName).toLowerCase() + '>';
|
||||
return s;
|
||||
}
|
||||
if (isArray(obj)) {
|
||||
if (obj.length === 0) return '[]';
|
||||
return '[ ' + arrObjKeys(obj, inspect).join(', ') + ' ]';
|
||||
}
|
||||
if (isError(obj)) {
|
||||
var parts = arrObjKeys(obj, inspect);
|
||||
if (parts.length === 0) return '[' + String(obj) + ']';
|
||||
return '{ [' + String(obj) + '] ' + parts.join(', ') + ' }';
|
||||
}
|
||||
if (typeof obj === 'object') {
|
||||
if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
|
||||
return obj[inspectSymbol]();
|
||||
} else if (typeof obj.inspect === 'function') {
|
||||
return obj.inspect();
|
||||
}
|
||||
}
|
||||
if (isMap(obj)) {
|
||||
var parts = [];
|
||||
mapForEach.call(obj, function (value, key) {
|
||||
parts.push(inspect(key, obj) + ' => ' + inspect(value, obj));
|
||||
});
|
||||
return collectionOf('Map', mapSize.call(obj), parts);
|
||||
}
|
||||
if (isSet(obj)) {
|
||||
var parts = [];
|
||||
setForEach.call(obj, function (value ) {
|
||||
parts.push(inspect(value, obj));
|
||||
});
|
||||
return collectionOf('Set', setSize.call(obj), parts);
|
||||
}
|
||||
if (isNumber(obj)) {
|
||||
return markBoxed(inspect(Number(obj)));
|
||||
}
|
||||
if (isBigInt(obj)) {
|
||||
return markBoxed(inspect(bigIntValueOf.call(obj)));
|
||||
}
|
||||
if (isBoolean(obj)) {
|
||||
return markBoxed(booleanValueOf.call(obj));
|
||||
}
|
||||
if (isString(obj)) {
|
||||
return markBoxed(inspect(String(obj)));
|
||||
}
|
||||
if (!isDate(obj) && !isRegExp(obj)) {
|
||||
var xs = arrObjKeys(obj, inspect);
|
||||
if (xs.length === 0) return '{}';
|
||||
return '{ ' + xs.join(', ') + ' }';
|
||||
}
|
||||
return String(obj);
|
||||
};
|
||||
|
||||
function wrapQuotes (s, defaultStyle, opts) {
|
||||
var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
|
||||
return quoteChar + s + quoteChar;
|
||||
}
|
||||
|
||||
function quote (s) {
|
||||
return String(s).replace(/"/g, '"');
|
||||
}
|
||||
|
||||
function isArray (obj) { return toStr(obj) === '[object Array]'; }
|
||||
function isDate (obj) { return toStr(obj) === '[object Date]'; }
|
||||
function isRegExp (obj) { return toStr(obj) === '[object RegExp]'; }
|
||||
function isError (obj) { return toStr(obj) === '[object Error]'; }
|
||||
function isSymbol (obj) { return toStr(obj) === '[object Symbol]'; }
|
||||
function isString (obj) { return toStr(obj) === '[object String]'; }
|
||||
function isNumber (obj) { return toStr(obj) === '[object Number]'; }
|
||||
function isBigInt (obj) { return toStr(obj) === '[object BigInt]'; }
|
||||
function isBoolean (obj) { return toStr(obj) === '[object Boolean]'; }
|
||||
|
||||
var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
|
||||
function has (obj, key) {
|
||||
return hasOwn.call(obj, key);
|
||||
}
|
||||
|
||||
function toStr (obj) {
|
||||
return objectToString.call(obj);
|
||||
}
|
||||
|
||||
function nameOf (f) {
|
||||
if (f.name) return f.name;
|
||||
var m = String(f).match(/^function\s*([\w$]+)/);
|
||||
if (m) return m[1];
|
||||
}
|
||||
|
||||
function indexOf (xs, x) {
|
||||
if (xs.indexOf) return xs.indexOf(x);
|
||||
for (var i = 0, l = xs.length; i < l; i++) {
|
||||
if (xs[i] === x) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function isMap (x) {
|
||||
if (!mapSize) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
mapSize.call(x);
|
||||
try {
|
||||
setSize.call(x);
|
||||
} catch (s) {
|
||||
return true;
|
||||
}
|
||||
return x instanceof Map; // core-js workaround, pre-v2.5.0
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isSet (x) {
|
||||
if (!setSize) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
setSize.call(x);
|
||||
try {
|
||||
mapSize.call(x);
|
||||
} catch (m) {
|
||||
return true;
|
||||
}
|
||||
return x instanceof Set; // core-js workaround, pre-v2.5.0
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isElement (x) {
|
||||
if (!x || typeof x !== 'object') return false;
|
||||
if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
|
||||
return true;
|
||||
}
|
||||
return typeof x.nodeName === 'string'
|
||||
&& typeof x.getAttribute === 'function'
|
||||
;
|
||||
}
|
||||
|
||||
function inspectString (str, opts) {
|
||||
var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte);
|
||||
return wrapQuotes(s, 'single', opts);
|
||||
}
|
||||
|
||||
function lowbyte (c) {
|
||||
var n = c.charCodeAt(0);
|
||||
var x = { 8: 'b', 9: 't', 10: 'n', 12: 'f', 13: 'r' }[n];
|
||||
if (x) return '\\' + x;
|
||||
return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16);
|
||||
}
|
||||
|
||||
function markBoxed (str) {
|
||||
return 'Object(' + str + ')';
|
||||
}
|
||||
|
||||
function collectionOf (type, size, entries) {
|
||||
return type + ' (' + size + ') {' + entries.join(', ') + '}';
|
||||
}
|
||||
|
||||
function arrObjKeys (obj, inspect) {
|
||||
var isArr = isArray(obj);
|
||||
var xs = [];
|
||||
if (isArr) {
|
||||
xs.length = obj.length;
|
||||
for (var i = 0; i < obj.length; i++) {
|
||||
xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
|
||||
}
|
||||
}
|
||||
for (var key in obj) {
|
||||
if (!has(obj, key)) continue;
|
||||
if (isArr && String(Number(key)) === key && key < obj.length) continue;
|
||||
if (/[^\w$]/.test(key)) {
|
||||
xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
|
||||
} else {
|
||||
xs.push(key + ': ' + inspect(obj[key], obj));
|
||||
}
|
||||
}
|
||||
return xs;
|
||||
}
|
56
node_modules/object-inspect/package.json
generated
vendored
Normal file
56
node_modules/object-inspect/package.json
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"name": "object-inspect",
|
||||
"version": "1.6.0",
|
||||
"description": "string representations of objects in node and the browser",
|
||||
"main": "index.js",
|
||||
"devDependencies": {
|
||||
"core-js": "^2.5.5",
|
||||
"nyc": "^10.3.2",
|
||||
"tape": "^4.9.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "npm run test:bigint",
|
||||
"pretests-only": "node test-core-js",
|
||||
"tests-only": "tape test/*.js",
|
||||
"test:bigint": "node --harmony-bigint test/bigint",
|
||||
"coverage": "nyc npm run tests-only"
|
||||
},
|
||||
"testling": {
|
||||
"files": [
|
||||
"test/*.js",
|
||||
"test/browser/*.js"
|
||||
],
|
||||
"browsers": [
|
||||
"ie/6..latest",
|
||||
"chrome/latest",
|
||||
"firefox/latest",
|
||||
"safari/latest",
|
||||
"opera/latest",
|
||||
"iphone/latest",
|
||||
"ipad/latest",
|
||||
"android/latest"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/object-inspect.git"
|
||||
},
|
||||
"homepage": "https://github.com/substack/object-inspect",
|
||||
"keywords": [
|
||||
"inspect",
|
||||
"util.inspect",
|
||||
"object",
|
||||
"stringify",
|
||||
"pretty"
|
||||
],
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"license": "MIT",
|
||||
"browser": {
|
||||
"./util.inspect.js": false
|
||||
}
|
||||
}
|
61
node_modules/object-inspect/readme.markdown
generated
vendored
Normal file
61
node_modules/object-inspect/readme.markdown
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
# object-inspect
|
||||
|
||||
string representations of objects in node and the browser
|
||||
|
||||
[](https://ci.testling.com/substack/object-inspect)
|
||||
|
||||
[](http://travis-ci.org/substack/object-inspect)
|
||||
|
||||
# example
|
||||
|
||||
## circular
|
||||
|
||||
``` js
|
||||
var inspect = require('object-inspect');
|
||||
var obj = { a: 1, b: [3,4] };
|
||||
obj.c = obj;
|
||||
console.log(inspect(obj));
|
||||
```
|
||||
|
||||
## dom element
|
||||
|
||||
``` js
|
||||
var inspect = require('object-inspect');
|
||||
|
||||
var d = document.createElement('div');
|
||||
d.setAttribute('id', 'beep');
|
||||
d.innerHTML = '<b>wooo</b><i>iiiii</i>';
|
||||
|
||||
console.log(inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ]));
|
||||
```
|
||||
|
||||
output:
|
||||
|
||||
```
|
||||
[ <div id="beep">...</div>, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [ ... ] ] ] ] } ]
|
||||
```
|
||||
|
||||
# methods
|
||||
|
||||
``` js
|
||||
var inspect = require('object-inspect')
|
||||
```
|
||||
|
||||
## var s = inspect(obj, opts={})
|
||||
|
||||
Return a string `s` with the string representation of `obj` up to a depth of `opts.depth`.
|
||||
|
||||
Additional options:
|
||||
- `quoteStyle`: must be "single" or "double", if present
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install object-inspect
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
16
node_modules/object-inspect/test-core-js.js
generated
vendored
Normal file
16
node_modules/object-inspect/test-core-js.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
require('core-js');
|
||||
|
||||
var inspect = require('./');
|
||||
var test = require('tape');
|
||||
|
||||
test('Maps', function (t) {
|
||||
t.equal(inspect(new Map([[1, 2]])), 'Map (1) {1 => 2}');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Sets', function (t) {
|
||||
t.equal(inspect(new Set([[1, 2]])), 'Set (1) {[ 1, 2 ]}');
|
||||
t.end();
|
||||
});
|
30
node_modules/object-inspect/test/bigint.js
generated
vendored
Normal file
30
node_modules/object-inspect/test/bigint.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('bigint', { skip: typeof BigInt === 'undefined' }, function (t) {
|
||||
t.test('primitives', function (st) {
|
||||
st.plan(3);
|
||||
|
||||
st.equal(inspect(BigInt(-256)), '-256n');
|
||||
st.equal(inspect(BigInt(0)), '0n');
|
||||
st.equal(inspect(BigInt(256)), '256n');
|
||||
});
|
||||
|
||||
t.test('objects', function (st) {
|
||||
st.plan(3);
|
||||
|
||||
st.equal(inspect(Object(BigInt(-256))), 'Object(-256n)');
|
||||
st.equal(inspect(Object(BigInt(0))), 'Object(0n)');
|
||||
st.equal(inspect(Object(BigInt(256))), 'Object(256n)');
|
||||
});
|
||||
|
||||
t.test('syntactic primitives', function (st) {
|
||||
st.plan(3);
|
||||
|
||||
st.equal(inspect(Function('return -256n')()), '-256n');
|
||||
st.equal(inspect(Function('return 0n')()), '0n');
|
||||
st.equal(inspect(Function('return 256n')()), '256n');
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
15
node_modules/object-inspect/test/browser/dom.js
generated
vendored
Normal file
15
node_modules/object-inspect/test/browser/dom.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
var inspect = require('../../');
|
||||
var test = require('tape');
|
||||
|
||||
test('dom element', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var d = document.createElement('div');
|
||||
d.setAttribute('id', 'beep');
|
||||
d.innerHTML = '<b>wooo</b><i>iiiii</i>';
|
||||
|
||||
t.equal(
|
||||
inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ]),
|
||||
'[ <div id="beep">...</div>, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [Object] ] ] ] } ]'
|
||||
);
|
||||
});
|
9
node_modules/object-inspect/test/circular.js
generated
vendored
Normal file
9
node_modules/object-inspect/test/circular.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('circular', function (t) {
|
||||
t.plan(1);
|
||||
var obj = { a: 1, b: [3,4] };
|
||||
obj.c = obj;
|
||||
t.equal(inspect(obj), '{ a: 1, b: [ 3, 4 ], c: [Circular] }');
|
||||
});
|
9
node_modules/object-inspect/test/deep.js
generated
vendored
Normal file
9
node_modules/object-inspect/test/deep.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('deep', function (t) {
|
||||
t.plan(2);
|
||||
var obj = [ [ [ [ [ [ 500 ] ] ] ] ] ];
|
||||
t.equal(inspect(obj), '[ [ [ [ [ [Object] ] ] ] ] ]');
|
||||
t.equal(inspect(obj, { depth: 2 }), '[ [ [Object] ] ]');
|
||||
});
|
53
node_modules/object-inspect/test/element.js
generated
vendored
Normal file
53
node_modules/object-inspect/test/element.js
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('element', function (t) {
|
||||
t.plan(3);
|
||||
var elem = {
|
||||
nodeName: 'div',
|
||||
attributes: [ { name: 'class', value: 'row' } ],
|
||||
getAttribute: function (key) {},
|
||||
childNodes: []
|
||||
};
|
||||
var obj = [ 1, elem, 3 ];
|
||||
t.deepEqual(inspect(obj), '[ 1, <div class="row"></div>, 3 ]');
|
||||
t.deepEqual(inspect(obj, { quoteStyle: 'single' }), "[ 1, <div class='row'></div>, 3 ]");
|
||||
t.deepEqual(inspect(obj, { quoteStyle: 'double' }), '[ 1, <div class="row"></div>, 3 ]');
|
||||
});
|
||||
|
||||
test('element no attr', function (t) {
|
||||
t.plan(1);
|
||||
var elem = {
|
||||
nodeName: 'div',
|
||||
getAttribute: function (key) {},
|
||||
childNodes: []
|
||||
};
|
||||
var obj = [ 1, elem, 3 ];
|
||||
t.deepEqual(inspect(obj), '[ 1, <div></div>, 3 ]');
|
||||
});
|
||||
|
||||
test('element with contents', function (t) {
|
||||
t.plan(1);
|
||||
var elem = {
|
||||
nodeName: 'div',
|
||||
getAttribute: function (key) {},
|
||||
childNodes: [ { nodeName: 'b' } ]
|
||||
};
|
||||
var obj = [ 1, elem, 3 ];
|
||||
t.deepEqual(inspect(obj), '[ 1, <div>...</div>, 3 ]');
|
||||
});
|
||||
|
||||
test('element instance', function (t) {
|
||||
t.plan(1);
|
||||
var h = global.HTMLElement;
|
||||
global.HTMLElement = function (name, attr) {
|
||||
this.nodeName = name;
|
||||
this.attributes = attr;
|
||||
};
|
||||
global.HTMLElement.prototype.getAttribute = function () {};
|
||||
|
||||
var elem = new(global.HTMLElement)('div', []);
|
||||
var obj = [ 1, elem, 3 ];
|
||||
t.deepEqual(inspect(obj), '[ 1, <div></div>, 3 ]');
|
||||
global.HTMLElement = h;
|
||||
});
|
29
node_modules/object-inspect/test/err.js
generated
vendored
Normal file
29
node_modules/object-inspect/test/err.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('type error', function (t) {
|
||||
t.plan(1);
|
||||
var aerr = new TypeError;
|
||||
aerr.foo = 555;
|
||||
aerr.bar = [1,2,3];
|
||||
|
||||
var berr = new TypeError('tuv');
|
||||
berr.baz = 555;
|
||||
|
||||
var cerr = new SyntaxError;
|
||||
cerr.message = 'whoa';
|
||||
cerr['a-b'] = 5;
|
||||
|
||||
var obj = [
|
||||
new TypeError,
|
||||
new TypeError('xxx'),
|
||||
aerr, berr, cerr
|
||||
];
|
||||
t.equal(inspect(obj), '[ ' + [
|
||||
'[TypeError]',
|
||||
'[TypeError: xxx]',
|
||||
'{ [TypeError] foo: 555, bar: [ 1, 2, 3 ] }',
|
||||
'{ [TypeError: tuv] baz: 555 }',
|
||||
'{ [SyntaxError: whoa] message: \'whoa\', \'a-b\': 5 }'
|
||||
].join(', ') + ' ]');
|
||||
});
|
28
node_modules/object-inspect/test/fn.js
generated
vendored
Normal file
28
node_modules/object-inspect/test/fn.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('function', function (t) {
|
||||
t.plan(1);
|
||||
var obj = [ 1, 2, function f (n) {}, 4 ];
|
||||
t.equal(inspect(obj), '[ 1, 2, [Function: f], 4 ]');
|
||||
});
|
||||
|
||||
test('function name', function (t) {
|
||||
t.plan(1);
|
||||
var f = (function () {
|
||||
return function () {};
|
||||
}());
|
||||
f.toString = function () { return 'function xxx () {}' };
|
||||
var obj = [ 1, 2, f, 4 ];
|
||||
t.equal(inspect(obj), '[ 1, 2, [Function: xxx], 4 ]');
|
||||
});
|
||||
|
||||
test('anon function', function (t) {
|
||||
var f = (function () {
|
||||
return function () {};
|
||||
}());
|
||||
var obj = [ 1, 2, f, 4 ];
|
||||
t.equal(inspect(obj), '[ 1, 2, [Function], 4 ]');
|
||||
|
||||
t.end();
|
||||
});
|
31
node_modules/object-inspect/test/has.js
generated
vendored
Normal file
31
node_modules/object-inspect/test/has.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
var withoutProperty = function (object, property, fn) {
|
||||
var original;
|
||||
if (Object.getOwnPropertyDescriptor) {
|
||||
original = Object.getOwnPropertyDescriptor(object, property);
|
||||
} else {
|
||||
original = object[property];
|
||||
}
|
||||
delete object[property];
|
||||
try {
|
||||
fn();
|
||||
} finally {
|
||||
if (Object.getOwnPropertyDescriptor) {
|
||||
Object.defineProperty(object, property, original);
|
||||
} else {
|
||||
object[property] = original;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
test('when Object#hasOwnProperty is deleted', function (t) {
|
||||
t.plan(1);
|
||||
var arr = [1, , 3];
|
||||
Array.prototype[1] = 2; // this is needed to account for "in" vs "hasOwnProperty"
|
||||
withoutProperty(Object.prototype, 'hasOwnProperty', function () {
|
||||
t.equal(inspect(arr), '[ 1, , 3 ]');
|
||||
});
|
||||
delete Array.prototype[1];
|
||||
});
|
15
node_modules/object-inspect/test/holes.js
generated
vendored
Normal file
15
node_modules/object-inspect/test/holes.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
var test = require('tape');
|
||||
var inspect = require('../');
|
||||
|
||||
var xs = [ 'a', 'b' ];
|
||||
xs[5] = 'f';
|
||||
xs[7] = 'j';
|
||||
xs[8] = 'k';
|
||||
|
||||
test('holes', function (t) {
|
||||
t.plan(1);
|
||||
t.equal(
|
||||
inspect(xs),
|
||||
"[ 'a', 'b', , , , 'f', , 'j', 'k' ]"
|
||||
);
|
||||
});
|
8
node_modules/object-inspect/test/inspect.js
generated
vendored
Normal file
8
node_modules/object-inspect/test/inspect.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('inspect', function (t) {
|
||||
t.plan(1);
|
||||
var obj = [ { inspect: function () { return '!XYZ¡' } }, [] ];
|
||||
t.equal(inspect(obj), '[ !XYZ¡, [] ]');
|
||||
});
|
12
node_modules/object-inspect/test/lowbyte.js
generated
vendored
Normal file
12
node_modules/object-inspect/test/lowbyte.js
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
var test = require('tape');
|
||||
var inspect = require('../');
|
||||
|
||||
var obj = { x: 'a\r\nb', y: '\5! \x1f \022' };
|
||||
|
||||
test('interpolate low bytes', function (t) {
|
||||
t.plan(1);
|
||||
t.equal(
|
||||
inspect(obj),
|
||||
"{ x: 'a\\r\\nb', y: '\\x05! \\x1f \\x12' }"
|
||||
);
|
||||
});
|
12
node_modules/object-inspect/test/number.js
generated
vendored
Normal file
12
node_modules/object-inspect/test/number.js
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('negative zero', function (t) {
|
||||
t.equal(inspect(0), '0', 'inspect(0) === "0"');
|
||||
t.equal(inspect(Object(0)), 'Object(0)', 'inspect(Object(0)) === "Object(0)"');
|
||||
|
||||
t.equal(inspect(-0), '-0', 'inspect(-0) === "-0"');
|
||||
t.equal(inspect(Object(-0)), 'Object(-0)', 'inspect(Object(-0)) === "Object(-0)"');
|
||||
|
||||
t.end();
|
||||
});
|
17
node_modules/object-inspect/test/quoteStyle.js
generated
vendored
Normal file
17
node_modules/object-inspect/test/quoteStyle.js
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
'use strict';
|
||||
|
||||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('quoteStyle option', function (t) {
|
||||
t['throws'](function () { inspect(null, { quoteStyle: false }); }, 'false is not a valid value');
|
||||
t['throws'](function () { inspect(null, { quoteStyle: true }); }, 'true is not a valid value');
|
||||
t['throws'](function () { inspect(null, { quoteStyle: '' }); }, '"" is not a valid value');
|
||||
t['throws'](function () { inspect(null, { quoteStyle: {} }); }, '{} is not a valid value');
|
||||
t['throws'](function () { inspect(null, { quoteStyle: [] }); }, '[] is not a valid value');
|
||||
t['throws'](function () { inspect(null, { quoteStyle: 42 }); }, '42 is not a valid value');
|
||||
t['throws'](function () { inspect(null, { quoteStyle: NaN }); }, 'NaN is not a valid value');
|
||||
t['throws'](function () { inspect(null, { quoteStyle: function () {} }); }, 'a function is not a valid value');
|
||||
|
||||
t.end();
|
||||
});
|
12
node_modules/object-inspect/test/undef.js
generated
vendored
Normal file
12
node_modules/object-inspect/test/undef.js
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
var test = require('tape');
|
||||
var inspect = require('../');
|
||||
|
||||
var obj = { a: 1, b: [ 3, 4, undefined, null ], c: undefined, d: null };
|
||||
|
||||
test('undef and null', function (t) {
|
||||
t.plan(1);
|
||||
t.equal(
|
||||
inspect(obj),
|
||||
'{ a: 1, b: [ 3, 4, undefined, null ], c: undefined, d: null }'
|
||||
);
|
||||
});
|
136
node_modules/object-inspect/test/values.js
generated
vendored
Normal file
136
node_modules/object-inspect/test/values.js
generated
vendored
Normal file
|
@ -0,0 +1,136 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('values', function (t) {
|
||||
t.plan(1);
|
||||
var obj = [ {}, [], { 'a-b': 5 } ];
|
||||
t.equal(inspect(obj), '[ {}, [], { \'a-b\': 5 } ]');
|
||||
});
|
||||
|
||||
test('arrays with properties', function (t) {
|
||||
t.plan(1);
|
||||
var arr = [3];
|
||||
arr.foo = 'bar';
|
||||
var obj = [1, 2, arr];
|
||||
obj.baz = 'quux';
|
||||
obj.index = -1;
|
||||
t.equal(inspect(obj), '[ 1, 2, [ 3, foo: \'bar\' ], baz: \'quux\', index: -1 ]');
|
||||
});
|
||||
|
||||
test('has', function (t) {
|
||||
t.plan(1);
|
||||
var has = Object.prototype.hasOwnProperty;
|
||||
delete Object.prototype.hasOwnProperty;
|
||||
t.equal(inspect({ a: 1, b: 2 }), '{ a: 1, b: 2 }');
|
||||
Object.prototype.hasOwnProperty = has;
|
||||
});
|
||||
|
||||
test('indexOf seen', function (t) {
|
||||
t.plan(1);
|
||||
var xs = [ 1, 2, 3, {} ];
|
||||
xs.push(xs);
|
||||
|
||||
var seen = [];
|
||||
seen.indexOf = undefined;
|
||||
|
||||
t.equal(
|
||||
inspect(xs, {}, 0, seen),
|
||||
'[ 1, 2, 3, {}, [Circular] ]'
|
||||
);
|
||||
});
|
||||
|
||||
test('seen seen', function (t) {
|
||||
t.plan(1);
|
||||
var xs = [ 1, 2, 3 ];
|
||||
|
||||
var seen = [ xs ];
|
||||
seen.indexOf = undefined;
|
||||
|
||||
t.equal(
|
||||
inspect(xs, {}, 0, seen),
|
||||
'[Circular]'
|
||||
);
|
||||
});
|
||||
|
||||
test('seen seen seen', function (t) {
|
||||
t.plan(1);
|
||||
var xs = [ 1, 2, 3 ];
|
||||
|
||||
var seen = [ 5, xs ];
|
||||
seen.indexOf = undefined;
|
||||
|
||||
t.equal(
|
||||
inspect(xs, {}, 0, seen),
|
||||
'[Circular]'
|
||||
);
|
||||
});
|
||||
|
||||
test('symbols', { skip: typeof Symbol !== 'function' }, function (t) {
|
||||
var sym = Symbol('foo');
|
||||
t.equal(inspect(sym), 'Symbol(foo)', 'Symbol("foo") should be "Symbol(foo)"');
|
||||
t.equal(inspect(Object(sym)), 'Object(Symbol(foo))', 'Object(Symbol("foo")) should be "Object(Symbol(foo))"');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Map', { skip: typeof Map !== 'function' }, function (t) {
|
||||
var map = new Map();
|
||||
map.set({ a: 1 }, ['b']);
|
||||
map.set(3, NaN);
|
||||
var expectedString = 'Map (2) {' + inspect({ a: 1 }) + ' => ' + inspect(['b']) + ', 3 => NaN}';
|
||||
t.equal(inspect(map), expectedString, 'new Map([[{ a: 1 }, ["b"]], [3, NaN]]) should show size and contents');
|
||||
t.equal(inspect(new Map()), 'Map (0) {}', 'empty Map should show as empty');
|
||||
|
||||
var nestedMap = new Map();
|
||||
nestedMap.set(nestedMap, map);
|
||||
t.equal(inspect(nestedMap), 'Map (1) {[Circular] => ' + expectedString + '}', 'Map containing a Map should work');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Set', { skip: typeof Set !== 'function' }, function (t) {
|
||||
var set = new Set();
|
||||
set.add({ a: 1 });
|
||||
set.add(['b']);
|
||||
var expectedString = 'Set (2) {' + inspect({ a: 1 }) + ', ' + inspect(['b']) + '}';
|
||||
t.equal(inspect(set), expectedString, 'new Set([{ a: 1 }, ["b"]]) should show size and contents');
|
||||
t.equal(inspect(new Set()), 'Set (0) {}', 'empty Set should show as empty');
|
||||
|
||||
var nestedSet = new Set();
|
||||
nestedSet.add(set);
|
||||
nestedSet.add(nestedSet);
|
||||
t.equal(inspect(nestedSet), 'Set (2) {' + expectedString + ', [Circular]}', 'Set containing a Set should work');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Strings', function (t) {
|
||||
var str = 'abc';
|
||||
|
||||
t.equal(inspect(str), "'" + str + "'", 'primitive string shows as such');
|
||||
t.equal(inspect(str, { quoteStyle: 'single' }), "'" + str + "'", 'primitive string shows as such, single quoted');
|
||||
t.equal(inspect(str, { quoteStyle: 'double' }), '"' + str + '"', 'primitive string shows as such, double quoted');
|
||||
t.equal(inspect(Object(str)), 'Object(' + inspect(str) + ')', 'String object shows as such');
|
||||
t.equal(inspect(Object(str), { quoteStyle: 'single' }), 'Object(' + inspect(str, { quoteStyle: 'single' }) + ')', 'String object shows as such, single quoted');
|
||||
t.equal(inspect(Object(str), { quoteStyle: 'double' }), 'Object(' + inspect(str, { quoteStyle: 'double' }) + ')', 'String object shows as such, double quoted');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Numbers', function (t) {
|
||||
var num = 42;
|
||||
|
||||
t.equal(inspect(num), String(num), 'primitive number shows as such');
|
||||
t.equal(inspect(Object(num)), 'Object(' + inspect(num) + ')', 'Number object shows as such');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Booleans', function (t) {
|
||||
t.equal(inspect(true), String(true), 'primitive true shows as such');
|
||||
t.equal(inspect(Object(true)), 'Object(' + inspect(true) + ')', 'Boolean object true shows as such');
|
||||
|
||||
t.equal(inspect(false), String(false), 'primitive false shows as such');
|
||||
t.equal(inspect(Object(false)), 'Object(' + inspect(false) + ')', 'Boolean false object shows as such');
|
||||
|
||||
t.end();
|
||||
});
|
1
node_modules/object-inspect/util.inspect.js
generated
vendored
Normal file
1
node_modules/object-inspect/util.inspect.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('util').inspect;
|
Loading…
Add table
Add a link
Reference in a new issue