{"size": 490, "ext": "js", "max_stars_repo_path": "src/array/_cheaprecreate.js", "max_stars_repo_name": "justinlew/matreshka", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/array/_cheaprecreate.js", "max_issues_repo_name": "justinlew/matreshka", "max_issues_repo_issues_event_min_datetime": "2022-03-02T12:16:16.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T12:16:16.000Z", "max_forks_repo_path": "src/array/_cheaprecreate.js", "max_forks_repo_name": "justinlew/matreshka", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 25.7894736842, "max_line_length": 92, "alphanum_fraction": 0.6204081633}
// makes cheap array recreation (with no trackBy, with no events, with no item mediator etc)
export default function cheapRecreate(self, newItems = []) {
    const newLength = newItems.length;
    const oldLength = self.length;
    const lengthDiff = newLength - oldLength;

    for (let i = 0; i < newLength; i++) {
        self[i] = newItems[i];
    }

    for (let i = 0; i < lengthDiff; i++) {
        delete self[i + newLength];
    }

    self.length = newLength;

    return self;
}
