Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

is-inside

1.0.4 • Public • Published

is-inside

This simple lib checks whether the path is inside the directory or not.

Installation

npm i --save is-inside

Usage

const isInside = require('is-inside');

console.log(isInside('folder/file', 'folder')); // true
console.log(isInside('file', '/')); // true
console.log(isInside('file', 'folder')); // false

Comparison of paths

How the library compares paths can be viewed in test.js file.

Dependencies

The library depends only on Node's path module. There are no external dependencies.

TypeScript

You can use it with TypeScript thanks to the added d.ts file.

Install

npm i is-inside

DownloadsWeekly Downloads

3

Version

1.0.4

License

MIT

Last publish

Collaborators

  • avatar