Skip to content

Commit

Permalink
Merge pull request #506 from Brendonovich/list-immutable
Browse files Browse the repository at this point in the history
List immutable
  • Loading branch information
jdudetv authored Aug 26, 2024
2 parents e503433 + 5b071a4 commit b391bc8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/packages/src/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,16 @@ export function pkg() {
id: "value",
type: t.wildcard(w),
}),
outList: io.dataOutput({
id: "outList",
type: t.list(t.wildcard(w)),
}),
};
},
run({ ctx, io }) {
ctx
.getInput(io.list)
.splice(ctx.getInput(io.index), 1, ctx.getInput(io.value));
const list = [...ctx.getInput(io.list)];
list.splice(ctx.getInput(io.index), 1, ctx.getInput(io.value));
ctx.setOutput(io.outList, list);
},
});

Expand Down

0 comments on commit b391bc8

Please sign in to comment.