Urgent.News

What's breaking now, across hundreds of outlets.

Culture

Your JS README says "// Foo-Ba-Rb". The code says Foo-BA-Rb.

JavaScript READMEs have a convention Python doesn't: show a call, then put the expected result in a comment on the next line. camelCase ( "foo-bar_baz" ) ; // fooBarBaz It reads nicely. It's also an untested claim, sitting right where every new user copies from. In a previous post I ran every >>> example in a Python library's README as a doctest. This time I wanted the same check for the JS…

The JavaScript README for scule, a tidy string-case utility from the UnJS ecosystem, contains a discrepancy between its code and comment. The convention suggests placing a call to a function, followed by the expected result in a comment on the next line. For instance, camelCase("foo-bar_baz") is expected to return "fooBarBaz", but the actual output in the README shows "FooBarBaz".

However, there is an inconsistency where trainCase("FooBARb") is expected to return "Foo-Ba-Rb", but the code outputs "Foo-BA-Rb". This discrepancy, along with notes in the README, highlights how documentation can become outdated. The author suggests running automated tests for these examples in Continuous Integration (CI) to catch such issues early.

Nevertheless, notes about setup instructions or prose claims cannot be verified automatically and require human or manual checks.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Culture

More from Saturday, 28 November 2026 →