Skip to content

Commit

Permalink
feat: add join method (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 authored Nov 28, 2023
1 parent a5bb782 commit 00a91bd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { fileURLToPath } from 'node:url'
import { dirname as pathDirname } from 'node:path'
import { join as pathJoin, dirname as pathDirname } from 'node:path'

export { base64 } from './src/base64.js'
export { compose } from './src/compose.js'
Expand Down Expand Up @@ -40,3 +40,10 @@ export function getDirname(url: string | URL) {
export function getFilename(url: string | URL) {
return fileURLToPath(url)
}

/**
* Joins the given URL or string with additional path segments.
*/
export function join(url: string | URL, ...str: string[]) {
return pathJoin(getDirname(url), ...str)
}

0 comments on commit 00a91bd

Please sign in to comment.