UNPKG

require-coercible-to-string-x

Version:

Requires an argument is corecible then converts using ToString.

16 lines (13 loc) 515 B
import requireObjectCoercible from 'require-object-coercible-x'; import toStr from 'to-string-x'; /** * This method requires an argument is corecible then converts using ToString. * * @param {*} [value] - The value to converted to a string. * @throws {TypeError} If value is null or undefined. * @returns {string} The value as a string. */ const requireCoercibleToString = function requireCoercibleToString(value) { return toStr(requireObjectCoercible(value)); }; export default requireCoercibleToString;