mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
* Improve isComparable function to ensure full Comparable interface implementation * Deleted trailing commas --------- Co-authored-by: Guillermo Casal Caro <[email protected]>
21 lines
444 B
TypeScript
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)
|
|
)
|
|
}
|