You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
353 B
JavaScript

5 years ago
'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;
};