UNPKG

fastest-validator

Version:

The fastest JS validator library for NodeJS

9 lines (7 loc) 285 B
function convertible(value) { if (value === undefined) return ""; if (value === null) return ""; if (typeof value.toString === "function") return value; return typeof value; } module.exports = (string, searchValue, newValue) => string.replace(searchValue, convertible(newValue));