diff options
Diffstat (limited to 'node_modules/es-abstract/5/CheckObjectCoercible.js')
-rw-r--r-- | node_modules/es-abstract/5/CheckObjectCoercible.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/node_modules/es-abstract/5/CheckObjectCoercible.js b/node_modules/es-abstract/5/CheckObjectCoercible.js new file mode 100644 index 000000000..f02b28911 --- /dev/null +++ b/node_modules/es-abstract/5/CheckObjectCoercible.js @@ -0,0 +1,14 @@ +'use strict'; + +var GetIntrinsic = require('../GetIntrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +// http://www.ecma-international.org/ecma-262/5.1/#sec-9.10 + +module.exports = function CheckObjectCoercible(value, optMessage) { + if (value == null) { + throw new $TypeError(optMessage || ('Cannot call method on ' + value)); + } + return value; +}; |