Skip to content

Commit

Permalink
Remove unused things
Browse files Browse the repository at this point in the history
  • Loading branch information
paldepind committed Aug 10, 2019
1 parent 5540abf commit 851f207
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 45 deletions.
27 changes: 1 addition & 26 deletions src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Future,
isBehavior,
Now,
observe,
placeholder,
runNow,
sinkBehavior,
Expand Down Expand Up @@ -78,7 +77,6 @@ export abstract class Component<O, A> implements Monad<A> {
this
);
}
// return new OutputComponent(remaps, this);
}
static multi: boolean = false;
multi: boolean = false;
Expand Down Expand Up @@ -124,22 +122,6 @@ export function liftNow<A>(now: Now<A>): Component<{}, A> {
return performComponent(() => runNow(now));
}

class OutputComponent extends Component<any, any> {
constructor(
private remaps: Record<string, string>,
private comp: Component<any, any>
) {
super();
// this.explicitOutput = Object.keys(remaps);
}
run(parent: DomApi, destroyed: Future<boolean>): 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<O, A, P> extends Component<P, A> {
constructor(
private readonly handler: (explicit: O, output: A) => P,
Expand All @@ -154,8 +136,6 @@ class HandleOutput<O, A, P> extends Component<P, A> {
}
}

type AnyValues<A extends Record<string, any>> = { [K in keyof A]: any };

export type Remap<
A extends Record<any, any>,
B extends Record<any, keyof A>
Expand Down Expand Up @@ -194,10 +174,7 @@ class FlatMapComponent<O, A, B> extends Component<O, B> {
parent,
destroyed
);
const { explicit: _discarded, output } = this.f(outputFirst).run(
parent,
destroyed
);
const { output } = this.f(outputFirst).run(parent, destroyed);
return { explicit, output };
}
}
Expand Down Expand Up @@ -446,8 +423,6 @@ export type ComponentExplicitOutput<C> = C extends Component<infer O, any>
*/
export type ComponentOutput<C> = C extends Component<any, infer A> ? A : never;

type Co<O> = Component<O, any>;

export type ChildExplicitOutput<Ch extends Child> = ComponentExplicitOutput<
ToComponent<Ch>
>;
Expand Down
19 changes: 0 additions & 19 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,10 @@ function arrayConcat<A>(arr1: A[], arr2: A[]): A[] {
return result;
}

export function fst<A, B>(a: [A, B]): A {
return a[0];
}

export function snd<A, B>(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<K extends string>(prop: K): any {
return <V, Obj extends Record<K, V>>(obj: Obj): Obj[K] => obj[prop];
}

export function assign<A, B>(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, B>(a: A, b: B): A & B {
const c: { [key: string]: any } = {};
for (const key of Object.keys(a) as (keyof A & string)[]) {
Expand Down

0 comments on commit 851f207

Please sign in to comment.