import { statSync } from 'fs' ; import { readdir } from './readdir' ; param path return function isFile ( path ) { return statSync ( path ) . isFile ( ) ; } param array param file return function loop ( array , file ) { return [ ... array , ... require ( file ) ] ; } param path return export function get ( path ) { let files ; if ( typeof path === 'string' ) { files = isFile ( path ) ? [ path ] : readdir ( path ) ; } else { files = path ; } return files . reduce ( loop , [ ] ) ; }