0.1.1 • Published 2 years ago

@theia-extension-tester/path-utils v0.1.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

path-utils

Path utils package used by theia-extension-tester. The package contains functions which are primarily designed to solve problems when working with tree page objects.

Usage

The package consist of several functions. Currently only Unix parts are supported.

Install via npm

npm install @theia-extension-tester/path-utils

Install via yarn

yarn add @theia-extension-tester/path-utils

Remove path white space from beginning, end and remove trailing path separator.

function trimPath(filePath: string): string;

Split a path using path separator.

function splitPath(filePath: string): string[];

Convert path into Eclipse Theia tree string format and return path segments.

function convertToTreePath(filePath: string): string[];

Convert file path to relative path from given root.

function getRelativePath(filePath: string, root: string): string;

Test if the path is relative to path argument to.

function isRelativeTo(path: string[], to: string[]): boolean;

Transform given path to acceptable format used in Eclipse Theia tree components.

function normalizePath(filePath: string): string;

Compare paths based on position where they would have been shown in Eclipse Theia tree.

function comparePaths(a: string[], b: string[], aIsFile: boolean = false, bIsFile: boolean = false): number;

The string alternative comparator.

comparePathsString(a: string, b: string, aIsFile: boolean = false, bIsFile: boolean = false): number;