Skip to content

Commit 0be35f4

Browse files
committed
prettify
1 parent 4f29993 commit 0be35f4

13 files changed

Lines changed: 213 additions & 195 deletions

File tree

core/jest.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,5 @@ module.exports = {
2727
preset: 'ts-jest',
2828
testEnvironment: 'node',
2929
testPathIgnorePatterns: ['node_modules', 'samples'],
30-
testMatch: [
31-
'**/*.test.ts'
32-
],
30+
testMatch: ['**/*.test.ts'],
3331
};

core/src/TeaCup/Either.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ test('left', () => {
2929
const e: Either<string, number> = left('yeah');
3030
expect(e.isLeft()).toBe(true);
3131
expect(e.isRight()).toBe(false);
32-
expect(e.left.map(s => s + '!').withDefault('')).toBe('yeah!');
32+
expect(e.left.map((s) => s + '!').withDefault('')).toBe('yeah!');
3333
expect(e.right.withDefault(123)).toBe(123);
3434
});
3535

@@ -38,7 +38,7 @@ test('right', () => {
3838
expect(e.isLeft()).toBe(false);
3939
expect(e.isRight()).toBe(true);
4040
expect(e.left.withDefault('!!!')).toBe('!!!');
41-
expect(e.right.map(x => x + 1).withDefault(456)).toBe(124);
41+
expect(e.right.map((x) => x + 1).withDefault(456)).toBe(124);
4242
});
4343

4444
test('mapLeft', () => {

core/src/TeaCup/Either.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
*/
2525

26-
import {just, Maybe, nothing} from "./Maybe";
26+
import { just, Maybe, nothing } from './Maybe';
2727

2828
/**
2929
* Either left, or right.

core/src/TeaCup/Maybe.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,6 @@ test('isNothing', () => {
142142

143143
test('filter', () => {
144144
const m: Maybe<number> = just(123);
145-
expect(m.filter(x => x === 123).isJust()).toBe(true);
146-
expect(m.filter(x => x === 456).isJust()).toBe(false);
147-
})
145+
expect(m.filter((x) => x === 123).isJust()).toBe(true);
146+
expect(m.filter((x) => x === 456).isJust()).toBe(false);
147+
});

core/src/TeaCup/Maybe.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class Just<T> {
7979
return false;
8080
}
8181

82-
filter(f:(t:T) => boolean): Maybe<T> {
82+
filter(f: (t: T) => boolean): Maybe<T> {
8383
if (f(this.value)) {
8484
return this;
8585
}
@@ -145,7 +145,6 @@ export class Nothing<T> {
145145
filter(): Maybe<T> {
146146
return nothing;
147147
}
148-
149148
}
150149

151150
/**

core/src/TeaCup/Port.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
*/
2525

26-
import {Sub} from "./Sub";
26+
import { Sub } from './Sub';
2727

2828
export class Port<T> {
2929
private subs: PortSub<T, any>[] = [];
@@ -34,20 +34,20 @@ export class Port<T> {
3434

3535
subscribe<M>(f: (t: T) => M): Sub<M> {
3636
return new PortSub(
37-
f,
38-
(p) => this.subs.push(p),
39-
(p) => {
40-
this.subs = this.subs.filter((x) => x !== p);
41-
},
37+
f,
38+
(p) => this.subs.push(p),
39+
(p) => {
40+
this.subs = this.subs.filter((x) => x !== p);
41+
},
4242
);
4343
}
4444
}
4545

4646
class PortSub<T, M> extends Sub<M> {
4747
constructor(
48-
private readonly f: (t: T) => M,
49-
private readonly _onInit: (p: PortSub<T, M>) => void,
50-
private readonly _onRelease: (p: PortSub<T, M>) => void,
48+
private readonly f: (t: T) => M,
49+
private readonly _onInit: (p: PortSub<T, M>) => void,
50+
private readonly _onRelease: (p: PortSub<T, M>) => void,
5151
) {
5252
super();
5353
}

core/src/TeaCup/Task.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,12 @@ class TRecover<E, R> extends Task<never, R> {
151151
}
152152

153153
execute(callback: (r: Result<never, R>) => void): void {
154-
this.t.execute((tRes) => tRes.match(
155-
tOk => callback(ok(tOk)),
156-
tErr => callback(ok(this.f(tErr)))
157-
));
154+
this.t.execute((tRes) =>
155+
tRes.match(
156+
(tOk) => callback(ok(tOk)),
157+
(tErr) => callback(ok(this.f(tErr))),
158+
),
159+
);
158160
}
159161
}
160162

core/src/TeaCup/UUID.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
*/
2525

26-
import {Task} from "./Task";
26+
import { Task } from './Task';
2727

2828
/**
2929
* Generate a UUID. Side effect, use uuid() that returns a Task instead

tea-cup/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"compile": "rimraf dist && tsc",
2020
"samples": "tsc --outFile ./dist/Samples/index.js && cp ./src/Samples/index.html ./dist/Samples"
2121
},
22-
"dependencies": {
23-
},
22+
"dependencies": {},
2423
"peerDependencies": {
2524
"react": "^16.7.0",
2625
"tea-cup-core": "^2.0.0"

tea-cup/src/TeaCup/DevTools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export class DevTools<Model, Msg> {
200200
this.resume();
201201
}
202202
this.events = [];
203-
console.log("All events cleared")
203+
console.log('All events cleared');
204204
}
205205

206206
setMaxEvents(maxEvents: number): DevTools<Model, Msg> {

0 commit comments

Comments
 (0)