PathParents class
PathParents class
Section titled “PathParents class”Sequence-like view over the logical ancestors of a PurePath.
Signature:
export declare class PathParents implements Iterable<PurePath>Implements: Iterable<PurePath>
Remarks
Section titled “Remarks”Iterating over this object yields each parent path in order, from immediate to the top-level anchor.
Example
Section titled “Example”Iterating over parent directories
import { PathParents, PurePath } from "pathlib-ts";
const article = new PurePath("/site/content/posts/launch.mdx");const parents = new PathParents(article);
for (const parent of parents) { console.log(parent.toString());}// '/site/content/posts'// '/site/content'// '/site'Constructors
Section titled “Constructors”|
Constructor |
Modifiers |
Description |
|---|---|---|
|
Constructs a new instance of the |
Properties
Section titled “Properties”|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
|
number |
Methods
Section titled “Methods”|
Method |
Modifiers |
Description |
|---|---|---|