Skip to content

luckydrq/node-path-extras

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-path-extras

NPM version build status Test coverage

extra utilities for path module of nodejs

API

path.contains(mainPath, subPath)

  var path = require('node-path-extras');
  console.log(path.contains('/a', '/a/b')); // true

path.within(subPath, mainPath)

opposite to path.contains

  var path = require('node-path-extras');
  console.log(path.within('/a/b', '/a')); // true

path.along(aPath, bPath /.../)

alias path.inpath

  var path = require('node-path-extras');
  console.log(path.along('/a/b/c', '/a/b', '/a/b/c/d')); // true

path.isRelative(aPath)

  var path = require('node-path-extras');
  console.log(path.isRelative('../a')); // true
  console.log(path.isRelative('/a'));   // false

path.isAbsolute(aPath)

  var path = require('node-path-extras');
  console.log(path.isAbsolute('../a')); // false
  console.log(path.isAbsolute('/a'));   // true

  // for windows
  console.log(path.isAbsolute('c:\a')); // true

path.unique(arr)

remove paths in the same route in an array

  var path = require('node-path-extras');
  console.log(path.unique(['/a/b', '/a', '/c'])); // ['/a', '/c']

Lisence

MIT

About

extra utilities for `path` module of nodejs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published