Files
liquidjs/src/drop/comparable.ts
T
55e144a029 fix: isComparable full interface check (#701)
* Improve isComparable function to ensure full Comparable interface implementation

* Deleted trailing commas

---------

Co-authored-by: Guillermo Casal Caro <[email protected]>
2024-05-24 10:35:49 +08:00

21 lines
444 B
TypeScript

import { isFunction } from '../util'
export interface Comparable {
equals: (rhs: any) => boolean;
gt: (rhs: any) => boolean;
geq: (rhs: any) => boolean;
lt: (rhs: any) => boolean;
leq: (rhs: any) => boolean;
}
export function isComparable (arg: any): arg is Comparable {
return (
arg &&
isFunction(arg.equals) &&
isFunction(arg.gt) &&
isFunction(arg.geq) &&
isFunction(arg.lt) &&
isFunction(arg.leq)
)
}