export default class ParseData { static BOOLEAN_CONSTANTS = { 'true' : true , 'false' : false } ; public static parseNumber ( data ) { return + data ; } public static parseBoolean ( data ) { return this . BOOLEAN_CONSTANTS [ data . toString ( ) . toLowerCase ( ) ] ; } public static convertToNumber ( data , oldValue ) { const newValue = isNaN ( + data ) ? oldValue : + data ; return newValue ; } public static convertToBoolean ( data , oldValue ) { let newValue = this . BOOLEAN_CONSTANTS [ data . toLowerCase ( ) ] === undefined ? oldValue : this . BOOLEAN_CONSTANTS [ data . toLowerCase ( ) ] ; return newValue ; } public static getType ( state , key ) { return typeof state [ key ] ; } public static checkType ( state , key , value ) { return ( typeof state [ key ] ) === ( typeof value ) ; } public static getTypeByValue ( value ) { return typeof value ; } }