repo.or.cz
/
ProtonMail-WebClient.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git]
/
packages
/
utils
/
updateItem.ts
blob
45f2f308dfcda3597c1fd61102580f5af595f049
1
/**
2
* Updates an item in an array.
3
*/
4
export default function updateItem<T>(array: T[], index: number, newItem: T) {
5
return array.map((item, i) => {
6
if (i !== index) {
7
return item;
8
}
9
return newItem;
10
});
11
}