You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nullthrows.js.flow 392 B

пре 3 година
123456789101112131415161718
  1. /**
  2. * Copyright (c) 2013-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 nullthrows
  8. * @flow
  9. */
  10. var nullthrows = function <T>(x: ?T): T {
  11. if (x != null) {
  12. return x;
  13. }
  14. throw new Error("Got unexpected null or undefined");
  15. };
  16. module.exports = nullthrows;