Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@spare/enum-chars

gadge264MIT0.16.16

Chars

test, console, debug, print

readme

@spare/enum-chars

A function returning string length, s.t. skipping ansi (escape) codes, correcting length of astral symbols.

npm version npm quality npm download npm total-download size github commit activity npm license

Features

  • ES2015 syntax

Install

$ npm install @spare/enum-chars

Usage

import { lange } from '@texting/enum-chars'
const cast = [
  'tolstoy',
  '\u001b[3;4;31mhatsu\u001b[0m',
  '\u{1F3C3}2\u{1F525}7',
]
for (let t of cast) {
  console.log(`[${t}] [length] (${t.length}) [lange] (${lange(t)})`)
}

Meta

LICENSE (MIT)

Copyright (c) 2019-present, Haoyang (Vincent) Wang