Socket
Socket
Sign inDemoInstall

object-inspect

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-inspect - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

.eslintignore

12

example/all.js

@@ -0,9 +1,13 @@

'use strict';
var inspect = require('../');
var Buffer = require('safer-buffer').Buffer;
var holes = [ 'a', 'b' ];
holes[4] = 'e', holes[6] = 'g';
var holes = ['a', 'b'];
holes[4] = 'e';
holes[6] = 'g';
var obj = {
a: 1,
b: [ 3, 4, undefined, null ],
b: [3, 4, undefined, null],
c: undefined,

@@ -16,5 +20,5 @@ d: null,

},
now: new Date
now: new Date()
};
obj.self = obj;
console.log(inspect(obj));

@@ -0,4 +1,6 @@

'use strict';
var inspect = require('../');
var obj = { a: 1, b: [3,4] };
var obj = { a: 1, b: [3, 4] };
obj.c = obj;
console.log(inspect(obj));

@@ -0,3 +1,5 @@

'use strict';
var inspect = require('../');
var obj = [ 1, 2, function f (n) { return n + 5 }, 4 ];
var obj = [1, 2, function f(n) { return n + 5; }, 4];
console.log(inspect(obj));

@@ -0,1 +1,4 @@

'use strict';
/* eslint-env browser */
var inspect = require('../');

@@ -7,2 +10,2 @@

console.log(inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ]));
console.log(inspect([d, { a: 3, b: 4, c: [5, 6, [7, [8, [9]]]] }]));

@@ -9,11 +9,16 @@ var hasMap = typeof Map === 'function' && Map.prototype;

var setForEach = hasSet && Set.prototype.forEach;
var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
var booleanValueOf = Boolean.prototype.valueOf;
var objectToString = Object.prototype.toString;
var match = String.prototype.match;
var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
var inspectCustom = require('./util.inspect').custom;
var inspectSymbol = (inspectCustom && isSymbol(inspectCustom)) ? inspectCustom : null;
var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
module.exports = function inspect_ (obj, opts, depth, seen) {
if (!opts) opts = {};
module.exports = function inspect_(obj, options, depth, seen) {
var opts = options || {};

@@ -38,13 +43,13 @@ if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {

if (typeof obj === 'number') {
if (obj === 0) {
return Infinity / obj > 0 ? '0' : '-0';
}
return String(obj);
if (obj === 0) {
return Infinity / obj > 0 ? '0' : '-0';
}
return String(obj);
}
if (typeof obj === 'bigint') {
return String(obj) + 'n';
if (typeof obj === 'bigint') { // eslint-disable-line valid-typeof
return String(obj) + 'n';
}
var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
if (typeof depth === 'undefined') depth = 0;
if (typeof depth === 'undefined') { depth = 0; }
if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {

@@ -54,8 +59,9 @@ return '[Object]';

if (typeof seen === 'undefined') seen = [];
else if (indexOf(seen, obj) >= 0) {
if (typeof seen === 'undefined') {
seen = [];
} else if (indexOf(seen, obj) >= 0) {
return '[Circular]';
}
function inspect (value, from) {
function inspect(value, from) {
if (from) {

@@ -83,3 +89,3 @@ seen = seen.slice();

s += '>';
if (obj.childNodes && obj.childNodes.length) s += '...';
if (obj.childNodes && obj.childNodes.length) { s += '...'; }
s += '</' + String(obj.nodeName).toLowerCase() + '>';

@@ -89,3 +95,3 @@ return s;

if (isArray(obj)) {
if (obj.length === 0) return '[]';
if (obj.length === 0) { return '[]'; }
return '[ ' + arrObjKeys(obj, inspect).join(', ') + ' ]';

@@ -95,3 +101,3 @@ }

var parts = arrObjKeys(obj, inspect);
if (parts.length === 0) return '[' + String(obj) + ']';
if (parts.length === 0) { return '[' + String(obj) + ']'; }
return '{ [' + String(obj) + '] ' + parts.join(', ') + ' }';

@@ -107,15 +113,21 @@ }

if (isMap(obj)) {
var parts = [];
var mapParts = [];
mapForEach.call(obj, function (value, key) {
parts.push(inspect(key, obj) + ' => ' + inspect(value, obj));
mapParts.push(inspect(key, obj) + ' => ' + inspect(value, obj));
});
return collectionOf('Map', mapSize.call(obj), parts);
return collectionOf('Map', mapSize.call(obj), mapParts);
}
if (isSet(obj)) {
var parts = [];
setForEach.call(obj, function (value ) {
parts.push(inspect(value, obj));
var setParts = [];
setForEach.call(obj, function (value) {
setParts.push(inspect(value, obj));
});
return collectionOf('Set', setSize.call(obj), parts);
return collectionOf('Set', setSize.call(obj), setParts);
}
if (isWeakMap(obj)) {
return weakCollectionOf('WeakMap');
}
if (isWeakSet(obj)) {
return weakCollectionOf('WeakSet');
}
if (isNumber(obj)) {

@@ -135,3 +147,3 @@ return markBoxed(inspect(Number(obj)));

var xs = arrObjKeys(obj, inspect);
if (xs.length === 0) return '{}';
if (xs.length === 0) { return '{}'; }
return '{ ' + xs.join(', ') + ' }';

@@ -142,3 +154,3 @@ }

function wrapQuotes (s, defaultStyle, opts) {
function wrapQuotes(s, defaultStyle, opts) {
var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";

@@ -148,35 +160,36 @@ return quoteChar + s + quoteChar;

function quote (s) {
function quote(s) {
return String(s).replace(/"/g, '&quot;');
}
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]'; }
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) {
function has(obj, key) {
return hasOwn.call(obj, key);
}
function toStr (obj) {
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 nameOf(f) {
if (f.name) { return f.name; }
var m = match.call(f, /^function\s*([\w$]+)/);
if (m) { return m[1]; }
return null;
}
function indexOf (xs, x) {
if (xs.indexOf) return xs.indexOf(x);
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;
if (xs[i] === x) { return i; }
}

@@ -186,4 +199,4 @@ return -1;

function isMap (x) {
if (!mapSize) {
function isMap(x) {
if (!mapSize || !x || typeof x !== 'object') {
return false;

@@ -203,7 +216,23 @@ }

function isSet (x) {
if (!setSize) {
function isWeakMap(x) {
if (!weakMapHas || !x || typeof x !== 'object') {
return false;
}
try {
weakMapHas.call(x, weakMapHas);
try {
weakSetHas.call(x, weakSetHas);
} catch (s) {
return true;
}
return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
} catch (e) {}
return false;
}
function isSet(x) {
if (!setSize || !x || typeof x !== 'object') {
return false;
}
try {
setSize.call(x);

@@ -220,13 +249,28 @@ try {

function isElement (x) {
if (!x || typeof x !== 'object') return false;
function isWeakSet(x) {
if (!weakSetHas || !x || typeof x !== 'object') {
return false;
}
try {
weakSetHas.call(x, weakSetHas);
try {
weakMapHas.call(x, weakMapHas);
} catch (s) {
return true;
}
return x instanceof WeakSet; // 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'
;
return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
}
function inspectString (str, opts) {
function inspectString(str, opts) {
// eslint-disable-next-line no-control-regex
var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte);

@@ -236,18 +280,24 @@ return wrapQuotes(s, 'single', opts);

function lowbyte (c) {
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;
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) {
function markBoxed(str) {
return 'Object(' + str + ')';
}
function collectionOf (type, size, entries) {
function weakCollectionOf(type) {
return type + ' { ? }';
}
function collectionOf(type, size, entries) {
return type + ' (' + size + ') {' + entries.join(', ') + '}';
}
function arrObjKeys (obj, inspect) {
function arrObjKeys(obj, inspect) {
var isArr = isArray(obj);

@@ -261,6 +311,6 @@ var xs = [];

}
for (var key in obj) {
if (!has(obj, key)) continue;
if (isArr && String(Number(key)) === key && key < obj.length) continue;
if (/[^\w$]/.test(key)) {
for (var key in obj) { // eslint-disable-line no-restricted-syntax
if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
if ((/[^\w$]/).test(key)) {
xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));

@@ -267,0 +317,0 @@ } else {

{
"name": "object-inspect",
"version": "1.6.0",
"version": "1.7.0",
"description": "string representations of objects in node and the browser",
"main": "index.js",
"devDependencies": {
"core-js": "^2.5.5",
"@ljharb/eslint-config": "^15.0.1",
"core-js": "^2.6.10",
"eslint": "^6.6.0",
"nyc": "^10.3.2",
"tape": "^4.9.0"
"tape": "^4.11.0"
},
"scripts": {
"pretest": "npm run lint",
"lint": "eslint .",
"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",
"posttest": "npx aud --production",
"coverage": "nyc npm run tests-only"

@@ -52,6 +55,15 @@ },

},
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"browser": {
"./util.inspect.js": false
},
"greenkeeper": {
"ignore": [
"nyc",
"core-js"
]
}
}

@@ -5,27 +5,28 @@ var inspect = require('../');

test('bigint', { skip: typeof BigInt === 'undefined' }, function (t) {
t.test('primitives', function (st) {
st.plan(3);
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');
});
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);
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)');
});
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);
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');
});
/* eslint-disable no-new-func */
st.equal(inspect(Function('return -256n')()), '-256n');
st.equal(inspect(Function('return 0n')()), '0n');
st.equal(inspect(Function('return 256n')()), '256n');
});
t.end();
t.end();
});

@@ -6,11 +6,11 @@ var inspect = require('../../');

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]]]] } ]),
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] ] ] ] } ]'
);
});

@@ -6,5 +6,5 @@ var inspect = require('../');

t.plan(1);
var obj = { a: 1, b: [3,4] };
var obj = { a: 1, b: [3, 4] };
obj.c = obj;
t.equal(inspect(obj), '{ a: 1, b: [ 3, 4 ], c: [Circular] }');
});

@@ -6,5 +6,5 @@ var inspect = require('../');

t.plan(2);
var obj = [ [ [ [ [ [ 500 ] ] ] ] ] ];
var obj = [[[[[[500]]]]]];
t.equal(inspect(obj), '[ [ [ [ [ [Object] ] ] ] ] ]');
t.equal(inspect(obj, { depth: 2 }), '[ [ [Object] ] ]');
});

