@spare/lange
Advanced tools
Comparing version 0.7.6 to 0.7.7
@@ -11,3 +11,2 @@ 'use strict'; | ||
const astralReg = new RegExp(astral.join('|'), 'g'); | ||
const chineseReg = new RegExp(chinese.join('|'), 'g'); | ||
@@ -23,6 +22,9 @@ /** | ||
const hasAnsi = tx => ansiReg.test(tx); | ||
const ANSI = new RegExp(ansi.join('|')); | ||
const HAN = new RegExp(chinese.join('|')); | ||
const hasChn = tx => chineseReg.test(tx); | ||
const hasAnsi = tx => ANSI.test(tx); | ||
const hasChn = tx => HAN.test(tx); | ||
exports.Lange = Lange; | ||
@@ -29,0 +31,0 @@ exports.hasAnsi = hasAnsi; |
@@ -7,3 +7,2 @@ const ansi = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))']; | ||
const astralReg = new RegExp(astral.join('|'), 'g'); | ||
const chineseReg = new RegExp(chinese.join('|'), 'g'); | ||
@@ -19,6 +18,9 @@ /** | ||
const hasAnsi = tx => ansiReg.test(tx); | ||
const ANSI = new RegExp(ansi.join('|')); | ||
const HAN = new RegExp(chinese.join('|')); | ||
const hasChn = tx => chineseReg.test(tx); | ||
const hasAnsi = tx => ANSI.test(tx); | ||
const hasChn = tx => HAN.test(tx); | ||
export { Lange, hasAnsi, hasChn, lange }; |
{ | ||
"name": "@spare/lange", | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"description": "Get string length s.t. correcting astral codes and skipping ansi codes", | ||
@@ -33,3 +33,3 @@ "main": "dist/index.cjs.js", | ||
"homepage": "https://github.com/gadge/spare#readme", | ||
"gitHead": "c8ba65c4d8715a4102e55d2eecb5fea2d28f4d37" | ||
"gitHead": "4b139f92cd13620c4f594413deec4b2b08454dd8" | ||
} |
5247
39