
Security News
Potemkin Understanding in LLMs: New Study Reveals Flaws in AI Benchmarks
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
display-width
Advanced tools
A node.js port of [uwcwidth](https://github.com/Z4JC/uwcwidth), a fast function for determining a string's display width
A node.js port of uwcwidth, a fast function for determining a string's display width
That code is a port of POSIX wcswidth, a standard function for counting the number of columns occupied by a string, and is derived from musl libc
import { wcswidth } from "display-width";
// wcswidth("๐ฉโโค๏ธโ๐จ") == 2
console.log(wcswidth("\u{1F469}\u{200D}\u{2764}\u{FE0F}\u{200D}\u{1F468}"));
>> wcswidth("cafeฬ") == 4
>> "cafeฬ".length == 5
>> wcswidth("โ ๏ธ warning") == 9
>> "โ ๏ธ warning".length == 10
>> wcswidth("๐จโ๐จโ๐งโ๐ง") == 2
>> "๐จโ๐จโ๐งโ๐ง".length == 11
>> wcswidth("๐ฉโโค๏ธโ๐จ") == 2
>> "๐ฉโโค๏ธโ๐จ".length == 8
yes! Compared to string-width, it's about 33x faster
โโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโฌโโโโโโโโโโ
โ (index) โ Task Name โ ops/sec โ Average Time (ns) โ Margin โ Samples โ
โโโโโโโโโโโผโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโผโโโโโโโโโโค
โ 0 โ 'display-width' โ '188,426' โ 5307.115321339439 โ 'ยฑ1.55%' โ 18843 โ
โ 1 โ 'string-width' โ '5,586' โ 179008.73345259373 โ 'ยฑ11.73%' โ 559 โ
โโโโโโโโโโโดโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโดโโโโโโโโโโ
see the bench directory for details
no!
no!
no! I ported the code and all the tests from uwcwidth though, so I have good vibes about it
FAQs
A node.js port of [uwcwidth](https://github.com/Z4JC/uwcwidth), a fast function for determining a string's display width
The npm package display-width receives a total of 11 weekly downloads. As such, display-width popularity was classified as not popular.
We found that display-width demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.