![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.quebec/private_html/node_modules/safe-push-apply/test/ |
'use strict';
var test = require('tape');
var safePushApply = require('../');
test('safe-push-apply', function (t) {
t.equal(typeof safePushApply, 'function', 'is a function');
t.equal(safePushApply.length, 2, 'has a length of 2');
t['throws'](
// @ts-expect-error
function () { safePushApply({}, []); },
TypeError,
'throws if target is not an array'
);
var a = [1, 2];
var b = [3, 4];
safePushApply(a, b);
t.deepEqual(a, [1, 2, 3, 4], 'b is pushed into a');
t.deepEqual(b, [3, 4], 'b is not modified');
var c = '567';
// @ts-expect-error TS ArrayLike doesn't accept strings for some reason
safePushApply(a, c);
t.deepEqual(a, [1, 2, 3, 4, '5', '6', '7'], 'works with arraylike source');
t.end();
});