{"size": 373, "ext": "js", "max_stars_repo_path": "src/rotate$.js", "max_stars_repo_name": "yumetodo/extra-array", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/rotate$.js", "max_issues_repo_name": "yumetodo/extra-array", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/rotate$.js", "max_forks_repo_name": "yumetodo/extra-array", "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": 21.9411764706, "max_line_length": 58, "alphanum_fraction": 0.5978552279}
const copy$ = require('./copy$');
const modp = require('./_modp');

/**
 * Rotates values in array.
 * @param {Array} x an array (updated)
 * @param {number} n rotate amount (-ve: left, +ve: right)
 * @returns {Array} x
 */
function rotate$(x, n) {
  var n = modp(n, x.length);
  var y = x.slice(-n);
  x.copyWithin(n, 0);
  return copy$(x, y);
}
module.exports = rotate$;
