Skip to content

Commit

Permalink
no-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
uriva committed Jan 3, 2025
1 parent 5fbbe20 commit 4f9ada0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
1 change: 0 additions & 1 deletion build_npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ await build({
outDir,
shims: { deno: true },
package: {
dependencies: { "@types/sjcl": "1.0.34" },
name: "gamla",
version: Deno.args[0],
description: "Functional programming with async and type safety",
Expand Down
4 changes: 1 addition & 3 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
"tasks": {
"build": "deno run --allow-env --allow-read --allow-write --allow-net --allow-run build_npm.ts"
},
"imports": {
"std-assert": "https://deno.land/std@0.213.0/assert/mod.ts"
}
"imports": { "std-assert": "https://deno.land/std@0.213.0/assert/mod.ts" }
}
14 changes: 13 additions & 1 deletion deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions src/io.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import sjcl from "npm:sjcl";
import { sha256 } from "npm:js-sha256";
import stableHash from "npm:stable-hash";
import { pipe } from "./composition.ts";
import { juxt, pairRight, stack } from "./juxt.ts";
Expand Down Expand Up @@ -169,8 +169,6 @@ export const retry = <F extends AsyncFunction>(
f: F,
) => conditionalRetry(() => true)(waitMs, times, f);

const sha256 = (x: string) => sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(x));

export const hash = <T>(x: T, maxLength: number) =>
// @ts-ignore-error error in deno but not in node
sha256(stableHash(x)).substring(0, maxLength);
sha256.hex(stableHash(x)).substring(0, maxLength);

0 comments on commit 4f9ada0

Please sign in to comment.