403Webshell
Server IP : 159.203.156.69  /  Your IP : 216.73.217.172
Web Server : nginx/1.24.0
System : Linux main-ubuntu 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/tanviranik.com/node_modules/es-shim-unscopables/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/tanviranik.com/node_modules/es-shim-unscopables/test/index.js
'use strict';

var test = require('tape');
var inspect = require('object-inspect');
var v = require('es-value-fixtures');
var forEach = require('for-each');
var hasOwn = require('hasown');

var shimUnscopables = require('../');

/** @type {(a: symbol, b: symbol) => number} */
var sortSymbols = function (a, b) {
	return inspect(a).localeCompare(inspect(b));
};

test('shimUnscopables', function (t) {
	t.equal(typeof shimUnscopables, 'function', 'is a function');

	forEach(v.nonStrings, function (notNonEmptyString) {
		t['throws'](
			// @ts-expect-error
			function () { shimUnscopables(notNonEmptyString); },
			TypeError,
			inspect(notNonEmptyString) + ' is not a non-empty String'
		);
	});

	t['throws'](
		// @ts-expect-error
		function () { shimUnscopables('x'); },
		TypeError,
		inspect('x') + ' is not on Array.prototype'
	);

	t.test('no symbols', { skip: typeof Symbol === 'function' }, function (st) {
		st.doesNotThrow(function () { shimUnscopables('forEach'); });

		st.end();
	});

	t.test('symbols, no unscopables', { skip: typeof Symbol !== 'function' || !!Symbol.unscopables }, function (st) {
		st.deepEqual(Object.getOwnPropertySymbols(Array.prototype), [Symbol.iterator]);

		shimUnscopables('forEach');

		st.deepEqual(Object.getOwnPropertySymbols(Array.prototype), [Symbol.iterator]);

		st.end();
	});

	t.test('Symbol.unscopables', { skip: typeof Symbol !== 'function' || !Symbol.unscopables }, function (st) {
		st.deepEqual(
			Object.getOwnPropertySymbols(Array.prototype).sort(sortSymbols),
			[Symbol.iterator, Symbol.unscopables]
		);
		st.notOk(hasOwn(Array.prototype[Symbol.unscopables], 'forEach'), 'unscopables map lacks forEach');

		shimUnscopables('forEach');

		st.deepEqual(
			Object.getOwnPropertySymbols(Array.prototype).sort(sortSymbols),
			[Symbol.iterator, Symbol.unscopables]
		);
		st.equal(Array.prototype[Symbol.unscopables].forEach, true, 'unscopables map has forEach');

		st.end();
	});

	t.end();
});

Youez - 2016 - github.com/yon3zu
LinuXploit