{"id":26949805,"url":"https://github.com/explore-node-js/node.js-bytes-calculator","last_synced_at":"2025-04-02T22:17:47.601Z","repository":{"id":57192101,"uuid":"83978970","full_name":"explore-node-js/node.js-bytes-calculator","owner":"explore-node-js","description":"abstracted byte sequence calculator for node.js","archived":false,"fork":false,"pushed_at":"2019-05-03T15:32:50.000Z","size":60,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-07T19:38:45.224Z","etag":null,"topics":["abstraction","bitwise","bitwise-operators","calculator","javascript","nodejs","npm-package"],"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/explore-node-js.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-03-05T15:06:32.000Z","updated_at":"2022-04-16T12:41:13.000Z","dependencies_parsed_at":"2022-09-01T06:02:45.186Z","dependency_job_id":null,"html_url":"https://github.com/explore-node-js/node.js-bytes-calculator","commit_stats":null,"previous_names":["explore-node-js/node.js-byte-flag-calculator"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explore-node-js%2Fnode.js-bytes-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explore-node-js%2Fnode.js-bytes-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explore-node-js%2Fnode.js-bytes-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explore-node-js%2Fnode.js-bytes-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/explore-node-js","download_url":"https://codeload.github.com/explore-node-js/node.js-bytes-calculator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246899633,"owners_count":20851899,"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":["abstraction","bitwise","bitwise-operators","calculator","javascript","nodejs","npm-package"],"created_at":"2025-04-02T22:17:47.128Z","updated_at":"2025-04-02T22:17:47.591Z","avatar_url":"https://github.com/explore-node-js.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[ci.tests-master-badge]: https://circleci.com/gh/explore-node-js/node.js-bytes-calculator/tree/master.svg?style=svg\n[ci.tests-master]: https://circleci.com/gh/explore-node-js/node.js-bytes-calculator/tree/master\n[ci.coverage-master-badge]: https://codecov.io/gh/explore-node-js/node.js-bytes-calculator/branch/master/graph/badge.svg\n[ci.coverage-master]: https://codecov.io/gh/explore-node-js/node.js-bytes-calculator\n[npm.package-badge]: https://badge.fury.io/js/byte-sequence-calculator.svg\n[npm.package]: https://www.npmjs.com/package/byte-sequence-calculator\n\n# sequence-calculator\n\nabstract and easy way how to work with byte sequences in JS\n\n[![build][ci.tests-master-badge]][ci.tests-master]\n[![coverage][ci.coverage-master-badge]][ci.coverage-master]\n[![coverage][npm.package-badge]][npm.package]\n\n### how to install\n\n`$ npm i sequence-calculator` or `yarn add sequence-calculator`\n\n### software requirements\n\n* [node.js](https://nodejs.org/)\n* [npm](https://www.npmjs.com/)+ or [yarn](https://yarnpkg.com/)\n\n### used technologies\n\n* [jest](https://facebook.github.io/jest/) - only for tests\n\n### used services\n\n* [circle ci](https://circleci.com/dashboard)\n* [codecov](https://codecov.io/)\n* [code climate](https://codeclimate.com/)\n* [snyk](https://snyk.io/)\n\n### how to execute tests\n\n* `$ npm test`\n* to execute tests with coverage `npm test -- --coverage`\n\n### how to use\n\n```javascript\n/** ES6 */\nimport { hasSequence, addSequence, removeSequence } from 'sequence-calculator';\n/** commmonjs */\nconst { hasSequence, addSequence, removeSequence } = require('sequence-calculator');\n\n/** examples */\nhasSequence(255,  0x0f) -\u003e returns true {true}, as 0xFF {255} contains 0xF {15}\nhasSequence(0b10, 0o10) -\u003e returns false {false}, as 0x02 {2} do not contains 0x08 {8}\n\naddSequence(0x02, 0x02) -\u003e returns 0x02 {2}, as sequence 0x02 {2} already contains 0x01 {2}\naddSequence(0o01, 0b10) -\u003e returns 0x03 {3}, as sequence 0x01 {1} do not contain 0x02 {2}\n\nremoveSequence(0x00,  0x01) -\u003e returns 0x00 {0}, as 0x01 {1} is not present in 0x0 {0}\nremoveSequence(0o06,     2) -\u003e returns 0x04 {4}, as 0x02 {2} been dropped 0x06 {6} sequence\nremoveSequence(2,    0b110) -\u003e returns 0x00 {0}, as 0x06 {6} sequence contained 0x02 {2},\n                                                 which been removed from origin 0x02\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexplore-node-js%2Fnode.js-bytes-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexplore-node-js%2Fnode.js-bytes-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexplore-node-js%2Fnode.js-bytes-calculator/lists"}