Big update!Announcing Socket for GitHub 1.0. Learn more
Socket
BlogLoveFAQ
Install
Log in

is-path-inside

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Issues
File Explorer

Advanced tools

is-path-inside

Check if a path is inside another path

    4.0.0latest

Version published
Maintainers
1
Weekly downloads
22,376,742
decreased by-3.87%

Weekly downloads

Changelog

Source

Breaking

  • Require Node.js 12 0a97f43
  • This package is now pure ESM. Please read this.

https://github.com/sindresorhus/is-path-inside/compare/v3.0.3...v4.0.0

Readme

Source

is-path-inside

Check if a path is inside another path

Install

$ npm install is-path-inside

Usage

import isPathInside from 'is-path-inside'; isPathInside('a/b/c', 'a/b'); //=> true isPathInside('a/b/c', 'x/y'); //=> false isPathInside('a/b/c', 'a/b/c'); //=> false isPathInside('/Users/sindresorhus/dev/unicorn', '/Users/sindresorhus'); //=> true

API

isPathInside(childPath, parentPath)

Note that relative paths are resolved against process.cwd() to make them absolute.

Important: This package is meant for use with path manipulation. It does not check if the paths exist nor does it resolve symlinks. You should not use this as a security mechanism to guard against access to certain places on the file system.

childPath

Type: string

The path that should be inside parentPath.

parentPath

Type: string

The path that should contain childPath.


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Keywords

FAQs

What is is-path-inside?

Check if a path is inside another path

Is is-path-inside popular?

The npm package is-path-inside receives a total of 18,093,396 weekly downloads. As such, is-path-inside popularity was classified as popular.

Is is-path-inside well maintained?

We found that is-path-inside demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 03 May 2021
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc