@adaptably/to

1.0.1 • Public • Published

@adaptably/to

Get the absolute path to a file in an ES6 module.

Installation

npm install @adaptably/to

Usage

import to from '@adaptably/to'

const path = to(target, source)

Arguments

Name Type Description
target String The relative path to the target file.
source Object An object with one key (from) which contains the absolute path to the source file (usually import.meta.url).

Example

Given the file structure:

source/
  folder1/
    1.js
  folder2/
    2.js

1.js

import pathTo from '@adaptably/to'

const path = pathTo('../folder2/2.js', { from: import.meta.url })
// => /absolute/path/to/folder2/2.js

Readme

Keywords

none

Package Sidebar

Install

npm i @adaptably/to

Weekly Downloads

3

Version

1.0.1

License

none

Unpacked Size

1.41 kB

Total Files

4

Last publish

Collaborators

  • jrh