Skip to content

feat: add array/base/to-inserted-at #6807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 18 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: indexing
Co-authored-by: Athan <[email protected]>
Signed-off-by: Shabareesh Shetty <[email protected]>
  • Loading branch information
ShabiShett07 and kgryte authored Apr 30, 2025
commit 609d9e92702aeda8671d6446340abbcd55d68afb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

// MAIN //

/**

Check failure on line 32 in lib/node_modules/@stdlib/array/base/to-inserted-at/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Displayed return value is ` [ 1, 2, 7, 3, 4 ]`, but expected `[ 1, 2, ..., 7, 4 ]` instead
* Returns a new array containing every element from an input array, with a provided value inserted at a specified index.
*
* @param {Collection} x - input array
Expand All @@ -53,7 +53,7 @@
function toInsertedAt( x, index, value ) {
var out;

index = normalizeIndex( index, x.length-1 );
index = normalizeIndex( index, x.length );
if ( index < 0 ) {
throw new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%d`.', index ) );
}
Expand Down
Loading