Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-subdir

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-subdir - npm Package Compare versions

Comparing version 1.0.3 to 1.1.1

index.d.ts

7

index.js
'use strict'
const betterPathResolve = require('better-path-resolve')
const path = require('path')
module.exports = function (parent, dir) {
const rParent = betterPathResolve(parent)
const rDir = betterPathResolve(dir)
module.exports = function isSubdir (parentDir, subdir) {
const rParent = `${betterPathResolve(parentDir)}${path.sep}`
const rDir = `${betterPathResolve(subdir)}${path.sep}`
return rDir.startsWith(rParent)
}
{
"name": "is-subdir",
"version": "1.0.3",
"description": "Return whether a directory is a subdirectory of another directory",
"main": "index.js",
"files": [
"index.js"
],
"scripts": {
"test": "mos t && node test",
"md": "mos"
},
"engines": {
"node": ">=4"
},
"repository": "https://github.com/zkochan/packages/tree/master/is-subdir",
"keywords": [
"subdirectory",
"subfolder",
"subpath",
"directory",
"folder",
"path"
],
"author": {
"name": "Zoltan Kochan",
"url": "https://www.kochan.io"
},
"mos": {
"plugins": [
"readme"
],
"installation": {
"useShortAlias": true
}
},
"license": "MIT",
"homepage": "https://github.com/zkochan/packages/tree/master/is-subdir#readme",
"devDependencies": {
"is-windows": "1.0.2",
"mos": "^2.0.0-alpha.3",
"mos-plugin-readme": "^1.0.4",
"tape": "^4.6.3"
},
"dependencies": {
"better-path-resolve": "1.0.0"
}
"name": "is-subdir",
"version": "1.1.1",
"description": "Return whether a directory is a subdirectory of another directory",
"main": "index.js",
"files": [
"index.js",
"index.d.ts"
],
"scripts": {
"test": "node test",
"md": "mos"
},
"engines": {
"node": ">=4"
},
"repository": "https://github.com/zkochan/packages/tree/master/is-subdir",
"keywords": [
"subdirectory",
"subfolder",
"subpath",
"directory",
"folder",
"path"
],
"author": {
"name": "Zoltan Kochan",
"url": "https://www.kochan.io"
},
"mos": {
"plugins": [
"readme"
],
"installation": {
"useShortAlias": true
}
},
"license": "MIT",
"homepage": "https://github.com/zkochan/packages/tree/master/is-subdir#readme",
"devDependencies": {
"is-windows": "1.0.2",
"mos": "^2.0.0-alpha.3",
"mos-plugin-readme": "^1.0.4",
"tape": "^4.6.3"
},
"dependencies": {
"better-path-resolve": "1.0.0"
}
}

@@ -11,6 +11,8 @@ # is-subdir

Returns `true` when the directories match.
## Installation
```sh
npm i -S is-subdir
<npm|yarn|pnpm> add is-subdir
```

@@ -29,4 +31,8 @@

## API
### `isSubdir(parentDir, subdir): boolean`
## License
[MIT](./LICENSE) © [Zoltan Kochan](https://www.kochan.io)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc