{"id":17771449,"url":"https://github.com/rootslab/toni","last_synced_at":"2025-05-12T23:44:32.366Z","repository":{"id":23936623,"uuid":"27317949","full_name":"rootslab/toni","owner":"rootslab","description":"Toni, a simple and efficient bitmap implementation for integer sets, using bitwise operations and a Buffer.","archived":false,"fork":false,"pushed_at":"2019-10-10T15:43:15.000Z","size":26,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-12T23:44:27.298Z","etag":null,"topics":["bitarray","bitmap","bitvector","bloom-filter","buffer","nodejs"],"latest_commit_sha":null,"homepage":null,"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/rootslab.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":"2014-11-29T23:10:04.000Z","updated_at":"2017-11-15T22:31:46.000Z","dependencies_parsed_at":"2022-08-22T08:11:12.605Z","dependency_job_id":null,"html_url":"https://github.com/rootslab/toni","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Ftoni","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Ftoni/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Ftoni/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootslab%2Ftoni/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rootslab","download_url":"https://codeload.github.com/rootslab/toni/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253843164,"owners_count":21972867,"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":["bitarray","bitmap","bitvector","bloom-filter","buffer","nodejs"],"created_at":"2024-10-26T21:33:00.316Z","updated_at":"2025-05-12T23:44:32.338Z","avatar_url":"https://github.com/rootslab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Toni\n\n[![NPM VERSION](http://img.shields.io/npm/v/toni.svg?style=flat)](https://www.npmjs.org/package/toni)\n[![CODACY BADGE](https://img.shields.io/codacy/b18ed7d95b0a4707a0ff7b88b30d3def.svg?style=flat)](https://www.codacy.com/public/44gatti/toni)\n[![CODECLIMATE-TEST-COVERAGE](https://img.shields.io/codeclimate/c/rootslab/toni.svg?style=flat)](https://codeclimate.com/github/rootslab/toni)\n[![LICENSE](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/rootslab/toni#mit-license)\n\n![NODE VERSION](https://img.shields.io/node/v/toni.svg)\n[![TRAVIS CI BUILD](http://img.shields.io/travis/rootslab/toni.svg?style=flat)](http://travis-ci.org/rootslab/toni)\n[![BUILD STATUS](http://img.shields.io/david/rootslab/toni.svg?style=flat)](https://david-dm.org/rootslab/toni)\n[![DEVDEPENDENCY STATUS](http://img.shields.io/david/dev/rootslab/toni.svg?style=flat)](https://david-dm.org/rootslab/toni#info=devDependencies)\n\n[![NPM MONTHLY](http://img.shields.io/npm/dm/toni.svg?style=flat)](http://npm-stat.com/charts.html?package=toni)\n![NPM YEARLY](https://img.shields.io/npm/dy/toni.svg)\n\n[![NPM GRAPH](https://nodei.co/npm/toni.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/toni/)\n\n\n\u003e __Toni__, a simple and efficient bitmap implementation for positive integer sets (max 32 bits),\n\u003e with no element repetition, using bitwise operations and a Buffer.\n\n\u003e Modifying a single bit instead of an entire byte, to signal item presence in the current set,\n\u003e obviously saves __87.5%__ of Buffer space.\n\n\u003e See [BitArray](http://en.wikipedia.org/wiki/Bit_array).\n\n### Install\n\n```bash\n$ npm install toni [-g]\n```\n\n\u003e __require__:\n\n```javascript\nvar Toni = require( 'toni' );\n```\n\n### Run Tests\n\n\u003e __to run all test files, install devDependencies:__\n\n```bash\n $ cd toni/\n # install or update devDependencies\n $ npm install \n # run tests\n $ npm test\n```\n\n### Run Benchmarks\n\n\u003e run benchmarks for __Toni__.\n\n```bash\n$ cd toni/\n$ npm run bench\n```\n\n### Constructor\n\n\u003e minimun range is 1 item/bit, max is 2^32 (from 1 to 4 bytes).\n\n```javascript\nToni( Number range )\n// or\nnew Toni( Number range )\n```\n\n### Properties\n\n```javascript\n /*\n  * the bitmap buffer.\n  */\n Toni.bitmap : Buffer\n\n /*\n  * max range for values (from 0 to range - 1).\n  */\n Toni.range : Number\n\n /*\n  * current items in the set.\n  */\n Toni.items : Number\n\n/*\n  * a shortcut for the bitmap buffer length.\n  */\n Toni.bmlen : Number\n\n```\n\n### Methods\n\n\u003e Arguments within [ ] are optional.\n\n```javascript\n/*\n * Clear the bitmap / set (filling with 0's).\n */\nToni#clear : function () : Toni\n\n/*\n * Check for item presence in the set.\n * It returns 1 if item is present, 0 otherwise.\n */\nToni#chk : function ( Number value ) : Number\n\n/*\n * Add an integer value to the set and test item/value presence in the set.\n * When the value is out of range, or if the element is already present, the\n * operation fails and it returns -1.\n *\n */\nToni#add : function ( Number value ) : Number\n\n/*\n * Remove an integer value from the set and test item/value presence in the set.\n * When the value is out of range, or if the element is not in the set,\n * the operation fails and it returns -1.\n */\nToni#del : function ( Number value ) : Number\n\n/*\n * It returns the occurrences of bit 1 until index i, then the total\n * number of 0s = index - rank( index ), if index is into the current\n * range, otherwise it returns -1\n */\nToni#rank : function ( Number index ) : Number\n```\n\n### MIT License\n\n\u003e Copyright (c) 2014-present \u0026lt; Guglielmo Ferri : 44gatti@gmail.com \u0026gt;\n\n\u003e Permission is hereby granted, free of charge, to any person obtaining\n\u003e a copy of this software and associated documentation files (the\n\u003e 'Software'), to deal in the Software without restriction, including\n\u003e without limitation the rights to use, copy, modify, merge, publish,\n\u003e distribute, sublicense, and/or sell copies of the Software, and to\n\u003e permit persons to whom the Software is furnished to do so, subject to\n\u003e the following conditions:\n\n\u003e __The above copyright notice and this permission notice shall be\n\u003e included in all copies or substantial portions of the Software.__\n\n\u003e THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\n\u003e EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\u003e MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n\u003e IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n\u003e CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n\u003e TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n\u003e SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootslab%2Ftoni","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frootslab%2Ftoni","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootslab%2Ftoni/lists"}