Skip to content

docs: explain step of 0 behavior in range and rangeRight - #6271

Open
ChenfromChina123 wants to merge 1 commit into
lodash:mainfrom
ChenfromChina123:docs/range-step-zero-doc
Open

ChenfromChina123 wants to merge 1 commit into
lodash:mainfrom
ChenfromChina123:docs/range-step-zero-doc

Conversation

@ChenfromChina123

Copy link
Copy Markdown

What does this PR do?

Documents the previously unexplained behavior of _.range and _.rangeRight when step is 0.

Closes #5944

Changes

  • lodash.js: both range and rangeRight JSDoc blocks now note that a step of 0 produces an array of the same length as with a step of 1, with every element equal to start.

Verification

  • node --check lodash.js passes.
  • Runtime: _.range(1, 4, 0)[1, 1, 1], _.rangeRight(1, 4, 0)[1, 1, 1].

Closes lodash#5944

Co-Authored-By: AtomCode (deepseek-v4-flash) <[email protected]>
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.

_.range & _.rangeRight behavior for step=0 not explained in documentation

1 participant