UNPKG

297 BJavaScriptView Raw
1'use strict';
2const path = require('path');
3const findUp = require('find-up');
4
5module.exports = cwd => findUp('package.json', {cwd}).then(fp => fp ? path.dirname(fp) : null);
6
7module.exports.sync = cwd => {
8 const fp = findUp.sync('package.json', {cwd});
9 return fp ? path.dirname(fp) : null;
10};