A readability score is a small number with a large claim behind it: this text is harder than that one. If two systems compute it differently, the claim becomes noise, and the first argument in a review is about which tool is right. Readability in node became a porting problem before it became a feature problem.
Code: ReadSightJS, MIT licensed.
The PHP library came first. The Node package is a byte-accurate port, and three decisions made it one.
Decision 1: parity is measured, not promised
The test suite carries golden vectors generated from the PHP implementation: supported formula lists, analyze metrics, every applicable formula with its inputs, and per-word syllable vectors for all 86 languages at a tolerance of 1e-9.
Without those vectors a port drifts quietly. Someone rounds a coefficient, someone else orders operations differently, and two dashboards disagree by a tenth of a point for a year before anyone notices.
Decision 2: data travels with the code
The package bundles language JSON, coefficients and .tex hyphenation patterns. Nothing is fetched at runtime, and compiled patterns go to the OS cache directory.
That choice costs package size and buys predictability. A score computed on a laptop, in CI and in a container comes from the same data, and a missing file is a build error rather than a wrong number in production.
Decision 3: no runtime dependencies
TeX patterns, Unicode handling and numbers are all in the package, so npm install adds one module rather than a graph. ESM and CommonJS ship together with type definitions.
The smaller win is audit time on a dependency update. The larger one is that a scoring function inside a build pipeline cannot break because a transitive package changed its mind about regular expressions.
The syllable problem, honestly stated
TeX hyphenation answers “where may this word break”, and readability asks “how many syllables does it have”. For most Latin-script languages the answers are close enough; for Slavic Cyrillic they are not.
So en-us and en-gb use a composite counter, ru, uk, be and bg use a vowel heuristic with vowelMode: "individual", and 80 other languages use the TeX count. splitWord() always returns exact hyphenation points, and splitSyllables() may return an approximation.
Writing that in the readme is the difference between a tool and a trap. A score that is approximate in a known place can be trusted elsewhere; a score that pretends to be exact everywhere cannot.
What a port teaches
Parity is a feature. It lets two runtimes answer the same question, which is the whole reason to have ports at all.
It also forces the canonical implementation to state its own behaviour: rounding, edge cases, empty input, what happens with text that has no letters. A port is the most demanding form of code review a library will ever receive.
The second port is easier and more dangerous. The Rust and Python versions share the same golden vectors, so a mistake in one shows up as a failure in the others, and the temptation to “fix” a coefficient to make one suite green costs a day of debugging across three languages.
Where the number lands
A draft hook, a build step, a monthly report over a section of a site. In each case the value comes from comparing texts, and comparison only works when the arithmetic does not move between environments.
The package is MIT, installs with one command and works offline after install.
Related: readability library for the PHP original and its formulas, and file upload form for another case where the platform’s own behaviour was kept instead of rebuilt.