nullthrows.js 372 B

12345678910111213141516171819
  1. "use strict";
  2. /**
  3. * Copyright (c) 2013-present, Facebook, Inc.
  4. *
  5. * This source code is licensed under the MIT license found in the
  6. * LICENSE file in the root directory of this source tree.
  7. *
  8. *
  9. */
  10. var nullthrows = function nullthrows(x) {
  11. if (x != null) {
  12. return x;
  13. }
  14. throw new Error("Got unexpected null or undefined");
  15. };
  16. module.exports = nullthrows;