$ npm install is-root-path
Check if a path is the root path. Example: / or C:\
/
C:\
import isRootPath from 'is-root-path'; isRootPath('/'); //=> true isRootPath('/Users'); //=> false