MCPcopy Create free account
hub / github.com/adobe/react-spectrum / replaceIndex

Function replaceIndex

packages/react-stately/src/slider/useSliderState.ts:410–416  ·  view source on GitHub ↗
(array: T[], index: number, value: T)

Source from the content-addressed store, hash-verified

408}
409
410function replaceIndex<T>(array: T[], index: number, value: T) {
411 if (array[index] === value) {
412 return array;
413 }
414
415 return [...array.slice(0, index), value, ...array.slice(index + 1)];
416}
417
418function convertValue(value?: number | number[]) {
419 if (value == null) {

Callers 2

updateValueFunction · 0.85
updateDraggingFunction · 0.85

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected