JSPM

winpath

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q29888F
  • License ISC

Path manipulation on both platform of windows or others

Package Exports

  • winpath

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 (winpath) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#detect path of absolute or relative on nodejs

Install

$ npm install --save winpath

Usage

const pathIsAbsolute = require('winpath');
// Running on Linux
pathIsAbsolute.isAbsolutePath('/home/foo');
//=> true
pathIsAbsolute.isAbsolutePath('C:/Users/foo');
//=> false

// Running on Windows
pathIsAbsolute.isAbsolutePath('C:/Users/foo');
//=> true
pathIsAbsolute.isAbsolutePath('/home/foo');
//=> false

// Running on any OS
pathIsAbsolute.posix('/home/foo');
//=> true
pathIsAbsolute.posix('C:/Users/foo');
//=> false
pathIsAbsolute.win32('C:/Users/foo');
//=> true
pathIsAbsolute.win32('/home/foo');
//=> false

The absolute path detection is based on path-is-absolute

const path = require('winpath');
path.isRelativePath("../../");
//=>true

The relative path detection is base on regex of /^\.\.?[/\\]/;

const path = require('winpath');
path.winPath("c://desktop://");

API