Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
Format and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yamiteru committed Apr 1, 2023
1 parent 5fce6e0 commit 1dbf393
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 30 deletions.
10 changes: 5 additions & 5 deletions benchmarks/and.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {err, ok} from "elfs";
import { err, ok } from "elfs";
import { suite, useTerminal } from "isitfast";
import {error} from "../src";
import {and} from "../src/sync";
import { error } from "../src";
import { and } from "../src/sync";

const pipuAnd = and(
(v: number) => v > 0.2 ? ok(v * 2) : err(error("TEST1")(v)),
(v: number) => v < 0.8 ? ok(v * 2) : err(error("TEST2")(v)),
(v: number) => (v > 0.2 ? ok(v * 2) : err(error("TEST1")(v))),
(v: number) => (v < 0.8 ? ok(v * 2) : err(error("TEST2")(v))),
);

const test = suite("and", {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/filter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { suite, useTerminal } from "isitfast";
import {filter} from "../src/sync";
import { filter } from "../src/sync";

const pipuFilter = filter((v: number) => !(v % 2));

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/map.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { suite, useTerminal } from "isitfast";
import {map} from "../src/sync";
import { map } from "../src/sync";

const pipuMap = map((v: number) => v * 2);

Expand Down
10 changes: 5 additions & 5 deletions benchmarks/or.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {err, ok} from "elfs";
import { err, ok } from "elfs";
import { suite, useTerminal } from "isitfast";
import {error} from "../src";
import {or} from "../src/sync";
import { error } from "../src";
import { or } from "../src/sync";

const pipuOr = or(
(v: number) => v > 0.2 ? ok(v * 2) : err(error("TEST1")(v)),
(v: number) => v < 0.8 ? ok(v * 2) : err(error("TEST2")(v)),
(v: number) => (v > 0.2 ? ok(v * 2) : err(error("TEST1")(v))),
(v: number) => (v < 0.8 ? ok(v * 2) : err(error("TEST2")(v))),
);

const test = suite("or", {
Expand Down
6 changes: 4 additions & 2 deletions benchmarks/resolve.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { suite, useTerminal } from "isitfast";
import {resolve} from "../src/async";
import { resolve } from "../src/async";

const pipuResolve = resolve((v: number) => new Promise<number>((resolve) => resolve(v)));
const pipuResolve = resolve(
(v: number) => new Promise<number>((resolve) => resolve(v)),
);

const test = suite("resolve", {
pipu_resolve: async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/1-map.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {and, map} from "../src/sync";
import { and, map } from "../src/sync";

export const doubleToString = and(
map((v: number) => v * 2),
Expand Down
2 changes: 1 addition & 1 deletion examples/2-filter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {and, filter} from "../src/sync";
import { and, filter } from "../src/sync";

export const ageFilter = and(
filter((v: number) => v >= 1),
Expand Down
2 changes: 1 addition & 1 deletion examples/3-or.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {filter, or} from "../src/sync";
import { filter, or } from "../src/sync";

export const tenOrTwenty = or(
filter((v: number) => v === 10),
Expand Down
6 changes: 3 additions & 3 deletions examples/4-wrap.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {error} from "../src";
import {filter, wrap} from "../src/sync";
import { error } from "../src";
import { filter, wrap } from "../src/sync";

export const adultFilter = wrap(
filter((age: number) => age >= 18),
error("AGE_IS_NOT_ADULT")
error("AGE_IS_NOT_ADULT"),
);
2 changes: 1 addition & 1 deletion examples/5-parse.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {map, parse} from "../src/sync";
import { map, parse } from "../src/sync";

export const double = map((v: number) => v * 2);

Expand Down
19 changes: 11 additions & 8 deletions examples/6-resolve.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import {and, resolve} from "../src/async";
import { and, resolve } from "../src/async";

export const getUser = and(
resolve((email: string) => new Promise((resolve) => {
resolve({
email,
name: "John Doe",
age: 18,
});
})),
resolve(
(email: string) =>
new Promise((resolve) => {
resolve({
email,
name: "John Doe",
age: 18,
});
}),
),
);
2 changes: 1 addition & 1 deletion src/sync/map.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Result, ok, err } from "elfs";
import { Error, PipeableSync } from "../types";
import {error} from "../utils";
import { error } from "../utils";

/**
* Sync pipeable which maps value from `$Input` to `Ok<$Output>`.
Expand Down

0 comments on commit 1dbf393

Please sign in to comment.