path.join
Like path.join
but takes absolute path into account.
path.join
?It does not produce accurate path when non-first argument is an absolute path.
declare function createJoinFunction (pathModule: {
isAbsolute (): boolean
join (left: string, right: string): string
}): (left: string, right: string) => string
import path from 'path'
import createJoinFunction from 'better-path-join'
const join = createJoinFunction(path)
console.log('relative', join('abc/def', 'foo/bar'))
console.log('absolute', join('abc/def', '/foo/bar'))
Output:
relative abc/def/foo/bar
absolute /foo/bar
Generated using TypeDoc