Socket
Socket
Sign inDemoInstall

pkg-dir

Package Overview
Dependencies
6
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 4.0.0

index.d.ts

12

index.js

@@ -5,7 +5,13 @@ 'use strict';

module.exports = cwd => findUp('package.json', {cwd}).then(fp => fp ? path.dirname(fp) : null);
const pkgDir = async cwd => {
const filePath = await findUp('package.json', {cwd});
return filePath ? path.dirname(filePath) : undefined;
};
module.exports = pkgDir;
module.exports.default = pkgDir;
module.exports.sync = cwd => {
const fp = findUp.sync('package.json', {cwd});
return fp ? path.dirname(fp) : null;
const filePath = findUp.sync('package.json', {cwd});
return filePath ? path.dirname(filePath) : undefined;
};
{
"name": "pkg-dir",
"version": "3.0.0",
"version": "4.0.0",
"description": "Find the root directory of a Node.js project or npm package",

@@ -13,9 +13,10 @@ "license": "MIT",

"engines": {
"node": ">=6"
"node": ">=8"
},
"scripts": {
"test": "xo && ava"
"test": "xo && ava && tsd-check"
},
"files": [
"index.js"
"index.js",
"index.d.ts"
],

@@ -51,5 +52,6 @@ "keywords": [

"devDependencies": {
"ava": "*",
"xo": "*"
"ava": "^1.3.1",
"tsd-check": "^0.3.0",
"xo": "^0.24.0"
}
}

@@ -43,7 +43,7 @@ # pkg-dir [![Build Status](https://travis-ci.org/sindresorhus/pkg-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/pkg-dir)

Returns a `Promise` for either the project root path or `null` if it couldn't be found.
Returns a `Promise` for either the project root path or `undefined` if it couldn't be found.
### pkgDir.sync([cwd])
Returns the project root path or `null`.
Returns the project root path or `undefined`.

@@ -50,0 +50,0 @@ #### cwd

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc