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

find-pkg

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-pkg - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

30

index.js

@@ -1,30 +0,6 @@

/*!
* find-pkg <https://github.com/jonschlinkert/find-pkg>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
/**
* Module dependencies
*/
const find = require('find-file-up');
var findFile = require('find-file-up');
/**
* Find package.json, starting with the given directory
*/
module.exports = function(dir, limit, cb) {
return findFile('package.json', dir, limit, cb);
};
/**
* Sync
*/
module.exports.sync = function(dir, limit) {
return findFile.sync('package.json', dir, limit);
};
module.exports = find.bind(null, 'package.json');
module.exports.sync = find.sync.bind(null, 'package.json');

35

package.json
{
"name": "find-pkg",
"description": "Find the first directory with a package.json, recursing up, starting with the given directory. Similar to look-up but does not support globs and only searches for package.json. Async and sync.",
"version": "1.0.0",
"version": "2.0.0",
"homepage": "https://github.com/jonschlinkert/find-pkg",

@@ -17,3 +17,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"engines": {
"node": ">=0.10.0"
"node": ">=8"
},

@@ -24,9 +24,9 @@ "scripts": {

"dependencies": {
"find-file-up": "^1.0.2"
"find-file-up": "^2.0.1"
},
"devDependencies": {
"delete": "^1.0.1",
"gulp-format-md": "^0.1.12",
"mocha": "^3.4.1",
"resolve-dir": "^1.0.0"
"delete": "^1.1.0",
"gulp-format-md": "^1.0.0",
"mocha": "^3.5.3",
"resolve-dir": "^1.0.1"
},

@@ -47,16 +47,2 @@ "keywords": [

"verb": {
"related": {
"list": [
"find-file-up",
"load-module-pkg",
"load-pkg",
"look-up",
"module-root"
]
},
"reflinks": [
"find-file-up",
"look-up",
"verb"
],
"toc": false,

@@ -70,2 +56,9 @@ "layout": "default",

],
"related": {
"list": [
"find-file-up",
"findup-sync",
"global-modules"
]
},
"lint": {

@@ -72,0 +65,0 @@ "reflinks": true

@@ -5,2 +5,4 @@ # find-pkg [![NPM version](https://img.shields.io/npm/v/find-pkg.svg?style=flat)](https://www.npmjs.com/package/find-pkg) [![NPM monthly downloads](https://img.shields.io/npm/dm/find-pkg.svg?style=flat)](https://npmjs.org/package/find-pkg) [![NPM total downloads](https://img.shields.io/npm/dt/find-pkg.svg?style=flat)](https://npmjs.org/package/find-pkg) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/find-pkg.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/find-pkg)

Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
## Install

@@ -17,10 +19,38 @@

```js
var findPkg = require('find-pkg');
const findPkg = require('find-pkg');
```
findPkg('.', function(err, fp) {
//=> /User/jonschlinkert/dev/find-pkg/package.json
**promise**
```js
findPkg('a/b/c/some/path')
.then(file => console.log(file)) //=> /User/jonschlinkert/dev/a/b/package.json
.catch(console.error);
```
**async-await**
```js
(async function() {
const file = await findPkg('a/b/c/some/path');
console.log(file);
//=> '/Users/jonschlinkert/dev/a/b/package.json'
})();
```
**callback**
```js
findPkg('a/b/c/some/path', function(err, file) {
if (err) throw err;
console.log(file);
//=> '/Users/jonschlinkert/dev/a/b/package.json'
});
```
var fp = findPkg.sync('.');
//=> /User/jonschlinkert/dev/find-pkg/package.json
**sync**
```js
const file = findPkg.sync('a/b/c/some/path');
//=> '/Users/jonschlinkert/dev/a/b/package.json'
```

@@ -30,16 +60,23 @@

### Related projects
<details>
<summary><strong>Contributing</strong></summary>
* [find-file-up](https://www.npmjs.com/package/find-file-up): Find a file, starting with the given cwd and recursively searching up one directory until… [more](https://github.com/jonschlinkert/find-file-up) | [homepage](https://github.com/jonschlinkert/find-file-up "Find a file, starting with the given cwd and recursively searching up one directory until it's found (or we run out of directories). Async and sync.")
* [load-module-pkg](https://www.npmjs.com/package/load-module-pkg): Load the package.json for any project currently installed in node_modules. | [homepage](https://github.com/jonschlinkert/load-module-pkg "Load the package.json for any project currently installed in node_modules.")
* [load-pkg](https://www.npmjs.com/package/load-pkg): Loads the package.json from the root of the user's current project. | [homepage](https://github.com/jonschlinkert/load-pkg "Loads the package.json from the root of the user's current project.")
* [look-up](https://www.npmjs.com/package/look-up): Faster drop-in replacement for find-up and findup-sync. | [homepage](https://github.com/jonschlinkert/look-up "Faster drop-in replacement for find-up and findup-sync.")
* [module-root](https://www.npmjs.com/package/module-root): Get the resolved path the root (directory) of a package installed in node_modules. | [homepage](https://github.com/jonschlinkert/module-root "Get the resolved path the root (directory) of a package installed in node_modules.")
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Contributing
</details>
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
<details>
<summary><strong>Running Tests</strong></summary>
### Building docs
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```
</details>
<details>
<summary><strong>Building docs</strong></summary>
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_

@@ -53,10 +90,12 @@

### Running tests
</details>
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
### Related projects
```sh
$ npm install && npm test
```
You might also be interested in these projects:
* [find-file-up](https://www.npmjs.com/package/find-file-up): Find a file fast, by starting at the given cwd and recursing up one directory… [more](https://github.com/jonschlinkert/find-file-up) | [homepage](https://github.com/jonschlinkert/find-file-up "Find a file fast, by starting at the given cwd and recursing up one directory until the file is found or we run out of directories.")
* [findup-sync](https://www.npmjs.com/package/findup-sync): Find the first file matching a given pattern in the current directory or the nearest… [more](https://github.com/js-cli/node-findup-sync#readme) | [homepage](https://github.com/js-cli/node-findup-sync#readme "Find the first file matching a given pattern in the current directory or the nearest ancestor directory.")
* [global-modules](https://www.npmjs.com/package/global-modules): The directory used by npm for globally installed npm modules. | [homepage](https://github.com/jonschlinkert/global-modules "The directory used by npm for globally installed npm modules.")
### Author

@@ -66,8 +105,9 @@

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
* [GitHub Profile](https://github.com/jonschlinkert)
* [Twitter Profile](https://twitter.com/jonschlinkert)
### License
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

@@ -77,2 +117,2 @@

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 20, 2017._
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on March 28, 2018._

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