Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ratson/esmeta

Handy function to handle import.meta
https://github.com/ratson/esmeta

esm esmodules import-meta meta node10

Last synced: 20 days ago
JSON representation

Handy function to handle import.meta

Awesome Lists containing this project

README

        

# esmeta

Handy function to handle `import.meta`

## Installation

```
npm install esmeta --save
```

## Usage

```js
import esmeta from 'esmeta'

const importMeta = esmeta(import.meta)
/*
{
url: "file:///a/b/c.mjs" // same as `import.meta.url`
dirname: "/a/b"
filename: "/a/b/c.mjs"
dirnameJoin(...paths) // helper function to join path
isMain() // return true if match to `process.mainModule`
resolve() // return the resolved filename like `require.resolve`
}
*/
```

## Related

- [is-main](https://github.com/ratson/is-main) - Check if current module is main module.