UNPKG

@lazy-cjk/str-util-normalize

Version:
29 lines (24 loc) 967 B
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.LazyCjkStrUtilNormalize = {})); })(this, (function (exports) { 'use strict'; const StripTable = [/[\u2000-\u200F]/g, /[\u2028-\u202F]/g, /[\u205F-\u206F]/g, /\uFEFF/g]; function normalize(input, options = {}) { if (!options.allow_nbsp) { input = input.replace(/\xA0/g, ' '); } if (!options.allow_bom) { input = input.replace(/\uFEFF/g, ''); } StripTable.forEach(function (r) { input = input.replace(r, ''); }); return input; } exports.StripTable = StripTable; exports.default = normalize; exports.normalize = normalize; Object.defineProperty(exports, '__esModule', { value: true }); })); //# sourceMappingURL=index.umd.development.cjs.map