query
On this page

removePrefix

lib.path.removePrefix

Docs pulled from | This Revision | 22 minutes ago


Remove the first path as a component-wise prefix from the second path. The result is a normalised subpath string.

Laws:

  • Inverts append for normalised subpath string:

    removePrefix p (append p s) == subpath.normalise s
    

Inputs

path1

1. Function argument

Type

removePrefix :: Path -> Path -> String

Examples

removePrefix usage example

removePrefix /foo /foo/bar/baz
=> "./bar/baz"
removePrefix /foo /foo
=> "./."
removePrefix /foo/bar /foo
=> <error>
removePrefix /. /foo
=> "./foo"