JSPM

path-is-root

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2948
  • Score
    100M100P100Q154615F
  • License MIT

Check if a path is root

Package Exports

  • path-is-root

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (path-is-root) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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