You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As @kuserichmentioned in PR #41, we should consider adjusting the current implementation of the insertAtIndex, rename it or rename and add insertAtIndex.
To me, "insertAtIndex" implies that we are adding an element to an array while keeping all original items.
Thus, I would be in favour of renaming this function to replaceAtIndex or update its logic.
insertAtIndex( [ 'a', 'd', 'c' ], 'b', 1 );
// => Array [ 'a', 'b', 'd', 'c' ]
or
replaceAtIndex( [ 'a', 'd', 'c' ], 'b', 1 );
// => Array [ 'a', 'b', 'c' ]
or, since i assume we are using it already, rename and add insertAtIndex. what do you think @mahdiyazdani@gooklani ?
The text was updated successfully, but these errors were encountered:
I agree with @kuserich that naming could be improved by renaming this method to replaceAtIndex or something similar. However, this method has been used across multiple blocks/extensions which would require manual inspection and update if decided to go forward with this.
On the other hand, I would be in favor of introducing another method that does the job of inserting an element into an array at a given index.
The idea behind the existing method initially being inspired by this issue.
As @kuserich mentioned in PR #41, we should consider adjusting the current implementation of the
insertAtIndex
, rename it or rename and addinsertAtIndex
.The text was updated successfully, but these errors were encountered: