import { ObjectID } from '../util/ObjectIDs' ; export function lazyObjEquals ( a , b ) { for ( const key of Object . keys ( a ) ) { if ( ! lazyEquals ( a [ key ] , b [ key ] ) ) { return false ; } } return true ; } function typ ( val ) { if ( val === null ) { return 'null' ; } return typeof val ; } export function lazyEquals ( a , b ) { const nrUndefined = [ a , b ] . filter ( val => val === undefined ) . length ; const nrNull = [ a , b ] . filter ( val => val === null ) . length ; if ( [ 1 ] . includes ( nrUndefined ) ) { return false ; } if ( [ 1 ] . includes ( nrNull ) ) { return false ; } const aObj = < any > a ; const bObj = < any > b ; if ( aObj && aObj . oid && bObj && bObj . oid ) { return aObj . oid === bObj . oid ; } return a === b ; } export interface LazyProps extends LazyMap { } export interface LazyState extends LazyMap { } export interface LazyMap { [ key ] : LazyType | undefined | null ; } export type LazyType = string | number | boolean | ObjectID | undefined | null ;