🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contains-path

Return true if a file path contains the given path.

1.0.0
latest
Version published
Weekly downloads
2.1M
-0.8%
Maintainers
1
Weekly downloads
 
Created

What is contains-path?

The contains-path npm package is used to determine if a given path is inside another path. It is a simple utility that can be used to check if a file or directory is contained within another directory, which can be useful for ensuring proper file structure, security checks, and more.

What are contains-path's main functionalities?

Check if a path contains another path

This feature allows you to check if one path is contained within another. It returns true if the first path is inside the second path, otherwise false.

const containsPath = require('contains-path');

console.log(containsPath('/a/b/c', '/a/b')); // true
console.log(containsPath('/a/b/c', '/x/y')); // false

Other packages similar to contains-path

FAQs

Package last updated on 17 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts