mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-22 19:18:31 +00:00
slice array notation
This commit is contained in:
parent
f40b57ee48
commit
fe6d99d4f1
@ -2258,9 +2258,9 @@ export const slice = register(
|
|||||||
opat.outerBind((o) => {
|
opat.outerBind((o) => {
|
||||||
// If it's not an object, assume it's a string and make it a 's' control parameter
|
// If it's not an object, assume it's a string and make it a 's' control parameter
|
||||||
o = o instanceof Object ? o : { s: o };
|
o = o instanceof Object ? o : { s: o };
|
||||||
// Remember we must stay pure and avoid editing the object directly
|
const begin = Array.isArray(n) ? n[i] : i / n;
|
||||||
const toAdd = { begin: i / n, end: (i + 1) / n, _slices: n };
|
const end = Array.isArray(n) ? n[i + 1] : (i + 1) / n;
|
||||||
return pure({ ...toAdd, ...o });
|
return pure({ begin, end, _slices: n, ...o });
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user