Liking cljdoc? Tell your friends :D

pathetic.core


absolute-path?clj/s

(absolute-path? path)

Returns true if the given argument is an absolute path.

Returns true if the given argument is an absolute path.
sourceraw docstring

as-urlclj/s

(as-url url-or-string)
source (clj)source (cljs)

ends-withclj/s

(ends-with s suffix)
source (clj)source (cljs)

ensure-trailing-separatorclj/s

(ensure-trailing-separator path)

If the path given does not have a trailing separator, returns a new path that has one.

If the path given does not have a trailing separator, returns a new path
that has one.
sourceraw docstring

normalizeclj/s

(normalize path)

Cleans up a path so that it has no leading/trailing whitespace, and removes any unremovable same-/parent-dir references. Takes the path argument as a string and returns its result as a string.

Cleans up a path so that it has no leading/trailing whitespace, and
removes any unremovable same-/parent-dir references. Takes the path
argument as a string and returns its result as a string.
sourceraw docstring

normalize*clj/s

(normalize* path-pieces)

Cleans up a path so that it has no leading/trailing whitespace, and removes any removable same-/parent-dir references. path-pieces should be a path vector in the format returned by parse-path; return value is a vector in the same format.

Cleans up a path so that it has no leading/trailing whitespace, and
removes any removable same-/parent-dir references. path-pieces
should be a path vector in the format returned by parse-path;
return value is a vector in the same format.
sourceraw docstring

parse-pathclj/s

(parse-path path)

Given a j.io.File or string containing a relative or absolute path, returns the corresponding path vector data structure described at the top of the file.

This function does not do any normalization or simplification. However, because there is more than one way to write some paths, some simplification might happen anyways, such as if the path starts with a (redundant) ".".

Given a j.io.File or string containing a relative or absolute path,
returns the corresponding path vector data structure described at
the top of the file.

This function does not do any normalization or simplification. However,
because there is more than one way to write some paths, some simplification
might happen anyways, such as if the path starts with a (redundant) ".".
sourceraw docstring

relativizeclj/s

(relativize base-path dest-path)

Takes two absolute paths or two relative paths, and returns a relative path that indicates the same file system location as destination-path, but relative to base-path.

Takes two absolute paths or two relative paths, and returns a relative path
that indicates the same file system location as destination-path, but
relative to base-path.
sourceraw docstring

relativize*clj/s

(relativize* base-path dest-path)

Takes two absolute paths or two relative paths, and returns a relative path that indicates the same file system location as dest-path, but relative to base-path. Paths should be path vectors, and the return value is also a path vector.

Takes two absolute paths or two relative paths, and returns a relative path
that indicates the same file system location as dest-path, but
relative to base-path. Paths should be path vectors, and the return
value is also a path vector.
sourceraw docstring

render-pathclj/s

(render-path path-pieces)

Given a seq of path elements as created by parse-path, returns a string containing the path represented. This function will only ever use unix-style path rules, so an absolute path will always start with the "/" separator.

NOTE: It is NOT the goal of this function to perform normalization, it just renders what it is given. HOWEVER, that does NOT mean that it is always true that (= (render-path (parse-path some-path)) some-path). That is, you may not render the exact same string you parsed. This is because the path syntax does not have exactly one way to write every path.

Given a seq of path elements as created by parse-path, returns a string
containing the path represented. This function will only
ever use unix-style path rules, so an absolute path will always start with
the "/" separator.

NOTE: It is NOT the goal of this function to perform normalization, it just
renders what it is given. HOWEVER, that does NOT mean that it is always true
that (= (render-path (parse-path some-path)) some-path). That is, you may not
render the exact same string you parsed. This is because the path syntax does
not have exactly one way to write every path.
sourceraw docstring

resolveclj/s

(resolve base-path other-path)

Resolve the other-path against the base-path. If other-path is absolute, the result is other-path. If other-path is nil, the result is base-path. Otherwise, the result is other-path concatenated onto base-path. Does not normalize its output. Accepts an optional third argument containing a string with the path separator to use.

Resolve the other-path against the base-path. If other-path is absolute,
the result is other-path. If other-path is nil, the result is base-path.
Otherwise, the result is other-path concatenated onto base-path. Does not
normalize its output. Accepts an optional third argument containing a string
with the path separator to use.
sourceraw docstring

resolve*clj/s

(resolve* base-path other-path)

Resolve the other-path against the base-path. If other-path is absolute, the result is other-path. If other-path is nil, the result is base-path. Otherwise, the result is other-path concatenated onto base-path. Does not normalize its output. All inputs and outputs are path vectors.

Resolve the other-path against the base-path. If other-path is absolute,
the result is other-path. If other-path is nil, the result is base-path.
Otherwise, the result is other-path concatenated onto base-path. Does not
normalize its output. All inputs and outputs are path vectors.
sourceraw docstring

splitclj/s

(split path)
source (clj)source (cljs)

split-url-on-pathclj/s

(split-url-on-path url-or-string)

Given a URL or string containing a URL, returns a vector of the three component strings: the stuff before the path, the path, and the stuff after the path. Useful for destructuring.

Given a URL or string containing a URL, returns a vector of the three
component strings: the stuff before the path, the path, and the stuff
after the path. Useful for destructuring.
sourceraw docstring

starts-withclj/s

(starts-with s prefix)
source (clj)source (cljs)

up-dirclj/s

(up-dir path-pieces)

Given a seq of path elements as created by parse-path, returns a new seq of path elements, but having gone "up" one directory. That is, applies a ".." component to the path.

Given a seq of path elements as created by parse-path, returns a new
seq of path elements, but having gone "up" one directory. That is,
applies a ".." component to the path.
sourceraw docstring

url-ensure-trailing-separatorclj/s

(url-ensure-trailing-separator url-or-string)

Behaves like ensure-trailing-separator on the path part of a URL, but takes a j.n.URL or string containing a URL, and returns a string containing the same URL instead of just a path. Everything but the path part of the URL is unchanged (query, anchor, protocol, etc).

Behaves like ensure-trailing-separator on the path part of a URL, but takes
a j.n.URL or string containing a URL, and returns a string containing the
same URL instead of just a path. Everything but the path part of the URL is
unchanged (query, anchor, protocol, etc).
sourceraw docstring

url-normalizeclj/s

(url-normalize url-or-string)

Behaves like normalize on the path part of a URL, but takes a j.n.URL or string containing a URL, and returns a string containing the same URL instead of just a path. Everything but the path part of the URL is unchanged (query, anchor, protocol, etc).

Behaves like normalize on the path part of a URL, but takes a j.n.URL or
string containing a URL, and returns a string containing the same URL
instead of just a path. Everything but the path part of the URL is unchanged
(query, anchor, protocol, etc).
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close