{"id":24438697,"url":"https://github.com/anower77/practice-js-","last_synced_at":"2025-03-14T00:13:11.831Z","repository":{"id":264868000,"uuid":"894528502","full_name":"Anower77/Practice-JS-","owner":"Anower77","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-26T14:12:42.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T19:17:28.946Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Anower77.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-26T14:11:47.000Z","updated_at":"2024-11-26T14:12:45.000Z","dependencies_parsed_at":"2024-11-26T15:36:15.507Z","dependency_job_id":null,"html_url":"https://github.com/Anower77/Practice-JS-","commit_stats":null,"previous_names":["anower77/practice-js-"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anower77%2FPractice-JS-","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anower77%2FPractice-JS-/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anower77%2FPractice-JS-/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anower77%2FPractice-JS-/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Anower77","download_url":"https://codeload.github.com/Anower77/Practice-JS-/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243500800,"owners_count":20300774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-20T19:17:31.945Z","updated_at":"2025-03-14T00:13:11.651Z","avatar_url":"https://github.com/Anower77.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Savings Calculator\n\nThis is a simple savings calculator that takes in an array of payments and a living cost, calculates the total income after tax deductions for payments over a certain threshold, and returns the resulting savings. If the savings are less than the living cost, it advises the user to \"earn more.\"\n\n## Features\n- Calculates total income from an array of payments.\n- Deducts 20% tax from payments greater than or equal to 3000.\n- Compares the total income to the living cost to calculate savings.\n- Returns the amount of savings or advises to \"earn more\" if savings are insufficient.\n- Handles input validation for correct data types.\n\n## Function\n\n### `saving(payment, livingCost)`\nCalculates savings based on payments and living cost.\n\n#### Parameters:\n- `payment` (Array): An array of payments (numbers) made during the month.\n- `livingCost` (Number): The living cost for the month.\n\n#### Returns:\n- If the savings are greater than or equal to 0: Returns the savings amount.\n- If the savings are less than 0: Returns the string `\"earn more\"`.\n- If the input is invalid (non-array payments or non-number living cost): Returns the string `\"Invalid input\"`.\n\n## Example Usage\n\n```javascript\nconsole.log(saving([1000, 2000, 3000], 5400)); // Output: 0\nconsole.log(saving([1000, 2000, 2500], 5000)); // Output: 500\nconsole.log(saving([900, 2700, 3400], 10000)); // Output: \"earn more\"\nconsole.log(saving(100, [900, 2700, 3400])); // Output: \"Invalid input\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanower77%2Fpractice-js-","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanower77%2Fpractice-js-","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanower77%2Fpractice-js-/lists"}