Skip to content

Commit

Permalink
chore(core,eslint-plugin): ditch tabs (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
adjsky authored Oct 31, 2024
1 parent daefb18 commit a198168
Show file tree
Hide file tree
Showing 18 changed files with 1,566 additions and 1,574 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/bump-workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,3 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_USER_NAME: adjsky
GIT_USER_EMAIL: igorlfmartins@mail.ru

- run: deno fmt
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: format changes
10 changes: 5 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"deno.enable": true,
"editor.defaultFormatter": "denoland.vscode-deno",
"[ignore]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
}
"deno.enable": true,
"editor.defaultFormatter": "denoland.vscode-deno",
"[ignore]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
}
}
48 changes: 24 additions & 24 deletions core/build_npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ import denoJson from "./deno.json" with { type: "json" };
await emptyDir("./npm");

await build({
entryPoints: ["./mod.ts"],
outDir: "./npm",
shims: {},
test: false,
package: {
name: "resulto",
version: denoJson.version,
description:
"TypeScript implementation of the Result type from Rust with async support",
author: "adjsky",
repository: {
"type": "git",
"url": "git+https://github.com/adjsky/resulto.git",
},
keywords: [
"result",
"rust",
],
license: "MIT",
},
postBuild() {
Deno.copyFileSync("../LICENSE", "npm/LICENSE");
Deno.copyFileSync("README.md", "npm/README.md");
},
entryPoints: ["./mod.ts"],
outDir: "./npm",
shims: {},
test: false,
package: {
name: "resulto",
version: denoJson.version,
description:
"TypeScript implementation of the Result type from Rust with async support",
author: "adjsky",
repository: {
"type": "git",
"url": "git+https://github.com/adjsky/resulto.git",
},
keywords: [
"result",
"rust",
],
license: "MIT",
},
postBuild() {
Deno.copyFileSync("../LICENSE", "npm/LICENSE");
Deno.copyFileSync("README.md", "npm/README.md");
},
});
56 changes: 28 additions & 28 deletions core/chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,38 @@
* @returns {*}
*/
export function chain(chainHead) {
let currentPromise = Promise.resolve(chainHead);
let currentThis;
let currentPromise = Promise.resolve(chainHead);
let currentThis;

const proxy = new Proxy(function () {}, {
get(_, property) {
switch (property) {
case "then":
case "catch":
case "finally":
return (...args) => currentPromise[property](...args);
default:
currentPromise = currentPromise.then((resolvedObject) => {
currentThis = resolvedObject;
const proxy = new Proxy(function () {}, {
get(_, property) {
switch (property) {
case "then":
case "catch":
case "finally":
return (...args) => currentPromise[property](...args);
default:
currentPromise = currentPromise.then((resolvedObject) => {
currentThis = resolvedObject;

return resolvedObject?.[property];
});
return resolvedObject?.[property];
});

return proxy;
}
},
apply(_, __, args) {
currentPromise = currentPromise.then((resolvedFunction) => {
if (typeof resolvedFunction != "function") {
throw new Error(`Trying to call ${resolvedFunction}`);
}
return proxy;
}
},
apply(_, __, args) {
currentPromise = currentPromise.then((resolvedFunction) => {
if (typeof resolvedFunction != "function") {
throw new Error(`Trying to call ${resolvedFunction}`);
}

return Reflect.apply(resolvedFunction, currentThis, args);
});
return Reflect.apply(resolvedFunction, currentThis, args);
});

return proxy;
},
});
return proxy;
},
});

return proxy;
return proxy;
}
10 changes: 5 additions & 5 deletions core/deno.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@resulto/core",
"version": "1.4.0",
"exports": {
".": "./mod.ts"
}
"name": "@resulto/core",
"version": "1.4.0",
"exports": {
".": "./mod.ts"
}
}
42 changes: 21 additions & 21 deletions core/mod.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
export {
type AsyncResult,
combine,
combineAsync,
Err,
err,
errAsync,
type ErrFn,
type ErrPredicate,
type Fn,
fromPromise,
fromSafePromise,
fromThrowable,
Ok,
ok,
okAsync,
type Predicate,
type Result,
type ResultDeclarations,
ResultError,
type UnwrapErrs,
type UnwrapOks,
type AsyncResult,
combine,
combineAsync,
Err,
err,
errAsync,
type ErrFn,
type ErrPredicate,
type Fn,
fromPromise,
fromSafePromise,
fromThrowable,
Ok,
ok,
okAsync,
type Predicate,
type Result,
type ResultDeclarations,
ResultError,
type UnwrapErrs,
type UnwrapOks,
} from "./result.ts";
Loading

0 comments on commit a198168

Please sign in to comment.