{"size": 570, "ext": "js", "max_stars_repo_path": "api/actions/person/reset.js", "max_stars_repo_name": "andersryanc/react-universal-starter", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "api/actions/person/reset.js", "max_issues_repo_name": "andersryanc/react-universal-starter", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "api/actions/person/reset.js", "max_forks_repo_name": "andersryanc/react-universal-starter", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.75, "max_line_length": 66, "alphanum_fraction": 0.5087719298}
import Person from '../../models/person.js';
import initialPeople from './data.js';

export default function reset() {
  return new Promise((resolve, reject) => {
    Person.remove({}, (err) => {
      if ( err ) {
        console.info('Error: ' + err);
        reject();
      }

      initialPeople.map((person) => {
        const newPerson = new Person( person );
        newPerson.save((personErr) => {
          if ( personErr ) {
            console.info('Error saving new person: ' + personErr);
          }
        });
      });
      resolve();
    });
  });
}
