https://github.com/dragon-fish/use-dirname
const __dirname = useDirname(import.meta.url)
https://github.com/dragon-fish/use-dirname
dirname esm nodejs
Last synced: 3 months ago
JSON representation
const __dirname = useDirname(import.meta.url)
- Host: GitHub
- URL: https://github.com/dragon-fish/use-dirname
- Owner: dragon-fish
- License: mit
- Created: 2024-05-11T19:21:25.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-11T19:49:23.000Z (about 2 years ago)
- Last Synced: 2025-04-04T11:39:53.326Z (over 1 year ago)
- Topics: dirname, esm, nodejs
- Language: TypeScript
- Homepage: https://npmjs.com/use-dirname
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# use-dirname
Use `__dirname` in ESM modules. That's it.
```ts
import { useDirname } from 'use-dirname'
const __dirname = useDirname(import.meta.url)
```
Tired of pasting this function into every project I've worked on, I've decided it's time to package it and put it on. Then it will never take me that long.
## Unit Test (?)
**💥100% coverage💥**
```bash
pnpm test
```
Honestly, this test is somewhat absurd, true. But in the world of code, it's better than including no test, too.
---
> MIT License
>
> Copyright (c) 2024 机智的小鱼君(Dragon-Fish)