@spare/lange
Advanced tools
Comparing version 0.0.6 to 0.1.0
@@ -20,2 +20,3 @@ 'use strict'; | ||
const lange = tx => tx.replace(ansiReg, '').replace(astralReg, '_').length; | ||
const Lange = ansi => ansi ? lange : x => x.length; | ||
@@ -26,4 +27,5 @@ const hasAnsi = tx => ansiReg.test(tx); | ||
exports.Lange = Lange; | ||
exports.hasAnsi = hasAnsi; | ||
exports.hasChn = hasChn; | ||
exports.lange = lange; |
@@ -16,2 +16,3 @@ const ansi = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))']; | ||
const lange = tx => tx.replace(ansiReg, '').replace(astralReg, '_').length; | ||
const Lange = ansi => ansi ? lange : x => x.length; | ||
@@ -22,2 +23,2 @@ const hasAnsi = tx => ansiReg.test(tx); | ||
export { hasAnsi, hasChn, lange }; | ||
export { Lange, hasAnsi, hasChn, lange }; |
{ | ||
"name": "@spare/lange", | ||
"version": "0.0.6", | ||
"version": "0.1.0", | ||
"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/hoyeungw/spare#readme", | ||
"gitHead": "026b65cd7566cd2bda3e7eaa0bcb03c97671bebf" | ||
"gitHead": "905ae80c07c6d8bc1f4524bc20e88d50187e5c3e" | ||
} |
5216
37