@n3okill/utils
Version:
Many javascript helpers
19 lines • 570 B
JavaScript
import { isNullOrUndefined } from "../type/isNullOrUndefined";
import { isString } from "../type/isString";
import { isSymbol } from "../type/isSymbol";
/**
* Transforms argument into string
* @param arg
*/
export function toString(arg) {
return isString(arg)
? arg
: isNullOrUndefined(arg)
? ""
: isSymbol(arg)
? Symbol.prototype.toString.call(arg)
: arg + "" === "0" && 1 / arg === -Infinity
? "-0"
: arg + "";
}
//# sourceMappingURL=toString.js.map