Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/null93/deepest-common-folder
Node module that finds the deepest common folder from an array of given paths
https://github.com/null93/deepest-common-folder
node-module npm-package
Last synced: about 5 hours ago
JSON representation
Node module that finds the deepest common folder from an array of given paths
- Host: GitHub
- URL: https://github.com/null93/deepest-common-folder
- Owner: null93
- License: mit
- Created: 2018-06-06T03:46:14.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T20:55:48.000Z (almost 2 years ago)
- Last Synced: 2024-08-10T21:34:36.417Z (3 months ago)
- Topics: node-module, npm-package
- Language: JavaScript
- Homepage:
- Size: 85 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# deepest-common-folder
> Node module that finds the deepest common folder from an array of given paths![MIT License](https://img.shields.io/badge/License-MIT-lightgrey.svg?style=for-the-badge)
![Version 1.0.0](https://img.shields.io/badge/Version-1.0.0-lightgrey.svg?style=for-the-badge)
![Travis CI](https://img.shields.io/travis/null93/deepest-common-folder.svg?style=for-the-badge&colorB=9f9f9f)## About
This module takes in an array of path strings and determines the deepest common folder. This means that it finds the deepest possible parent folder that is shared by all paths in the passed array.
## Install
```
npm i -S deepest-common-folder
```## Testing
```
npm run test
```## Usage
Below is an example of how this module can be used. Please note that if an empty array is passed, then `/` will be returned. Also if relative paths are used, they will be resolved based on the _CWD_. An absolute path with a trailing `/` will always be returned. If a non-array is passed, then an exception is thrown.
```javascript
const dcf = require ("deepest-common-folder")let paths = [
"/foo/bar",
"/foo/bar/baz",
"/foo/baz",
"/foo/baz/bar"
]let folder = dcf ( paths )
```