monitorCodeUse.js 805 B

123456789101112131415161718192021222324
  1. /**
  2. * Copyright (c) 2014-present, Facebook, Inc.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. */
  8. 'use strict';
  9. var invariant = require('./invariant');
  10. /**
  11. * Provides open-source compatible instrumentation for monitoring certain API
  12. * uses before we're ready to issue a warning or refactor. It accepts an event
  13. * name which may only contain the characters [a-z0-9_] and an optional data
  14. * object with further information.
  15. */
  16. function monitorCodeUse(eventName, data) {
  17. !(eventName && !/[^a-z0-9_]/.test(eventName)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You must provide an eventName using only the characters [a-z0-9_]') : invariant(false) : void 0;
  18. }
  19. module.exports = monitorCodeUse;