function clean(toClean, source){
if (typeof(toClean) !== 'string') return true;
if (typeof(source) !== 'string') return true;
return source.replace(toClean, String('CLEANED')).toString();
}
Found this in a project at work and someone clearly doesn't trust JavaScripts typeof function