monitorCodeUse.js.flow 760 B

12345678910111213141516171819202122232425
  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. * @providesModule monitorCodeUse
  8. */
  9. 'use strict';
  10. var invariant = require('./invariant');
  11. /**
  12. * Provides open-source compatible instrumentation for monitoring certain API
  13. * uses before we're ready to issue a warning or refactor. It accepts an event
  14. * name which may only contain the characters [a-z0-9_] and an optional data
  15. * object with further information.
  16. */
  17. function monitorCodeUse(eventName, data) {
  18. invariant(eventName && !/[^a-z0-9_]/.test(eventName), 'You must provide an eventName using only the characters [a-z0-9_]');
  19. }
  20. module.exports = monitorCodeUse;