Skip to content

Commit ed15a76

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 ed15a76

File tree

6 files changed

+124
-16
lines changed

6 files changed

+124
-16
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

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@baetheus/fun",
3+
"version": "2.0.0",
4+
"exports": "./mod.ts",
5+
"publish": {
6+
"include": [
7+
"LICENSE",
8+
"README.md",
9+
"deno.json",
10+
"*.ts",
11+
"contrib/*.ts"
12+
]
13+
}
14+
}

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

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

0 commit comments

Comments
 (0)