Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/find-up/index.js')
-rw-r--r--node_modules/find-up/index.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/node_modules/find-up/index.js b/node_modules/find-up/index.js
index 939c9553d..8e83819ce 100644
--- a/node_modules/find-up/index.js
+++ b/node_modules/find-up/index.js
@@ -2,11 +2,9 @@
const path = require('path');
const locatePath = require('locate-path');
-module.exports = (filename, opts) => {
- opts = opts || {};
-
+module.exports = (filename, opts = {}) => {
const startDir = path.resolve(opts.cwd || '');
- const root = path.parse(startDir).root;
+ const {root} = path.parse(startDir);
const filenames = [].concat(filename);
@@ -25,11 +23,9 @@ module.exports = (filename, opts) => {
});
};
-module.exports.sync = (filename, opts) => {
- opts = opts || {};
-
+module.exports.sync = (filename, opts = {}) => {
let dir = path.resolve(opts.cwd || '');
- const root = path.parse(dir).root;
+ const {root} = path.parse(dir);
const filenames = [].concat(filename);
@@ -39,7 +35,9 @@ module.exports.sync = (filename, opts) => {
if (file) {
return path.join(dir, file);
- } else if (dir === root) {
+ }
+
+ if (dir === root) {
return null;
}