string-length is a small, fast, and dependency-free npm package for accurately determining the length of a string. It handles Unicode characters, including combining diacritical marks and surrogate pairs, correctly. Unlike the native String.prototype.length property, it ensures that characters are counted as a single unit, providing a more accurate representation of user-perceived length, essential for text formatting, validation, and display in diverse languages and encodings.
The string-length npm package has had infrequent releases. Initial releases occurred in 2014-2015. There were releases of major versions in July 2017, March and April 2019, February and March 2020, March, June and September 2021, and June 2023. The package has not had any releases since June 2023.
String-length's npm downloads show a general upward trend from March 2024 to August 2025, peaking in June and July 2025 exceeding 180 million downloads. The current month, September 2025, is only partially complete and displays a significantly lower download count of around 40 million.