voca
Version:
The ultimate JavaScript string library
27 lines (21 loc) • 516 B
JavaScript
import { i as isNil } from './is_nil.js';
import isString from '../is_string.js';
/**
* Get the string representation of the `value`.
* Converts the `value` to string.
*
* @ignore
* @function toString
* @param {*} value The value to convert.
* @return {string|null} Returns the string representation of `value`.
*/
function toString(value) {
if (isNil(value)) {
return null;
}
if (isString(value)) {
return value;
}
return String(value);
}
export { toString as t };