CheckObjectCoercible.js 297 B

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