</>PackageGraphPackageGraph

string-length

npmv7.0.1TypeScript

Get the real length of a string - by correctly counting astral symbols and ignoring ansi escape codes

Safe to adopt

Yes — string-length scores well across adoption, maintenance, weight, supply chain, and licensing. No download data reported for this package yet. Last published 231 days ago. 2 releases in the last 2 years.

  • ?Adoption: grade ?, Not reported by this registry.

    No download data reported for this package yet.

  • BMaintenance: grade B, Good.

    Last published 231 days ago. 2 releases in the last 2 years.

  • AWeight: grade A, Excellent.

    Zero runtime dependencies, about 4.3 KB installed.

  • BSupply chain: grade B, Good.

    This package has a single maintainer (bus factor of 1).

  • ALicense: grade A, Excellent.

    MIT — permissive, with no copyleft found in the dependency tree.

Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.

Install cost

What you actually take on by adding string-length to a project.

0
Direct dependencies

Runtime packages this one declares itself.

0
Total installed

Distinct packages in the full runtime tree, deduplicated the way a package manager would.

4.3 KB
Install size

Unpacked size of this package plus its entire runtime tree.

Tree depth

Longest resolved dependency chain below this package.

Compatibility

Node.js
node >=20
Module format
ESM only
TypeScript
Types included
Install scripts
None

Quick start

A usage example from the string-length README.

import stringLength from 'string-length';

'🐴'.length;
//=> 2

stringLength('🐴');
//=> 1

stringLength('\u001B[1municorn\u001B[22m');
//=> 7

string-length vs the alternatives

Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.

PackageWeekly downloadsDependentsLicenseLast release
string-lengththis page03MIT7 months ago
string-width03MIT1 day ago
escape-string-regexp316.5M8MIT1 day ago
get-east-asian-width69.3M1MIT1 day ago
css.escape48.7M2MIT1 day ago
terminal-link18.8M1MIT1 day ago

Dependencies

Declared by string-length v7.0.1. Runtime dependencies are installed with the package; dev dependencies are not.

Dev (2)

ava ^6.4.1xo ^1.2.3

Used by

Popular packages that depend on string-length.

Relationship graph

Dependencies (left) and dependents (right) of string-length.

@jest/reportersjest-watchercli-spinnersstring-length
string-length dependencies dependents

Frequently installed together

Release history

2 releases in the last two years, typically about 104 days apart.

Recent versions of string-length
VersionPublishedSizeLicense
7.0.1latest7 months ago4.3 KBMIT
7.0.07 months ago4.2 KBMIT
6.0.03 years ago4.2 KBMIT
5.0.15 years ago4.5 KBMIT
5.0.05 years ago4.5 KBMIT
4.0.25 years ago4.0 KBMIT
4.0.16 years ago4.0 KBMIT
4.0.06 years ago4.0 KBMIT
3.1.07 years ago3.8 KBMIT
3.0.07 years ago3.5 KBMIT
2.0.09 years agoMIT
1.0.111 years agoMIT
1.0.012 years agoMIT
0.1.212 years agoMIT
0.1.112 years agoMIT

Overview

string-length is an npm package that get the real length of a string - by correctly counting astral symbols and ignoring ansi escape codes. It has 3 known dependents in the graph. The latest version is 7.0.1, released under the MIT license.

Who should use it

Teams working in the npm ecosystem who need get the real length of a string - by correctly counting astral symbols and ignoring ansi escape codes and value a focused solution.

When not to use it

Consider an alternative if you need to or if a more actively-maintained option better fits your npm stack.

Pros

  • Ships TypeScript type definitions.
  • Clear open-source license (MIT).
  • Lean dependency tree (2 direct dependencies).

Cons

  • No significant drawbacks detected from available metadata.

Auto-generated from collected registry metadata. No external claims are inferred.

Maintainers

Keywords

Funding

Frequently asked questions

Should I use string-length?

Yes — string-length scores well across adoption, maintenance, weight, supply chain, and licensing. No download data reported for this package yet. Last published 231 days ago. 2 releases in the last 2 years.

How do I install string-length?

Run `npm install string-length` to add string-length to your npm project.

What license is string-length released under?

string-length is distributed under the MIT license.

How popular is string-length?

npm does not publish download counts. Within PackageGraph's crawl, 3 known packages depend on string-length.

Is string-length still maintained?

The most recent release of string-length (v7.0.1) was published 7 months ago.

Does string-length run install scripts?

No. string-length does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.