move to using require.main === module

This commit is contained in:
fragosti
2019-02-26 16:05:20 -08:00
parent eb212de70e
commit 42c3bb00ec

View File

@@ -69,5 +69,5 @@ export async function fetchSuccessfullyOrThrowAsync(url: string): Promise<any> {
* Tells if the code is being executed in the context of the command line (vs. a require for example)
*/
export function isCli(): boolean {
return !module.parent;
return require.main === module;
}