Skip to content

Commit

Permalink
Simplify fromNonEmptyArray
Browse files Browse the repository at this point in the history
Implement it in terms of `fromReadonlyNonEmptyArray`.
  • Loading branch information
SRachamim authored and gcanti committed Apr 26, 2021
1 parent 908cc91 commit 1969c9c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Zipper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const fromReadonlyNonEmptyArray: <A>(rnea: ReadonlyNonEmptyArray<A>) => Z
* @category constructors
* @since 0.1.6
*/
export const fromNonEmptyArray: <A>(nea: NonEmptyArray<A>) => Zipper<A> = (nea) => make(A.empty, nea[0], nea.slice(1))
export const fromNonEmptyArray: <A>(nea: NonEmptyArray<A>) => Zipper<A> = fromReadonlyNonEmptyArray

// -------------------------------------------------------------------------------------
// destructors
Expand Down
4 changes: 2 additions & 2 deletions test/Zipper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ describe('Zipper', () => {
})

it('fromNonEmptyArray', () => {
assert.deepStrictEqual(_.fromNonEmptyArray([1]), _.make([], 1, []))
assert.deepStrictEqual(_.fromNonEmptyArray([1, 2, 3]), _.make([], 1, [2, 3]))
assert.deepStrictEqual(_.fromNonEmptyArray([1]), _.fromReadonlyNonEmptyArray([1]))
assert.deepStrictEqual(_.fromNonEmptyArray([1, 2, 3]), _.fromReadonlyNonEmptyArray([1, 2, 3]))
})
})

Expand Down

0 comments on commit 1969c9c

Please sign in to comment.