Skip to content

Commit

Permalink
update lensIndex doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Harris-Miller committed Jul 11, 2024
1 parent 30beb4b commit 12c83a0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source/lensIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import update from './update.js';
/**
* Returns a lens whose focus is the specified index.
*
* When `idx < 0 || idx >= list.length`, `R.set` or `R.over`, the original list is returned.
*
* @func
* @memberOf R
* @since v0.14.0
Expand All @@ -23,6 +25,10 @@ import update from './update.js';
* R.view(headLens, ['a', 'b', 'c']); //=> 'a'
* R.set(headLens, 'x', ['a', 'b', 'c']); //=> ['x', 'b', 'c']
* R.over(headLens, R.toUpper, ['a', 'b', 'c']); //=> ['A', 'b', 'c']
*
* // out-of-range returns original list
* R.set(R.lensIndex(3), 'x', ['a', 'b', 'c']); //=> ['a', 'b', 'c']
* R.over(R.lensIndex(-1), R.toUpper, ['a', 'b', 'c']); //=> ['a', 'b', 'c']
*/
var lensIndex = _curry1(function lensIndex(n) {
return lens(
Expand Down

0 comments on commit 12c83a0

Please sign in to comment.