is-dir-like-path

Check if a given string looks like a directory path

Usage no npm install needed!

<script type="module">
  import isDirLikePath from 'https://cdn.skypack.dev/is-dir-like-path';
</script>

README

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