aswi2020vldc-gitlab/templetes/node_modules/es-abstract/5/CheckObjectCoercible.js @ 56f6c6df
1 |
'use strict'; |
---|---|
2 |
|
3 |
var GetIntrinsic = require('../GetIntrinsic'); |
4 |
|
5 |
var $TypeError = GetIntrinsic('%TypeError%'); |
6 |
|
7 |
// http://www.ecma-international.org/ecma-262/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 |
};
|