Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export class FunctionalUtil{
- static removeItem<T>(arr: T[], index: number): T[]{
- return [
- ...arr.slice(0, index),
- ...arr.slice(index + 1)
- ];
- }
- static replaceItem<T>(arr: T[], item: T, index: number): T[]{
- return[
- ...arr.slice(0, index),
- item,
- ...arr.slice(index +1)
- ];
- }
- static addItem<T>(arr: T[], item: T): T[]{
- return [...arr, item];
- }
- }
Add Comment
Please, Sign In to add comment