/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
status
packages/shared/warning.js
32 строки
1 KB
Héctor Ramos
Drop the year from Facebook copyright headers and the LICENSE file. (#13593)
08 сен 2018, 01:11
Не верифицирован
08 сен 2018, 01:11
b87aabd
Код
Авторство
О чём код?
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import warningWithoutStack from 'shared/warningWithoutStack'; import ReactSharedInternals from 'shared/ReactSharedInternals'; /** * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths. */ let warning = warningWithoutStack; if (__DEV__) { warning = function(condition, format, ...args) { if (condition) { return; } const ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; const stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args warningWithoutStack(false, format + '%s', ...args, stack); }; } export default warning;