is-dir-like-path

Check if a given string looks like a directory path


Keywords
check, checker, if, boolean, dir, directory, dirname, name, path, string, posix, win32, match
License
ISC
Install
npm install is-dir-like-path@2.0.0

Documentation

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