update
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
module.exports = /** @type {(t: import('tape').Test) => void | false} */ function runSymbolTests(t) {
|
||||
t.equal(typeof Symbol, 'function', 'global Symbol is a function');
|
||||
t.ok(Symbol.toStringTag, 'Symbol.toStringTag exists');
|
||||
|
||||
if (typeof Symbol !== 'function' || !Symbol.toStringTag) { return false; }
|
||||
|
||||
/** @type {{ [Symbol.toStringTag]?: 'test'}} */
|
||||
var obj = {};
|
||||
obj[Symbol.toStringTag] = 'test';
|
||||
|
||||
t.equal(Object.prototype.toString.call(obj), '[object test]');
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
module.exports = defer;
|
||||
|
||||
/**
|
||||
* Runs provided function on next iteration of the event loop
|
||||
*
|
||||
* @param {function} fn - function to run
|
||||
*/
|
||||
function defer(fn)
|
||||
{
|
||||
var nextTick = typeof setImmediate == 'function'
|
||||
? setImmediate
|
||||
: (
|
||||
typeof process == 'object' && typeof process.nextTick == 'function'
|
||||
? process.nextTick
|
||||
: null
|
||||
);
|
||||
|
||||
if (nextTick)
|
||||
{
|
||||
nextTick(fn);
|
||||
}
|
||||
else
|
||||
{
|
||||
setTimeout(fn, 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user