import * as which from 'which' ; import { isErrnoException } from './errors' ; param executableName returns { Promise < string | null > } export function find ( executableName ) { return new Promise < string | null > ( ( resolve , reject ) => { which ( executableName , ( error , resolvedPath ) => { if ( error ) { if ( isErrnoException ( error ) && error . code === 'ENOENT' ) resolve ( null ) ; else reject ( error ) ; } else resolve ( resolvedPath ) ; } ) ; } ) ; }