import { PolicyFromES } from '../../../common/types' ; export const splitSizeAndUnits = ( field ) : { size : string ; units : string ; } => { let size = '' ; let units = '' ; const result = /(\d+)(\w+)/ . exec ( field ) ; if ( result ) { size = result [ 1 ] ; units = result [ 2 ] ; } return { size , units , } ; } ; export const getPolicyByName = ( policies , policyName = '' ) : PolicyFromES | undefined => { if ( policies && policies . length > 0 ) { return policies . find ( ( policy ) => policy . name === policyName ) ; } } ; export const hasLinkedIndices = ( policy ) => Boolean ( policy . indices && policy . indices . length ) ;