Mirror: 🎩 A tiny but capable push & pull stream library for TypeScript and Flow
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: Update data structure (#155)

authored by

Phil Pluckthun and committed by
GitHub
26e15cfe 2f1c284a

+13 -6
+5
.changeset/orange-melons-tease.md
··· 1 + --- 2 + 'wonka': patch 3 + --- 4 + 5 + Convert `Push<T>` and `Start<T>` signals to `{ tag, 0: value }` objects, which are sufficiently backwards compatible and result in slightly faster execution in v8.
+8 -6
src/helpers.ts
··· 24 24 * @internal 25 25 */ 26 26 export function start<T>(talkback: TalkbackFn): Start<T> { 27 - const box: any = [talkback]; 28 - box.tag = SignalKind.Start; 29 - return box; 27 + return { 28 + tag: SignalKind.Start, 29 + 0: talkback, 30 + } as Start<T>; 30 31 } 31 32 32 33 /** Wraps the passed value in a {@link Push | Push signal}. 33 34 * @internal 34 35 */ 35 36 export function push<T>(value: T): Push<T> { 36 - const box: any = [value]; 37 - box.tag = SignalKind.Push; 38 - return box; 37 + return { 38 + tag: SignalKind.Push, 39 + 0: value, 40 + } as Push<T>; 39 41 }