{"size": 656, "ext": "js", "max_stars_repo_path": "src/carbon-dating.js", "max_stars_repo_name": "MrDreMeR/basic-js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/carbon-dating.js", "max_issues_repo_name": "MrDreMeR/basic-js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/carbon-dating.js", "max_forks_repo_name": "MrDreMeR/basic-js", "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": 36.4444444444, "max_line_length": 126, "alphanum_fraction": 0.7012195122}
const CustomError = require("../extensions/custom-error");

const MODERN_ACTIVITY= 15; 
const HALF_LIFE_PERIOD= 5730;

module.exports = function dateSample(sampleActivity) {
  const toString = Object.prototype.toString;
  // console.log('class peremennoi ======' + toString.call(sampleActivity));
  const activity = +sampleActivity;
  // console.log('activity === ' + activity);

  if (toString.call(sampleActivity) !== '[object String]' || isNaN(activity) || activity <= 0 || activity > MODERN_ACTIVITY) {
    // console.log('wrong arguments');
    return false;
  }

  return Math.ceil(Math.log(MODERN_ACTIVITY / activity) * HALF_LIFE_PERIOD / 0.693);
};