/
githubmirror
/
preact
Обзор
Документация
Войти
/
githubmirror
/
preact
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
compat/test/browser/testUtils.js
24 строки
652 B
Ryan Christian
chore: Silence esbuild warning during tests
02 май 2024, 06:55
02 май 2024, 06:55
58cf15c
Код
Авторство
О чём код?
/** * Retrieve a Symbol if supported or use the fallback value * @param {string} name The name of the Symbol to look up * @param {number} fallback Fallback value if Symbols are not supported */ export function getSymbol(name, fallback) { let out = fallback; try { // eslint-disable-next-line if ( Function.prototype.toString .call((0, eval)('Symbol.for')) .match(/\[native code\]/) ) { // Concatenate these string literals to prevent the test // harness and/or Babel from modifying the symbol value. // eslint-disable-next-line out = (0, eval)('Sym' + 'bol.for("' + name + '")'); } } catch (e) {} return out; }