Let's say I have this
export type Hash = [ hashtype, hash ];
export type hashtype = -16 | -43 | 5 | 6;
export type hash = Buffer;
I want to write something that will check whether an object is a Hash
not implemented
isHash = (obj: any) => {
return (obj is Hash) // pseudo code, to implement
}
So that I would have such a return:
isHash(5) => false // no hash
isHash([25, <Buffer ad 30>]) => false // 25 is not in hashType
isHash([5, <Buffer ad 30>]) => true // valid