ihub-framework-js
Version:
Legacy version of iHub Framework written in Javascript
11 lines (7 loc) • 408 B
JavaScript
module.exports.isBlank = str => !str || (typeof str === 'string' && !str.trim());
module.exports.escapeSpecialChars = jsonString => jsonString.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/\t/g, '\\t')
.replace(/\f/g, '\\f');
module.exports.removeWhitespace = string => string.replace(/\s/g, '');
module.exports.removeChars = (str, chars) => str.replace(new RegExp(`[${chars}]`, 'g'), '');