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..bb8ef7b --- /dev/null +++ b/deno.json @@ -0,0 +1,64 @@ +{ + "name": "@baetheus/fun", + "version": "2.0.1", + "exports": { + "applicable": "./applicable.ts", + "array": "./array.ts", + "async": "./async.ts", + "async_either": "./async_either.ts", + "async_iterable": "./async_iterable.ts", + "bimappable": "./bimappable.ts", + "boolean": "./boolean.ts", + "combinable": "./combinable.ts", + "comparable": "./comparable.ts", + "composable": "./composable.ts", + "datum": "./datum.ts", + "decoder": "./decoder.ts", + "either": "./either.ts", + "failable": "./failable.ts", + "filterable": "./filterable.ts", + "flatmappable": "./flatmappable.ts", + "fn": "./fn.ts", + "fn_either": "./fn_either.ts", + "foldable": "./foldable.ts", + "identity": "./identity.ts", + "initializable": "./initializable.ts", + "iterable": "./iterable.ts", + "json_schema": "./json_schema.ts", + "kind": "./kind.ts", + "map": "./map.ts", + "mappable": "./mappable.ts", + "newtype": "./newtype.ts", + "nil": "./nil.ts", + "number": "./number.ts", + "optic": "./optic.ts", + "option": "./option.ts", + "pair": "./pair.ts", + "predicate": "./predicate.ts", + "premappable": "./premappable.ts", + "promise": "./promise.ts", + "record": "./record.ts", + "refinement": "./refinement.ts", + "schemable": "./schemable.ts", + "set": "./set.ts", + "showable": "./showable.ts", + "sortable": "./sortable.ts", + "state": "./state.ts", + "string": "./string.ts", + "sync": "./sync.ts", + "sync_either": "./sync_either.ts", + "these": "./these.ts", + "traversable": "./traversable.ts", + "tree": "./tree.ts", + "wrappable": "./wrappable.ts", + "contrib/fast-check": "./contrib/fast-check.ts", + "contrib/free": "./contrib/free.ts", + "contrib/generator": "./contrib/generator.ts", + "contrib/most": "./contrib/most.ts" + }, + "include": [ + "LICENSE", + "README.md", + "deno.json" + ] +} 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/mod.ts b/mod.ts deleted file mode 100644 index 9781975..0000000 --- a/mod.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * This file contains barrel exports for all non-contrib files in fun. - * It is generated by the `./scripts/mod.sh` file. Please do not edit - * it manually. - * - * @module Exports - * @since 2.0.0 - */ - -export * as applicable from "./applicable.ts"; -export * as array from "./array.ts"; -export * as async from "./async.ts"; -export * as async_either from "./async_either.ts"; -export * as async_iterable from "./async_iterable.ts"; -export * as bimappable from "./bimappable.ts"; -export * as boolean from "./boolean.ts"; -export * as combinable from "./combinable.ts"; -export * as comparable from "./comparable.ts"; -export * as composable from "./composable.ts"; -export * as decoder from "./decoder.ts"; -export * as either from "./either.ts"; -export * as failable from "./failable.ts"; -export * as filterable from "./filterable.ts"; -export * as flatmappable from "./flatmappable.ts"; -export * as fn from "./fn.ts"; -export * as fn_either from "./fn_either.ts"; -export * as foldable from "./foldable.ts"; -export * as identity from "./identity.ts"; -export * as initializable from "./initializable.ts"; -export * as iterable from "./iterable.ts"; -export * as json_schema from "./json_schema.ts"; -export * as map from "./map.ts"; -export * as mappable from "./mappable.ts"; -export * as newtype from "./newtype.ts"; -export * as nil from "./nil.ts"; -export * as number from "./number.ts"; -export * as optic from "./optic.ts"; -export * as option from "./option.ts"; -export * as pair from "./pair.ts"; -export * as predicate from "./predicate.ts"; -export * as premappable from "./premappable.ts"; -export * as promise from "./promise.ts"; -export * as refinement from "./refinement.ts"; -export * as schemable from "./schemable.ts"; -export * as set from "./set.ts"; -export * as showable from "./showable.ts"; -export * as sortable from "./sortable.ts"; -export * as state from "./state.ts"; -export * as string from "./string.ts"; -export * as sync from "./sync.ts"; -export * as sync_either from "./sync_either.ts"; -export * as these from "./these.ts"; -export * as traversable from "./traversable.ts"; -export * as tree from "./tree.ts"; -export * as wrappable from "./wrappable.ts"; 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 diff --git a/scripts/exports.sh b/scripts/exports.sh new file mode 100755 index 0000000..97b7a03 --- /dev/null +++ b/scripts/exports.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env zsh + +for i in *.ts contrib/*.ts; do echo "\"${i:s/\.ts//}\": \"./$i\","; done diff --git a/scripts/mod.sh b/scripts/mod.sh deleted file mode 100755 index 67f2681..0000000 --- a/scripts/mod.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env zsh - -cat << EOF -/** - * This file contains barrel exports for all non-contrib files in fun. - * It is generated by the \`./scripts/mod.sh\` file. Please do not edit - * it manually. - * - * @module Exports - * @since 2.0.0 - */ - -EOF - -for i in *[!(mod)].ts; do echo "export * as ${i:s/\.ts//} from \"./$i\";"; done