From 851f2075e082259e3776c158e520920b68d3b765 Mon Sep 17 00:00:00 2001 From: Simon Friis Vindum Date: Sat, 10 Aug 2019 13:28:39 +0200 Subject: [PATCH] Remove unused things --- src/component.ts | 27 +-------------------------- src/utils.ts | 19 ------------------- 2 files changed, 1 insertion(+), 45 deletions(-) diff --git a/src/component.ts b/src/component.ts index 808fd42..e7f479d 100644 --- a/src/component.ts +++ b/src/component.ts @@ -3,7 +3,6 @@ import { Future, isBehavior, Now, - observe, placeholder, runNow, sinkBehavior, @@ -78,7 +77,6 @@ export abstract class Component implements Monad { this ); } - // return new OutputComponent(remaps, this); } static multi: boolean = false; multi: boolean = false; @@ -124,22 +122,6 @@ export function liftNow(now: Now): Component<{}, A> { return performComponent(() => runNow(now)); } -class OutputComponent extends Component { - constructor( - private remaps: Record, - private comp: Component - ) { - super(); - // this.explicitOutput = Object.keys(remaps); - } - run(parent: DomApi, destroyed: Future): any { - const { explicit, output } = this.comp.run(parent, destroyed); - const newExplicit = copyRemaps(this.remaps, output); - const finalExplicit = mergeObj(output, newExplicit); - return { explicit: newExplicit, output }; - } -} - class HandleOutput extends Component { constructor( private readonly handler: (explicit: O, output: A) => P, @@ -154,8 +136,6 @@ class HandleOutput extends Component { } } -type AnyValues> = { [K in keyof A]: any }; - export type Remap< A extends Record, B extends Record @@ -194,10 +174,7 @@ class FlatMapComponent extends Component { parent, destroyed ); - const { explicit: _discarded, output } = this.f(outputFirst).run( - parent, - destroyed - ); + const { output } = this.f(outputFirst).run(parent, destroyed); return { explicit, output }; } } @@ -446,8 +423,6 @@ export type ComponentExplicitOutput = C extends Component */ export type ComponentOutput = C extends Component ? A : never; -type Co = Component; - export type ChildExplicitOutput = ComponentExplicitOutput< ToComponent >; diff --git a/src/utils.ts b/src/utils.ts index 5ff2449..7685ba9 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -11,29 +11,10 @@ function arrayConcat(arr1: A[], arr2: A[]): A[] { return result; } -export function fst(a: [A, B]): A { - return a[0]; -} - -export function snd(a: [A, B]): B { - return a[1]; -} - function isObject(item: any): item is Object { return typeof item === "object" && !Array.isArray(item) && !isBehavior(item); } -export function get(prop: K): any { - return >(obj: Obj): Obj[K] => obj[prop]; -} - -export function assign(a: A, b: B): A & B { - for (const key of Object.keys(b) as (keyof B)[]) { - (a as any)[key] = b[key]; - } - return a as any; -} - export function mergeObj(a: A, b: B): A & B { const c: { [key: string]: any } = {}; for (const key of Object.keys(a) as (keyof A & string)[]) {