https://github.com/rwu823/path-is-root
Check if a path is root in Node
https://github.com/rwu823/path-is-root
Last synced: 2 months ago
JSON representation
Check if a path is root in Node
- Host: GitHub
- URL: https://github.com/rwu823/path-is-root
- Owner: rwu823
- Created: 2016-05-18T06:41:49.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T02:30:50.000Z (over 1 year ago)
- Last Synced: 2025-04-03T06:13:05.338Z (3 months ago)
- Language: JavaScript
- Homepage: https://github.com/rwu823/path-is-root
- Size: 2.93 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/rwu823/path-is-root) [](https://coveralls.io/github/rwu823/path-is-root)
# path-is-root
check if a path is root
## Install
```javascript
npm install --save path-is-root
```## Usage
```javascript
import isRoot from 'path-is-root'
test('should be root path in Unix', assert => {
assert.is(isRoot('/'), true)
})test('should be not root path in Unix', assert => {
assert.is(isRoot('/x'), false)
})test('should be root path in Win', assert => {
assert.is(isRoot('C:/'), true)
})test('should be not root path in Win', assert => {
assert.is(isRoot('C:/x'), false)
})
```## API
### isRoot(path)
Returns a boolean of whether the path is root