wallet-core/node_modules/pkg-dir/index.js

15 lines
353 B
JavaScript
Raw Normal View History

2017-05-28 00:38:50 +02:00
'use strict';
var path = require('path');
var findUp = require('find-up');
module.exports = function (cwd) {
return findUp('package.json', {cwd: cwd}).then(function (fp) {
return fp ? path.dirname(fp) : null;
});
};
module.exports.sync = function (cwd) {
var fp = findUp.sync('package.json', {cwd: cwd});
return fp ? path.dirname(fp) : null;
};