Skip to content

mrjoelkemp/is-relative-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

is-relative-path npm npm

Sometimes I just want to scream

npm install is-relative-path

Usage

isRelative(path)

  • path <string>
  • Returns: <boolean>
var isRelative = require('is-relative-path');

isRelative('../'); // true
isRelative('/'); // false

Breaking change

Code

Version Code
1.x (path) => path[0] === '.'
2.x (path) => !path.isAbsolute(path)

Test

path v1.x v2.x
"" false true
"." true true
".." true true
"foo" false true
"/foo" false false

About

Why the fuck does the path module not have this?

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •