Skip to content

Commit

Permalink
Change the signature of make
Browse files Browse the repository at this point in the history
Accept readonly arrays as input.
  • Loading branch information
SRachamim authored and gcanti committed Apr 26, 2021
1 parent 1969c9c commit b0de51a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/modules/Zipper.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ Creates a new zipper.
**Signature**
```ts
export declare const make: <A>(lefts: A[], focus: A, rights: A[]) => Zipper<A>
export declare const make: <A>(lefts: readonly A[], focus: A, rights: readonly A[]) => Zipper<A>
```
Added in v0.1.6
Expand Down
6 changes: 5 additions & 1 deletion src/Zipper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@ export interface Zipper<A> {
* @category constructors
* @since 0.1.6
*/
export const make: <A>(lefts: Array<A>, focus: A, rights: Array<A>) => Zipper<A> = (lefts, focus, rights) => ({
export const make: <A>(lefts: ReadonlyArray<A>, focus: A, rights: ReadonlyArray<A>) => Zipper<A> = (
lefts,
focus,
rights
) => ({
lefts: lefts.slice(),
focus,
rights: rights.slice()
})

/**
Expand Down

0 comments on commit b0de51a

Please sign in to comment.