blob: 9083c717a357c5d21478bcced466c041141be5a2 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001'use strict';
2
3var GetIntrinsic = require('get-intrinsic');
4
5var $TypeError = GetIntrinsic('%TypeError%');
6
7// http://262.ecma-international.org/5.1/#sec-9.10
8
9module.exports = function CheckObjectCoercible(value, optMessage) {
10 if (value == null) {
11 throw new $TypeError(optMessage || ('Cannot call method on ' + value));
12 }
13 return value;
14};