require-object-coercible-x
Version:
ES6-compliant shim for RequireObjectCoercible.
21 lines (17 loc) • 609 B
JavaScript
import isNil from 'is-nil-x';
/**
* The abstract operation RequireObjectCoercible throws an error if argument
* is a value that cannot be converted to an Object using ToObject.
*
* @param {*} [value] - The `value` to check.
* @throws {TypeError} If `value` is a `null` or `undefined`.
* @returns {string} The `value`.
*/
var requireObjectCoercible = function requireObjectCoercible(value) {
if (isNil(value)) {
throw new TypeError("Cannot call method on ".concat(value));
}
return value;
};
export default requireObjectCoercible;
//# sourceMappingURL=require-object-coercible-x.esm.js.map