.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / node_modules / read-pkg-up / index.js
1 'use strict';
2 const findUp = require('find-up');
3 const readPkg = require('read-pkg');
4
5 module.exports = opts => {
6         return findUp('package.json', opts).then(fp => {
7                 if (!fp) {
8                         return {};
9                 }
10
11                 return readPkg(fp, opts).then(pkg => ({pkg, path: fp}));
12         });
13 };
14
15 module.exports.sync = opts => {
16         const fp = findUp.sync('package.json', opts);
17
18         if (!fp) {
19                 return {};
20         }
21
22         return {
23                 pkg: readPkg.sync(fp, opts),
24                 path: fp
25         };
26 };