import { ElementRef , TemplateRef } from '@angular/core' ; export function isUndefined ( value ) { return value === undefined ; } export function isNull ( value ) { return value === null ; } export function isUndefinedOrNull ( value ) { return isUndefined ( value ) || isNull ( value ) ; } export function isArray < T = any > ( value ) { return value && baseGetTag ( value ) === '[object Array]' ; } export function isEmpty ( value ? ) { if ( isUndefinedOrNull ( value ) ) { return true ; } if ( isArray ( value ) ) { return ! value . length ; } const tag = baseGetTag ( value ) ; if ( tag == '[object Map]' || tag == '[object Set]' ) { return ! value . size ; } for ( const key in value ) { if ( Object . hasOwnProperty . call ( value , key ) ) { return false ; } } return true ; } export function isString ( value ? ) { return typeof value == 'string' || ( ! isArray ( value ) && isObjectLike ( value ) && baseGetTag ( value ) === '[object String]' ) ; } function isObjectLike ( value ) { return value !== null && typeof value === 'object' ; } function baseGetTag ( value ) { const objectProto = Object . prototype ; const hasOwnProperty = objectProto . hasOwnProperty ; const toString = objectProto . toString ; const symToStringTag = typeof Symbol !== 'undefined' ? Symbol . toStringTag : undefined ; if ( value == null ) { return value === undefined ? '[object Undefined]' : '[object Null]' ; } if ( ! ( symToStringTag && symToStringTag in Object ( value ) ) ) { return toString . call ( value ) ; } const isOwn = hasOwnProperty . call ( value , symToStringTag ) ; const tag = value [ symToStringTag ] ; let unmasked = false ; try { value [ symToStringTag ] = undefined ; unmasked = true ; } catch ( e ) { } const result = toString . call ( value ) ; if ( unmasked ) { if ( isOwn ) { value [ symToStringTag ] = tag ; } else { delete value [ symToStringTag ] ; } } return result ; } export function isNumber ( value ) { return typeof value === 'number' || ( isObjectLike ( value ) && baseGetTag ( value ) === '[object Number]' ) ; } export function isObject ( value ) { const type = typeof value ; return ! ! value && ( type === 'object' || type === 'function' ) ; } export function isFunction ( value ) { const type = typeof value ; return ! ! value && type === 'function' ; } export function isDate ( value ) { const type = typeof value ; return ! ! value && type === 'object' && ! ! value . getTime ; } export function isBoolean ( value ) { return value === true || value === false || ( isObjectLike ( value ) && baseGetTag ( value ) === '[object Boolean]' ) ; } export function isTemplateRef < C = any > ( value ) { return value instanceof TemplateRef ; } export function isHTMLElement ( value ) { return value instanceof HTMLElement ; } export function isElementRef ( value ) { return value instanceof ElementRef ; }