{"id":18273412,"url":"https://github.com/blinet/ratev","last_synced_at":"2025-04-09T03:40:27.194Z","repository":{"id":65537774,"uuid":"594273988","full_name":"blinet/ratev","owner":"blinet","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-28T02:52:09.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-01T18:30:07.796Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blinet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2023-01-28T02:47:14.000Z","updated_at":"2023-01-28T02:56:59.000Z","dependencies_parsed_at":"2023-02-15T14:00:59.655Z","dependency_job_id":null,"html_url":"https://github.com/blinet/ratev","commit_stats":null,"previous_names":["4i8/ratev"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blinet%2Fratev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blinet%2Fratev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blinet%2Fratev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blinet%2Fratev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blinet","download_url":"https://codeload.github.com/blinet/ratev/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247974584,"owners_count":21026742,"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":"2024-11-05T12:06:19.793Z","updated_at":"2025-04-09T03:40:27.166Z","avatar_url":"https://github.com/blinet.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\r\n\u003cbr\u003e\r\n  \u003cp\u003e\r\n \u003ca href=\"https://www.npmjs.com/package/ratev\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/ratev.svg?style=for-the-badge\" alt=\"NPM version\" /\u003e\u003c/a\u003e\r\n \u003ca href=\"https://www.npmjs.com/package/ratev\"\u003e\u003cimg src=\"https://img.shields.io/npm/dt/ratev.svg?maxAge=3600\u0026style=for-the-badge\" alt=\"NPM downloads\" /\u003e\u003c/a\u003e\r\n  \u003c/p\u003e\r\n\u003c/div\u003e\r\n\r\n# **rate value**\r\n\r\n**ratev is a simple rate value module to rate array of object and return value based on percent 0.1 or higher than 100**\r\n\r\n- [Installation](#installation)\r\n- [Example](#example)\r\n- [Methods](#methods)\r\n  - [push](#push)\r\n  - [edit](#edit)\r\n  - [delete](#delete)\r\n- [Properties](#properties)\r\n  - [value](#value)\r\n  - [data](#data)\r\n\r\n# **Installation**\r\n\r\n```sh-session\r\nnpm install ratev\r\nyarn add ratev\r\n```\r\n\r\n### CommonJS\r\n\r\n```js\r\nconst Ratev = require(\"ratev\");\r\nconst MyfirstRate = new Ratev();\r\n```\r\n\r\n### ES6\r\n\r\n```js\r\nimport Ratev from \"ratev\";\r\nconst MyfirstRate = new Ratev();\r\n```\r\n\r\n## **Example**\r\n\r\n```js\r\nconst Ratev = require(\"ratev\");\r\n//new Ratev support array of object or ...args of object\r\nconst MyfirstRate = new Ratev([\r\n  { rate: 90, value: \"BRONZE\" }, //90% chance to return BRONZE\r\n  { rate: 70, value: \"SILVER\" }, //70% chance to return SILVER\r\n  { rate: 50, value: \"GOLD\" }, //50% chance to return GOLD\r\n  {\r\n    rate: 20,\r\n    value: \"PLATINUM\", //20% chance to return PLATINUM\r\n  },\r\n  {\r\n    rate: 15,\r\n    value: \"DIAMOND\", //15% chance to return DIAMOND\r\n  },\r\n  {\r\n    rate: 10,\r\n    value: \"MASTER\", //10% chance to return MASTER\r\n  },\r\n  {\r\n    rate: 0.1,\r\n    value: \"GRANDMASTER\", //0.1% chance to return GRANDMASTER\r\n  },\r\n]);\r\nsetInterval(function () {\r\n  console.log(MyfirstRate.value); //return random value based on rate\r\n}, 1000);\r\n```\r\n\r\n\u003cbr\u003e\r\n\u003cbr\u003e\r\n\r\n## **Methods**\r\n\r\n### **`push`**\r\n\r\n\u003cbr\u003e\r\n\r\n#### push new value if ther duplicate value it will be replace with new rate\r\n\r\n```js\r\nMyfirstRate.push(...\u003cObjects\u003e);\r\n//or\r\nMyfirstRate.push([...\u003cObjects\u003e]);\r\n```\r\n\r\n### **EX**\r\n\r\n\u003cbr\u003e\r\n\r\n#### **push(...\\\u003cObjects\u003e);**\r\n\r\n```js\r\nMyfirstRate.push({ rate: 0.1, value: \"CHALLENGER\" });\r\n//return array of object with new value\r\n```\r\n\r\n#### **push([...\\\u003cObjects\u003e]);**\r\n\r\n```js\r\nMyfirstRate.push([\r\n  { rate: 0.1, value: \"CHALLENGER\" },\r\n  { rate: 0.1, value: \"GRANDMASTER\" },\r\n]);\r\n//return array of object with new value\r\n```\r\n\r\n### **`edit`**\r\n\r\n\u003cbr\u003e\r\n\r\n#### edit multiple rate by push new rate with same value\r\n\r\n### `same as push but it just edit rate`\r\n\r\n```js\r\nMyfirstRate.push(...\u003cObjects\u003e);\r\n//or\r\nMyfirstRate.push([...\u003cObjects\u003e]);\r\n```\r\n\r\n### **`delete`**\r\n\r\n\u003cbr\u003e\r\n\r\n#### delete object from array of object by value you can delete multiple value by passing multiple value\r\n\r\n```js\r\nMyfirstRate.delete(...\u003cvalus\u003e);\r\n```\r\n\r\n### **EX**\r\n\r\n\u003cbr\u003e\r\n\r\n```js\r\nMyfirstRate.delete(\"BRONZE\", \"SILVER\", \"GOLD\");\r\n//return array of object without BRONZE,SILVER,GOLD\r\n```\r\n\r\n## **Properties**\r\n\r\n### **`value`**\r\n\r\n\u003cbr\u003e\r\n\r\n#### return random value based on rate\r\n\r\n```js\r\nMyfirstRate.value;\r\n```\r\n\r\n### **`data`**\r\n\r\n\u003cbr\u003e\r\n\r\n#### return array of object\r\n\r\n```js\r\nMyfirstRate.data;\r\n```\r\n\r\n## Links\r\n\r\n- [Twiter](https://twitter.com/onlyarth)\r\n- [Github](https://github.com/4i8)\r\n\r\n## License\r\n\r\n- [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblinet%2Fratev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblinet%2Fratev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblinet%2Fratev/lists"}