text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
  	value: true
  });
  
  var _path = require('path');
  
  var _path2 = _interopRequireDefault(_path);
  
  var _findUp = require('find-up');
  
  var _findUp2 = _interopRequireDefault(_findUp);
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  exports.default = toplevel;
  
  // Find the next git root
  // (start: string) => Promise<string | null>
  
  function toplevel(cwd) {
  	return new Promise(function ($return, $error) {
  		var found;
  		return Promise.resolve((0, _findUp2.default)('.git', { cwd })).then(function ($await_1) {
  			try {
  				found = $await_1;
  
  				if (typeof found !== 'string') {
  					return $return(found);
  				}
  
  				return $return(_path2.default.join(found, '..'));
  			} catch ($boundEx) {
  				return $error($boundEx);
  			}
  		}.bind(this), $error);
  	}.bind(this));
  }
  module.exports = exports['default'];
  //# sourceMappingURL=index.js.map