Repository URL to install this package:
Version:
2.0.1 ▾
|
import { isObj } from '../../types/obj/check/isObj'
export function createPredicateForProperty(propName: string) {
return function(x: any) {
return isObj(x) && x[propName] === true
}
}
export function createInstanceofPredicate<T>(
name: string,
clazz: new (...args: any[]) => T
): (x: any) => x is T {
const propName = 'isMobX' + name
clazz.prototype[propName] = true
return function(x) {
return isObj(x) && x[propName] === true
} as any
}