@@ -8,7 +8,7 @@ var inspect = require('../');

nodeName: 'div',
attributes: [ { name: 'class', value: 'row' } ],
getAttribute: function (key) {},
attributes: [{ name: 'class', value: 'row' }],
getAttribute: function (key) { return key; },
childNodes: []
};
var obj = [ 1, elem, 3 ];
var obj = [1, elem, 3];
t.deepEqual(inspect(obj), '[ 1, <div class="row"></div>, 3 ]');

@@ -18,3 +18,3 @@ t.deepEqual(inspect(obj, { quoteStyle: 'single' }), "[ 1, <div class='row'></div>, 3 ]");

});
test('element no attr', function (t) {

@@ -24,6 +24,6 @@ t.plan(1);

nodeName: 'div',
getAttribute: function (key) {},
getAttribute: function (key) { return key; },
childNodes: []
};
var obj = [ 1, elem, 3 ];
var obj = [1, elem, 3];
t.deepEqual(inspect(obj), '[ 1, <div></div>, 3 ]');

@@ -36,6 +36,6 @@ });

nodeName: 'div',
getAttribute: function (key) {},
childNodes: [ { nodeName: 'b' } ]
getAttribute: function (key) { return key; },
childNodes: [{ nodeName: 'b' }]
};
var obj = [ 1, elem, 3 ];
var obj = [1, elem, 3];
t.deepEqual(inspect(obj), '[ 1, <div>...</div>, 3 ]');

@@ -52,7 +52,7 @@ });

global.HTMLElement.prototype.getAttribute = function () {};
var elem = new(global.HTMLElement)('div', []);
var obj = [ 1, elem, 3 ];
var elem = new global.HTMLElement('div', []);
var obj = [1, elem, 3];
t.deepEqual(inspect(obj), '[ 1, <div></div>, 3 ]');
global.HTMLElement = h;
});

@@ -6,17 +6,19 @@ var inspect = require('../');

t.plan(1);
var aerr = new TypeError;
var aerr = new TypeError();
aerr.foo = 555;
aerr.bar = [1,2,3];
aerr.bar = [1, 2, 3];
var berr = new TypeError('tuv');
berr.baz = 555;
var cerr = new SyntaxError;
var cerr = new SyntaxError();
cerr.message = 'whoa';
cerr['a-b'] = 5;
var obj = [
new TypeError,
new TypeError(),
new TypeError('xxx'),
aerr, berr, cerr
aerr,
berr,
cerr
];

@@ -23,0 +25,0 @@ t.equal(inspect(obj), '[ ' + [

@@ -6,3 +6,3 @@ var inspect = require('../');

t.plan(1);
var obj = [ 1, 2, function f (n) {}, 4 ];
var obj = [1, 2, function f(n) { return n; }, 4];
t.equal(inspect(obj), '[ 1, 2, [Function: f], 4 ]');

@@ -14,6 +14,6 @@ });

var f = (function () {
return function () {};
return function () {};
}());
f.toString = function () { return 'function xxx () {}' };
var obj = [ 1, 2, f, 4 ];
f.toString = function () { return 'function xxx () {}'; };
var obj = [1, 2, f, 4];
t.equal(inspect(obj), '[ 1, 2, [Function: xxx], 4 ]');

@@ -24,5 +24,5 @@ });

var f = (function () {
return function () {};
return function () {};
}());
var obj = [ 1, 2, f, 4 ];
var obj = [1, 2, f, 4];
t.equal(inspect(obj), '[ 1, 2, [Function], 4 ]');

@@ -29,0 +29,0 @@

