{"size": 505, "ext": "js", "max_stars_repo_path": "js/coupon.js", "max_stars_repo_name": "c0llision/GameStore-gui-project-year-1", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "js/coupon.js", "max_issues_repo_name": "c0llision/GameStore-gui-project-year-1", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "js/coupon.js", "max_forks_repo_name": "c0llision/GameStore-gui-project-year-1", "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": 18.0357142857, "max_line_length": 63, "alphanum_fraction": 0.5227722772}
/*  coupon.js
    Coupon functionality */



function getCouponDiscount(code)
{
    /* get the discount associated with the code

      {param} code - string - Discount code
      {return} int - Percentage discount or 0 if no discount */

    coupons = [
        ['10off', 10],
        ['20off', 20],
    ]

    code = code.toLowerCase().trim();
    for (var i=0; i < coupons.length;i++)
    {
        if (coupons[i][0] == code)
        {
            return coupons[i][1];
        }
    }
    return 0;
}
