$ npm install path-is-root
check if a path is root
npm install --save path-is-root
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)
})
Returns a boolean of whether the path is root
© 2010 - cnpmjs.org x YWFE | Home | YWFE