UNPKG

@types/common-ancestor-path

Version:
41 lines (34 loc) 1.37 kB
# Installation > `npm install --save @types/common-ancestor-path` # Summary This package contains type definitions for common-ancestor-path (https://github.com/isaacs/common-ancestor-path). # Details Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/common-ancestor-path. ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/common-ancestor-path/index.d.ts) ````ts export = commonAncestorPath; /** * Find the common ancestor of 2 or more paths on Windows or Unix * * @returns The nearest (deepest) common ancestor path, or `null` if on different roots on Windows. * * @example * import ancestor = require('common-ancestor-path'); * * // output /a/b * console.log(ancestor('/a/b/c/d', '/a/b/x/y/z', '/a/b/c/i/j/k')); * * // normalizes separators, but NOT cases, since it matters sometimes * console.log(ancestor('C:\\a\\b\\c', 'C:\\a\\b\\x')); * * // no common ancestor on different windows drive letters * // so, this returns null * console.log(ancestor('c:\\a\\b\\c', 'd:\\d\\e\\f')); */ declare function commonAncestorPath(...paths: string[]): string | null; ```` ### Additional Details * Last updated: Mon, 06 Nov 2023 22:41:05 GMT * Dependencies: none # Credits These definitions were written by [BendingBender](https://github.com/BendingBender).