var inspect = require('../');
var test = require('tape');
var withoutProperty = function (object, property, fn) {
function withoutProperty(object, property, fn) {
var original;

@@ -21,12 +21,15 @@ if (Object.getOwnPropertyDescriptor) {

}
};
}
test('when Object#hasOwnProperty is deleted', function (t) {
t.plan(1);
var arr = [1, , 3];
var arr = [1, , 3]; // eslint-disable-line no-sparse-arrays
// eslint-disable-next-line no-extend-native
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];
delete Array.prototype[1];
});
var test = require('tape');
var inspect = require('../');
var xs = [ 'a', 'b' ];
var xs = ['a', 'b'];
xs[5] = 'f';

@@ -6,0 +6,0 @@ xs[7] = 'j';

@@ -1,8 +0,20 @@

var inspect = require('../');
var test = require('tape');
var hasSymbols = require('has-symbols')();
var utilInspect = require('../util.inspect');
var inspect = require('..');
test('inspect', function (t) {
t.plan(1);
var obj = [ { inspect: function () { return '!XYZ¡' } }, [] ];
var obj = [{ inspect: function () { return '!XYZ¡'; } }, []];
t.equal(inspect(obj), '[ !XYZ¡, [] ]');
});
test('inspect custom symbol', { skip: !hasSymbols || !utilInspect }, function (t) {
t.plan(1);
var obj = { inspect: function () { return 'string'; } };
obj[utilInspect.custom] = function () { return 'symbol'; };
t.equal(inspect([obj, []]), '[ ' + (utilInspect.custom ? 'symbol' : 'string') + ', [] ]');
});
var test = require('tape');
var inspect = require('../');
var obj = { x: 'a\r\nb', y: '\5! \x1f \022' };
var obj = { x: 'a\r\nb', y: '\x05! \x1f \x12' };

@@ -6,0 +6,0 @@ test('interpolate low bytes', function (t) {

var test = require('tape');
var inspect = require('../');
var obj = { a: 1, b: [ 3, 4, undefined, null ], c: undefined, d: null };
var obj = { a: 1, b: [3, 4, undefined, null], c: undefined, d: null };

@@ -6,0 +6,0 @@ test('undef and null', function (t) {

@@ -6,3 +6,3 @@ var inspect = require('../');

t.plan(1);
var obj = [ {}, [], { 'a-b': 5 } ];
var obj = [{}, [], { 'a-b': 5 }];
t.equal(inspect(obj), '[ {}, [], { \'a-b\': 5 } ]');

@@ -12,9 +12,9 @@ });

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 ]');
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 ]');
});

@@ -27,3 +27,3 @@

t.equal(inspect({ a: 1, b: 2 }), '{ a: 1, b: 2 }');
Object.prototype.hasOwnProperty = has;
Object.prototype.hasOwnProperty = has; // eslint-disable-line no-extend-native
});

@@ -33,8 +33,8 @@

t.plan(1);
var xs = [ 1, 2, 3, {} ];
var xs = [1, 2, 3, {}];
xs.push(xs);
var seen = [];
seen.indexOf = undefined;
t.equal(

@@ -48,7 +48,7 @@ inspect(xs, {}, 0, seen),

t.plan(1);
var xs = [ 1, 2, 3 ];
var seen = [ xs ];
var xs = [1, 2, 3];
var seen = [xs];
seen.indexOf = undefined;
t.equal(

@@ -62,7 +62,7 @@ inspect(xs, {}, 0, seen),

t.plan(1);
var xs = [ 1, 2, 3 ];
var seen = [ 5, xs ];
var xs = [1, 2, 3];
var seen = [5, xs];
seen.indexOf = undefined;
t.equal(

@@ -96,2 +96,12 @@ inspect(xs, {}, 0, seen),

test('WeakMap', { skip: typeof WeakMap !== 'function' }, function (t) {
var map = new WeakMap();
map.set({ a: 1 }, ['b']);
var expectedString = 'WeakMap { ? }';
t.equal(inspect(map), expectedString, 'new WeakMap([[{ a: 1 }, ["b"]]]) should not show size or contents');
t.equal(inspect(new WeakMap()), 'WeakMap { ? }', 'empty WeakMap should not show as empty');
t.end();
});
test('Set', { skip: typeof Set !== 'function' }, function (t) {

@@ -113,2 +123,12 @@ var set = new Set();

test('WeakSet', { skip: typeof WeakSet !== 'function' }, function (t) {
var map = new WeakSet();
map.add({ a: 1 });
var expectedString = 'WeakSet { ? }';
t.equal(inspect(map), expectedString, 'new WeakSet([{ a: 1 }]) should not show size or contents');
t.equal(inspect(new WeakSet()), 'WeakSet { ? }', 'empty WeakSet should not show as empty');
t.end();
});
test('Strings', function (t) {

@@ -115,0 +135,0 @@ var str = 'abc';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc