import { Injectable } from '@angular/core' ; @ Injectable ( { providedIn : 'root' } ) export class UtilService { constructor ( ) { } isDate ( val ) { if ( ! isNaN ( val ) && val . toString ( ) . indexOf ( '.' ) === - 1 ) { const len = val . toString ( ) . length ; return len > 10 ; } else { return false ; } } isBoolean ( val ) { return val === 'true' || val === 'false' || val === true || val === false ; } getTrueValue ( val ) { if ( ! isNaN ( val ) && typeof val !== 'number' && ! this . isBoolean ( val ) ) { if ( val . includes ( '.' ) ) { return parseFloat ( val ) ; } else { return parseInt ( val , 10 ) ; } } else { return val ; } } }