2.0.0 • Published 6 years ago

is-dir-like-path v2.0.0

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

is-dir-like-path

npm version Build Status Build status Coverage Status

Check if a given string looks like a directory path

const isDirLikePath = require('is-dir-like-path');

isDirLikePath('foo'); //=> false
isDirLikePath('foo/'); //=> true

Installation

Use npm.

npm install is-dir-like-path

API

const isDirLikePath = require('is-dir-like-path');

isDirLikePath(str)

str: string (path)
Return: boolean

It returns true if the last character of a given string is equal to path.sep.

// On POSIX
isDirLikePath('dir\\'); //=> false

// On Windows
isDirLikePath('dir\\'); //=> true

isDirLikePath.posix(str)

str: string (path)
Return: boolean

Always interact in a posix compatible way.

isDirLikePath.posix('dir\\'); //=> false

isDirLikePath.win32(str)

str: string (path)
Return: boolean

isDirLikePath.win32('dir\\'); //=> true

Always interact in a win32 compatible way.

License

ISC License © 2018 Shinnosuke Watanabe