CheckObjectCoercible.js 345 B

1234567891011121314
  1. 'use strict';
  2. var GetIntrinsic = require('get-intrinsic');
  3. var $TypeError = GetIntrinsic('%TypeError%');
  4. // http://262.ecma-international.org/5.1/#sec-9.10
  5. module.exports = function CheckObjectCoercible(value, optMessage) {
  6. if (value == null) {
  7. throw new $TypeError(optMessage || ('Cannot call method on ' + value));
  8. }
  9. return value;
  10. };