Giter VIP home page Giter VIP logo

underscore-path-js's Introduction

__Path (JavaScript)

โš–๏ธ MIT

๐Ÿ—‚๏ธ GitHub: hugoalh-studio/underscore-path-js NPM: @hugoalh/underscore-path

๐Ÿ†™ Latest Release Version (Latest Release Date)

A JavaScript module to bring back __dirname and __filename within 2 lines of code.

/* โ˜น๏ธ */
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
/* ๐Ÿ™‚ */
import { underscorePath } from "@hugoalh/underscore-path";
const { __dirname, __filename } = underscorePath(import.meta.url);

๐ŸŽฏ Target

  • Bun ^ v1.0.0
  • Cloudflare Workers
  • Deno >= v1.34.0

    ๐Ÿ›ก๏ธ Require Permission

    N/A

  • NodeJS >= v16.13.0

๐Ÿ”ฐ Usage

Via Installation

๐ŸŽฏ Supported Target

  • Cloudflare Workers
  • NodeJS
  1. Install via console/shell/terminal:
    • Via NPM
      npm install @hugoalh/underscore-path[@<Tag>]
    • Via PNPM
      pnpm add @hugoalh/underscore-path[@<Tag>]
    • Via Yarn
      yarn add @hugoalh/underscore-path[@<Tag>]
  2. Import at the script (<ScriptName>.js):
    import ... from "@hugoalh/underscore-path";

    โ„น๏ธ Note

    Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit file package.json property exports for available sub paths.

Via NPM Specifier

๐ŸŽฏ Supported Target

  • Bun
  • Deno
  1. Import at the script (<ScriptName>.js):
    import ... from "npm:@hugoalh/underscore-path[@<Tag>]";

    โ„น๏ธ Note

    Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit file package.json property exports for available sub paths.

๐Ÿงฉ API

  • function underscorePath(importMetaURL: string): UnderscorePathOutput;
  • interface UnderscorePathOutput {
      __dirname: string;
      __filename: string;
    }

underscore-path-js's People

Contributors

dependabot[bot] avatar hugoalh avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.