0.1.0 • Published 8 years ago

path-is-root v0.1.0

Weekly downloads
8,369
License
MIT
Repository
github
Last release
8 years ago

Build Status Coverage

path-is-root

check if a path is root

Install

npm install --save path-is-root

Usage

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