import logger from 'loglevel' ; export function assert ( expression , message ) { if ( ! expression ) { logger . error ( `ERROR: ${ message }` ) ; process . exit ( 0 ) ; } } export function isExpectedType ( filename , ext ) { return filename . split ( '.' ) . pop ( ) === ext ; } export function getJsonInput ( input ) { let jsonInput ; try { jsonInput = typeof input === 'string' && JSON . parse ( input ) ; jsonInput = typeof jsonInput === 'object' && jsonInput ? jsonInput : undefined ; } catch ( e ) { } return jsonInput ; }