{"size": 632, "ext": "js", "max_stars_repo_path": "9. Regular Expressions/1. Furniture.js", "max_stars_repo_name": "DemirevMartin/JavaScript-Fundamentals", "max_stars_repo_stars_event_min_datetime": "2021-11-09T18:19:26.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-09T18:19:26.000Z", "max_issues_repo_path": "9. Regular Expressions/1. Furniture.js", "max_issues_repo_name": "DemirevMartin/JavaScript-Fundamentals", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "9. Regular Expressions/1. Furniture.js", "max_forks_repo_name": "DemirevMartin/JavaScript-Fundamentals", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 37.1764705882, "max_line_length": 81, "alphanum_fraction": 0.5047468354}
function solve(arr) {
    const pattern = />>(?<item>[A-Za-z]+)<<(?<price>\d+\.?\d*)!(?<quantity>\d+)/;
    let sum = 0;
    console.log("Bought furniture:");
    for(let el of arr) {
        if(el === "Purchase") break;
        if((data = pattern.exec(el)) !== null) {
            const item = data.groups["item"];
            const price = data.groups["price"];
            const quantity = data.groups["quantity"];
            console.log(item);
            sum += price * quantity;
        }
    }
    console.log(`Total money spend: ${sum.toFixed(2)}`);
}
solve([">>Sofa<<312.23!3", ">>TV<<300!5", ">Invalid<<!5", "Purchase"]);