Skip to content

Commit

Permalink
feat(either): allow isLeft and isRight guards to accept any value
Browse files Browse the repository at this point in the history
  • Loading branch information
drizzer14 committed Nov 23, 2022
1 parent 06a800f commit 768ad84
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/either/operators/guards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import { Right, rid } from '../right'
import type { Either } from '../either'

/**
* Type guard function to tell if the provided `monad` is `Left`.
* Type guard function to tell if the provided `value` is `Left`.
*/
export function isLeft<LeftValue> (
monad: Either<LeftValue, any>
): monad is Left<LeftValue> {
return Object.prototype.hasOwnProperty.call(monad, lid)
value: any
): value is Left<LeftValue> {
return Object.prototype.hasOwnProperty.call(value, lid)
}

/**
* Type guard function to tell if the provided `monad` is `Right`.
* Type guard function to tell if the provided `value` is `Right`.
*/
export function isRight<RightValue> (
monad: Either<any, RightValue>
): monad is Right<RightValue> {
return Object.prototype.hasOwnProperty.call(monad, rid)
value: any
): value is Right<RightValue> {
return Object.prototype.hasOwnProperty.call(value, rid)
}

/**
Expand Down

0 comments on commit 768ad84

Please sign in to comment.