diff --git a/array.ts b/array.ts index 2d93041..8b4fb66 100644 --- a/array.ts +++ b/array.ts @@ -938,7 +938,9 @@ export function prepend( * * @since 2.0.0 */ -export function insert(value: A) { +export function insert( + value: A, +): (index: number) => (arr: ReadonlyArray) => ReadonlyArray { return (index: number) => (arr: ReadonlyArray): ReadonlyArray => index < 0 || index > arr.length ? arr : _unsafeInsertAt(index, value, arr); } @@ -965,7 +967,9 @@ export function insert(value: A) { * * @since 2.0.0 */ -export function insertAt(index: number) { +export function insertAt( + index: number, +): (value: A) => (arr: ReadonlyArray) => ReadonlyArray { return (value: A) => (arr: ReadonlyArray): ReadonlyArray => index < 0 || index > arr.length ? arr : _unsafeInsertAt(index, value, arr); } @@ -989,7 +993,9 @@ export function insertAt(index: number) { * * @since 2.0.0 */ -export function update(value: A) { +export function update( + value: A, +): (index: number) => (arr: ReadonlyArray) => ReadonlyArray { return (index: number) => (arr: ReadonlyArray): ReadonlyArray => isOutOfBounds(index, arr) ? arr : _unsafeUpdateAt(index, value, arr); } @@ -1013,8 +1019,10 @@ export function update(value: A) { * * @since 2.0.0 */ -export function updateAt(index: number) { - return (value: A) => (arr: ReadonlyArray): ReadonlyArray => +export function updateAt( + index: number, +): (value: A) => (arr: ReadonlyArray) => ReadonlyArray { + return (value) => (arr) => isOutOfBounds(index, arr) ? arr : _unsafeUpdateAt(index, value, arr); } @@ -1063,7 +1071,9 @@ export function modify(modifyFn: (a: A) => A) { * * @since 2.0.0 */ -export function modifyAt(index: number) { +export function modifyAt( + index: number, +): (modifyFn: (a: A) => A) => (arr: ReadonlyArray) => ReadonlyArray { return (modifyFn: (a: A) => A) => (arr: ReadonlyArray): ReadonlyArray => isOutOfBounds(index, arr) @@ -1092,7 +1102,7 @@ export function modifyAt(index: number) { * * @since 2.0.0 */ -export function lookup(index: number) { +export function lookup(index: number): (arr: ReadonlyArray) => Option { return (as: ReadonlyArray): Option => isOutOfBounds(index, as) ? none : some(as[index]); } @@ -1505,7 +1515,9 @@ export const WrappableArray: Wrappable = { wrap }; /** * @since 2.0.0 */ -export const tap = createTap(FlatmappableArray); +export const tap: ( + fa: (value: A) => void, +) => (ua: ReadonlyArray) => ReadonlyArray = createTap(FlatmappableArray); /** * @since 2.0.0 diff --git a/deno.json b/deno.json new file mode 100644 index 0000000..64f3d5a --- /dev/null +++ b/deno.json @@ -0,0 +1,14 @@ +{ + "name": "@baetheus/fun", + "version": "2.0.0", + "exports": "./mod.ts", + "publish": { + "include": [ + "LICENSE", + "README.md", + "deno.json", + "*.ts", + "contrib/*.ts" + ] + } +} diff --git a/deno.lock b/deno.lock new file mode 100644 index 0000000..086574e --- /dev/null +++ b/deno.lock @@ -0,0 +1,82 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "npm:@most/adapter@1.0.0": "npm:@most/adapter@1.0.0", + "npm:@most/core@1.6.1": "npm:@most/core@1.6.1", + "npm:@most/hold@4.1.0": "npm:@most/hold@4.1.0", + "npm:@most/scheduler@1.3.0": "npm:@most/scheduler@1.3.0", + "npm:@most/types@1.1.0": "npm:@most/types@1.1.0", + "npm:fast-check@3.14.0": "npm:fast-check@3.14.0" + }, + "npm": { + "@most/adapter@1.0.0": { + "integrity": "sha512-+ECkLCTgKqc+uFK7q/fp2elaZahNRS1Tjz0XAu5QOiMynxJt8qN8LR+fuSoRZdhzQ0/+4nWf44X/x2fWUKe8fQ==", + "dependencies": { + "@most/types": "@most/types@1.1.0" + } + }, + "@most/core@1.6.1": { + "integrity": "sha512-H989BS6v9QxSZRGPZlbomXTRpUU60iy76AHJoPveKtj27bE0Pv3mwMENRzNZijJK9ntUwhoJ0SYCoXaMCYuWEQ==", + "dependencies": { + "@most/disposable": "@most/disposable@1.3.0", + "@most/prelude": "@most/prelude@1.8.0", + "@most/scheduler": "@most/scheduler@1.3.0", + "@most/types": "@most/types@1.1.0" + } + }, + "@most/disposable@1.3.0": { + "integrity": "sha512-0lCve1GmWlZrvTGQpMgTFTHH6uRtzM31jyYTIN7303XX4KoLCLWw9L6hfTYLLBtge6s+QyiBQVokAhy2GjNAUQ==", + "dependencies": { + "@most/prelude": "@most/prelude@1.8.0", + "@most/types": "@most/types@1.1.0" + } + }, + "@most/hold@4.1.0": { + "integrity": "sha512-FvmJ84K7Iv6d/5cyPkAcDjLu6XN3QaejYZGeoi55o9pmQ2AZPsutQ1NSaV+8M8sLEA+LT0pFS6Ck+ZTwOSO69Q==", + "dependencies": { + "@most/core": "@most/core@1.6.1", + "@most/scheduler": "@most/scheduler@1.3.0", + "@most/types": "@most/types@1.1.0" + } + }, + "@most/prelude@1.8.0": { + "integrity": "sha512-t1CcURpZzfmBA6fEWwqmCqeNzWAj1w2WqEmCk/2yXMe/p8Ut000wFmVKMy8A1Rl9VVxZEZ5nBHd/pU0dR4bv/w==", + "dependencies": {} + }, + "@most/scheduler@1.3.0": { + "integrity": "sha512-bbJGyhbZxNqlkVjP8+YT9wIVMvYnpzWOzV8jZueqlTH2PJWewH2f54YziZn7/wWa6AJdN03H1vb8Tbi9GcA/cw==", + "dependencies": { + "@most/prelude": "@most/prelude@1.8.0", + "@most/types": "@most/types@1.1.0" + } + }, + "@most/types@1.1.0": { + "integrity": "sha512-v2trqAWu1jqP4Yd/CyI1O6mAeJyygK1uJOrFRpNPkPZIaYw4khA4EQe4WzcyOFKuXdiP8qAqaxGtXXJJ2LZdXg==", + "dependencies": {} + }, + "fast-check@3.14.0": { + "integrity": "sha512-9Z0zqASzDNjXBox/ileV/fd+4P+V/f3o4shM6QawvcdLFh8yjPG4h5BrHUZ8yzY6amKGDTAmRMyb/JZqe+dCgw==", + "dependencies": { + "pure-rand": "pure-rand@6.0.4" + } + }, + "pure-rand@6.0.4": { + "integrity": "sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA==", + "dependencies": {} + } + } + }, + "redirects": { + "https://deno.land/std/testing/asserts.ts": "https://deno.land/std@0.146.0/testing/asserts.ts" + }, + "remote": { + "https://deno.land/std@0.103.0/fmt/colors.ts": "d2f8355f00a74404668fc5a1e4a92983ce1a9b0a6ac1d40efbd681cb8f519586", + "https://deno.land/std@0.103.0/testing/_diff.ts": "5d3693155f561d1a5443ac751ac70aab9f5d67b4819a621d4b96b8a1a1c89620", + "https://deno.land/std@0.103.0/testing/asserts.ts": "b668f7e9f7cc44cf674c7ef00d52bb5fc9b28cdf5e32bc9dad2bf355d3c1b810", + "https://deno.land/std@0.146.0/fmt/colors.ts": "6f9340b7fb8cc25a993a99e5efc56fe81bb5af284ff412129dd06df06f53c0b4", + "https://deno.land/std@0.146.0/testing/_diff.ts": "029a00560b0d534bc0046f1bce4bd36b3b41ada3f2a3178c85686eb2ff5f1413", + "https://deno.land/std@0.146.0/testing/_format.ts": "0d8dc79eab15b67cdc532826213bbe05bccfd276ca473a50a3fc7bbfb7260642", + "https://deno.land/std@0.146.0/testing/asserts.ts": "c17254748504f449c98476b78f4d206ca47cffc826e415026f09d7600c19535e" + } +} diff --git a/flake.lock b/flake.lock index ab13deb..8f77871 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1700108881, - "narHash": "sha256-+Lqybl8kj0+nD/IlAWPPG/RDTa47gff9nbei0u7BntE=", + "lastModified": 1710066242, + "narHash": "sha256-bO7kahLdawW7rBqUTfWgf9mdPYrnOo5DGvWRJa9N8Do=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7414e9ee0b3e9903c24d3379f577a417f0aae5f1", + "rev": "db339f1706f555794b71aa4eb26a5a240fb6a599", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 5b9ba3f..e4c1170 100644 --- a/flake.nix +++ b/flake.nix @@ -22,7 +22,7 @@ }; shell = with pkgs; mkShell { - buildInputs = [ deno nodejs jq lcov jujutsu ]; + buildInputs = [ deno jq lcov ]; }; in diff --git a/scripts/coverage.sh b/scripts/coverage.sh index 404b94a..f551c0d 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -12,6 +12,6 @@ trap exiting SIGINT rm -rf $OUTPUT_DIR deno fmt deno test --doc --parallel --coverage=$OUTPUT_DIR -deno coverage --unstable ./$OUTPUT_DIR --lcov > ./$OUTPUT_DIR/lcov.info +deno coverage ./$OUTPUT_DIR --lcov > ./$OUTPUT_DIR/lcov.info genhtml ./$OUTPUT_DIR/lcov.info --output-directory $OUTPUT_DIR darkhttpd ./$OUTPUT_DIR