diff --git a/colors.mjs b/colors.mjs index 2ebc29f..401843c 100644 --- a/colors.mjs +++ b/colors.mjs @@ -16,7 +16,7 @@ function init(x, y) { return function (txt) { if (!$.enabled || txt == null) return txt; - return open + ((''+txt).includes(close) ? txt.replace(rgx, close + open) : txt) + close; + return open + (!!~(''+txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close; }; } diff --git a/index.mjs b/index.mjs index 6343543..32e7fa1 100644 --- a/index.mjs +++ b/index.mjs @@ -50,7 +50,7 @@ function run(arr, str) { tmp = arr[i]; beg += tmp.open; end += tmp.close; - if (str.includes(tmp.close)) { + if (!!~str.indexOf(tmp.close)) { str = str.replace(tmp.rgx, tmp.close + tmp.open); } } @@ -100,7 +100,7 @@ function init(open, close) { }; return function (txt) { if (this !== void 0 && this.has !== void 0) { - this.has.includes(open) || (this.has.push(open),this.keys.push(blk)); + !!~this.has.indexOf(open) || (this.has.push(open),this.keys.push(blk)); return txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+''; } return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+'';