UNPKG

@aurigma/design-atoms

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

28 lines 1.25 kB
var StringUtils = /** @class */ (function () { function StringUtils() { } StringUtils.insert = function (str, index, value) { if (str == null) throw new Error("input string must not be null"); if (index < 0) throw new Error("index must be positive number"); if (index > str.length) throw new console.error("index must not be greater than string length"); return str.substring(0, index) + value + str.substring(index); }; StringUtils.containsRtlChars = function (str) { var rtlDirCheck = new RegExp('^[^' + this._rtlChars + ']*?[' + this._rtlChars + ']'); return rtlDirCheck.test(str); }; StringUtils.removeRtlChars = function (str) { var rtlChars = new RegExp("[" + this._rtlChars + "]", "g"); return str === null || str === void 0 ? void 0 : str.replace(rtlChars, ""); }; StringUtils.toSingleLine = function (str) { return str === null || str === void 0 ? void 0 : str.replace(/[\r\n]/g, " "); }; StringUtils._rtlChars = '\u0591-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC'; return StringUtils; }()); export { StringUtils }; //# sourceMappingURL=StringUtils.js.map