{"id":16003092,"url":"https://github.com/fraxken/frequencyset","last_synced_at":"2025-03-17T16:30:26.358Z","repository":{"id":57241721,"uuid":"297177760","full_name":"fraxken/FrequencySet","owner":"fraxken","description":"A set that keeps the frequency of occurrences.","archived":false,"fork":false,"pushed_at":"2024-11-01T15:47:45.000Z","size":225,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T01:19:16.299Z","etag":null,"topics":["ecmascript","es6","frequencyset","set"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fraxken.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-20T22:53:09.000Z","updated_at":"2024-08-11T14:06:44.000Z","dependencies_parsed_at":"2024-10-27T15:18:26.178Z","dependency_job_id":"2555bebd-1e66-43fb-8be2-6a4a70ad55d0","html_url":"https://github.com/fraxken/FrequencySet","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":"0.050000000000000044","last_synced_commit":"3c495e38b57558b18b18863a91c3115dbdedf864"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraxken%2FFrequencySet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraxken%2FFrequencySet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraxken%2FFrequencySet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraxken%2FFrequencySet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fraxken","download_url":"https://codeload.github.com/fraxken/FrequencySet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243869601,"owners_count":20361042,"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":["ecmascript","es6","frequencyset","set"],"created_at":"2024-10-08T10:06:15.384Z","updated_at":"2025-03-17T16:30:25.910Z","avatar_url":"https://github.com/fraxken.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003ch1 align=\"center\"\u003e\n  FrequencySet\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  An ES6 Set compliant structure that keeps the frequency of occurrences.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/fraxken/FrequencySet\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/dynamic/json.svg?url=https://raw.githubusercontent.com/fraxken/FrequencySet/master/package.json\u0026query=$.version\u0026label=Version\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/fraxken/FrequencySet\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Maintained%3F-yes-green.svg\" alt=\"maintenance\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/fraxken/FrequencySet\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/license/mashape/apistatus.svg\" alt=\"license\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/fraxken/FrequencySet\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/workflow/status/fraxken/FrequencySet/Node.js%20CI\" alt=\"githubaction\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## Requirements\n- [Node.js](https://nodejs.org/en/) v20 or higher\n\n## Getting Started\n\nThis package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).\n\n```bash\n$ npm i frequency-set\n# or\n$ yarn add frequency-set\n```\n\n## Usage example\n\n```js\nconst FrequencySet = require(\"frequency-set\");\n\nconst MySet = new FrequencySet([\"foo\", \"bar\"]);\nMySet.add(\"foo\");\nMySet.add(\"foo\");\nMySet.add(\"bar\");\n\nconsole.log([...MySet.entries()]); // [[\"foo\", 3], [\"bar\", 2]]\n\nconst clone = new FrequencySet(MySet);\nconsole.log(clone);\n```\n\n## API\nFrequencySet implements exactly the same interfaces as an ES6 [Set](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Set). Except for the **@@ Iteration Symbol** and the **entries()**. Instead of returning the unique value as key and value, FrequencySet return the unique value as key and the count as value.\n\n```js\nconst mySet = new FrequencySet([\"foo\", \"foo\", \"bar\"]);\n\nfor (const [uniqueValue, count] of mySet) {\n    console.log([uniqueValue, count]); // [foo, 2] and [bar, 1]\n}\n```\n\nAlso the add method has been extended with a additional `count` argument witch take a number.\n```js\nconst mySet = new FrequencySet().add(\"foo\", 10);\n\nconsole.log(mySet.toJSON()); // [\"foo\", 10]\n```\n\n### toJSON()\nFrequencySet implement a custom toJSON() method which will allow an automatic transformation into JSON.\n\n```js\nconst mySet = new FrequencySet([\"foo\", \"foo\", \"bar\"]);\n\nconsole.log(mySet.toJSON()); // [foo, 2] and [bar, 1];\n```\n\nThe toJSON method does not take into account **functions** and **objects**.\n\n## Contributors ✨\n\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://www.linkedin.com/in/thomas-gentilhomme/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/4438263?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eGentilhomme\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/fraxken/FrequencySet/commits?author=fraxken\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/fraxken/FrequencySet/issues?q=author%3Afraxken\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"https://github.com/fraxken/FrequencySet/pulls?q=is%3Apr+reviewed-by%3Afraxken\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e \u003ca href=\"https://github.com/fraxken/FrequencySet/commits?author=fraxken\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#security-fraxken\" title=\"Security\"\u003e🛡️\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraxken%2Ffrequencyset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffraxken%2Ffrequencyset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraxken%2Ffrequencyset/lists"}