Skip to content

Commit a4c16af

Browse files
committed
fix: update some types in array.ts and add deno.json
This is the first published release of fun as @baetheus/fun on jsr.io. Let's hope it works great!
1 parent 40a0012 commit a4c16af

File tree

9 files changed

+177
-86
lines changed

9 files changed

+177
-86
lines changed

array.ts

+20-8
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,9 @@ export function prepend<A>(
938938
*
939939
* @since 2.0.0
940940
*/
941-
export function insert<A>(value: A) {
941+
export function insert<A>(
942+
value: A,
943+
): (index: number) => (arr: ReadonlyArray<A>) => ReadonlyArray<A> {
942944
return (index: number) => (arr: ReadonlyArray<A>): ReadonlyArray<A> =>
943945
index < 0 || index > arr.length ? arr : _unsafeInsertAt(index, value, arr);
944946
}
@@ -965,7 +967,9 @@ export function insert<A>(value: A) {
965967
*
966968
* @since 2.0.0
967969
*/
968-
export function insertAt(index: number) {
970+
export function insertAt(
971+
index: number,
972+
): <A>(value: A) => (arr: ReadonlyArray<A>) => ReadonlyArray<A> {
969973
return <A>(value: A) => (arr: ReadonlyArray<A>): ReadonlyArray<A> =>
970974
index < 0 || index > arr.length ? arr : _unsafeInsertAt(index, value, arr);
971975
}
@@ -989,7 +993,9 @@ export function insertAt(index: number) {
989993
*
990994
* @since 2.0.0
991995
*/
992-
export function update<A>(value: A) {
996+
export function update<A>(
997+
value: A,
998+
): (index: number) => (arr: ReadonlyArray<A>) => ReadonlyArray<A> {
993999
return (index: number) => (arr: ReadonlyArray<A>): ReadonlyArray<A> =>
9941000
isOutOfBounds(index, arr) ? arr : _unsafeUpdateAt(index, value, arr);
9951001
}
@@ -1013,8 +1019,10 @@ export function update<A>(value: A) {
10131019
*
10141020
* @since 2.0.0
10151021
*/
1016-
export function updateAt(index: number) {
1017-
return <A>(value: A) => (arr: ReadonlyArray<A>): ReadonlyArray<A> =>
1022+
export function updateAt(
1023+
index: number,
1024+
): <A>(value: A) => (arr: ReadonlyArray<A>) => ReadonlyArray<A> {
1025+
return (value) => (arr) =>
10181026
isOutOfBounds(index, arr) ? arr : _unsafeUpdateAt(index, value, arr);
10191027
}
10201028

@@ -1063,7 +1071,9 @@ export function modify<A>(modifyFn: (a: A) => A) {
10631071
*
10641072
* @since 2.0.0
10651073
*/
1066-
export function modifyAt(index: number) {
1074+
export function modifyAt(
1075+
index: number,
1076+
): <A>(modifyFn: (a: A) => A) => (arr: ReadonlyArray<A>) => ReadonlyArray<A> {
10671077
return <A>(modifyFn: (a: A) => A) =>
10681078
(arr: ReadonlyArray<A>): ReadonlyArray<A> =>
10691079
isOutOfBounds(index, arr)
@@ -1092,7 +1102,7 @@ export function modifyAt(index: number) {
10921102
*
10931103
* @since 2.0.0
10941104
*/
1095-
export function lookup(index: number) {
1105+
export function lookup(index: number): <A>(arr: ReadonlyArray<A>) => Option<A> {
10961106
return <A>(as: ReadonlyArray<A>): Option<A> =>
10971107
isOutOfBounds(index, as) ? none : some(as[index]);
10981108
}
@@ -1505,7 +1515,9 @@ export const WrappableArray: Wrappable<KindArray> = { wrap };
15051515
/**
15061516
* @since 2.0.0
15071517
*/
1508-
export const tap = createTap(FlatmappableArray);
1518+
export const tap: <A>(
1519+
fa: (value: A) => void,
1520+
) => (ua: ReadonlyArray<A>) => ReadonlyArray<A> = createTap(FlatmappableArray);
15091521

15101522
/**
15111523
* @since 2.0.0

deno.json

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"name": "@baetheus/fun",
3+
"version": "2.0.1",
4+
"exports": {
5+
"applicable": "./applicable.ts",
6+
"array": "./array.ts",
7+
"async": "./async.ts",
8+
"async_either": "./async_either.ts",
9+
"async_iterable": "./async_iterable.ts",
10+
"bimappable": "./bimappable.ts",
11+
"boolean": "./boolean.ts",
12+
"combinable": "./combinable.ts",
13+
"comparable": "./comparable.ts",
14+
"composable": "./composable.ts",
15+
"datum": "./datum.ts",
16+
"decoder": "./decoder.ts",
17+
"either": "./either.ts",
18+
"failable": "./failable.ts",
19+
"filterable": "./filterable.ts",
20+
"flatmappable": "./flatmappable.ts",
21+
"fn": "./fn.ts",
22+
"fn_either": "./fn_either.ts",
23+
"foldable": "./foldable.ts",
24+
"identity": "./identity.ts",
25+
"initializable": "./initializable.ts",
26+
"iterable": "./iterable.ts",
27+
"json_schema": "./json_schema.ts",
28+
"kind": "./kind.ts",
29+
"map": "./map.ts",
30+
"mappable": "./mappable.ts",
31+
"newtype": "./newtype.ts",
32+
"nil": "./nil.ts",
33+
"number": "./number.ts",
34+
"optic": "./optic.ts",
35+
"option": "./option.ts",
36+
"pair": "./pair.ts",
37+
"predicate": "./predicate.ts",
38+
"premappable": "./premappable.ts",
39+
"promise": "./promise.ts",
40+
"record": "./record.ts",
41+
"refinement": "./refinement.ts",
42+
"schemable": "./schemable.ts",
43+
"set": "./set.ts",
44+
"showable": "./showable.ts",
45+
"sortable": "./sortable.ts",
46+
"state": "./state.ts",
47+
"string": "./string.ts",
48+
"sync": "./sync.ts",
49+
"sync_either": "./sync_either.ts",
50+
"these": "./these.ts",
51+
"traversable": "./traversable.ts",
52+
"tree": "./tree.ts",
53+
"wrappable": "./wrappable.ts",
54+
"contrib/fast-check": "./contrib/fast-check.ts",
55+
"contrib/free": "./contrib/free.ts",
56+
"contrib/generator": "./contrib/generator.ts",
57+
"contrib/most": "./contrib/most.ts"
58+
},
59+
"include": [
60+
"LICENSE",
61+
"README.md",
62+
"deno.json"
63+
]
64+
}

deno.lock

+82
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
};
2323

2424
shell = with pkgs; mkShell {
25-
buildInputs = [ deno nodejs jq lcov jujutsu ];
25+
buildInputs = [ deno jq lcov ];
2626
};
2727

2828
in

mod.ts

-55
This file was deleted.

scripts/coverage.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ trap exiting SIGINT
1212
rm -rf $OUTPUT_DIR
1313
deno fmt
1414
deno test --doc --parallel --coverage=$OUTPUT_DIR
15-
deno coverage --unstable ./$OUTPUT_DIR --lcov > ./$OUTPUT_DIR/lcov.info
15+
deno coverage ./$OUTPUT_DIR --lcov > ./$OUTPUT_DIR/lcov.info
1616
genhtml ./$OUTPUT_DIR/lcov.info --output-directory $OUTPUT_DIR
1717
darkhttpd ./$OUTPUT_DIR

scripts/exports.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env zsh
2+
3+
for i in *.ts contrib/*.ts; do echo "\"${i:s/\.ts//}\": \"./$i\","; done

scripts/mod.sh

-15
This file was deleted.

0 commit comments

Comments
 (0)