-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
11 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/** | ||
* Get an absolute path given a relative path `from` relative to `to`. | ||
* @param {string} from | ||
* @param {string} to | ||
*/ | ||
export const relative = (from, to) => new URL(to, from).href; | ||
import url from 'url'; | ||
import path from 'path'; | ||
|
||
/** Get a new path relative to the current module (pass import.meta). */ | ||
export const relative = (meta, ...to) => | ||
path.resolve(path.dirname(url.fileURLToPath(meta.url)), ...to); |