'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _regenerator;

function _load_regenerator() {
  return _regenerator = _interopRequireDefault(require('babel-runtime/regenerator'));
}

var _firstline;

function _load_firstline() {
  return _firstline = _interopRequireDefault(require('firstline'));
}

var _constants;

function _load_constants() {
  return _constants = require('../constants');
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

/**
 * check if file was auto generated by bit
 *
 * @param {PathOsBased} filePath - consumer path
 * @returns {boolean}
 */
exports.default = function () {
  var _ref = _asyncToGenerator( /*#__PURE__*/(_regenerator || _load_regenerator()).default.mark(function _callee(filePath) {
    var line;
    return (_regenerator || _load_regenerator()).default.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            _context.next = 2;
            return (0, (_firstline || _load_firstline()).default)(filePath);

          case 2:
            line = _context.sent;
            return _context.abrupt('return', line.includes((_constants || _load_constants()).AUTO_GENERATED_STAMP));

          case 4:
          case 'end':
            return _context.stop();
        }
      }
    }, _callee, this);
  }));

  function isFileAutoGenerated(_x) {
    return _ref.apply(this, arguments);
  }

  return isFileAutoGenerated;
}();