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