is-dir-like-path

2.0.0 • Public • Published

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

Package Sidebar

Install

npm i is-dir-like-path

Weekly Downloads

1

Version

2.0.0

License

ISC

Unpacked Size

4.22 kB

Total Files

4

Last publish

Collaborators

  • shinnn