Skip to content

docs: fix once.strict example using undefined variable#19

Open
abhu85 wants to merge 1 commit into
isaacs:mainfrom
abhu85:fix/16-docs-once-strict
Open

docs: fix once.strict example using undefined variable#19
abhu85 wants to merge 1 commit into
isaacs:mainfrom
abhu85:fix/16-docs-once-strict

Conversation

@abhu85
Copy link
Copy Markdown

@abhu85 abhu85 commented Mar 13, 2026

Summary

  • Fix documentation example for once.strict(func) that referenced undefined variable msg
  • Should use log (the callback function defined in the example)

Problem

The example code in the README for once.strict():

greet(null, once(msg))
greet(null, once.strict(msg))

References msg which is not defined in the scope. Users copying this example get ReferenceError: msg is not defined.

Solution

Changed msg to log to correctly reference the callback function defined earlier in the example:

greet(null, once(log))
greet(null, once.strict(log))

Fixes #16

🤖 Generated with Claude Code

The documentation example for `once.strict(func)` incorrectly used `msg`
instead of `log` as the callback function argument. This caused a
ReferenceError when users tried to run the example code.

Fixes isaacs#16

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

once.strict(func) documentation incorrect

1 participant