{"id":19837156,"url":"https://github.com/smaug6739/data-bit","last_synced_at":"2025-11-22T17:04:03.362Z","repository":{"id":104407519,"uuid":"392630619","full_name":"Smaug6739/data-bit","owner":"Smaug6739","description":"This project is a module for converting a structured dataset into a number that can be stored in a database taking up little space.","archived":false,"fork":false,"pushed_at":"2021-11-02T17:34:40.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T22:12:05.447Z","etag":null,"topics":["bits","data","nodejs"],"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/Smaug6739.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-04T09:37:38.000Z","updated_at":"2021-11-28T14:31:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"eae4eace-e978-4a69-909c-ccd4a600e42d","html_url":"https://github.com/Smaug6739/data-bit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Smaug6739/data-bit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smaug6739%2Fdata-bit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smaug6739%2Fdata-bit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smaug6739%2Fdata-bit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smaug6739%2Fdata-bit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Smaug6739","download_url":"https://codeload.github.com/Smaug6739/data-bit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smaug6739%2Fdata-bit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285826030,"owners_count":27238110,"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","status":"online","status_checked_at":"2025-11-22T02:00:05.934Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bits","data","nodejs"],"created_at":"2024-11-12T12:13:41.037Z","updated_at":"2025-11-22T17:04:03.357Z","avatar_url":"https://github.com/Smaug6739.png","language":"JavaScript","readme":"# Data-bits\n\nThis project is a module for converting a structured dataset into a number that can be stored in a database taking up little space.\n\n## Getting started\n\n### Installation\n\nWith npm :\n\n```sh-session\nnpm install data-bits\n```\n\nWith yarn\n\n```js\nyarn add data-bits\n```\n\n## Usage\n\n### Import the module\n\nCommonJS syntax\n\n```js\nconst { DataBits } = require(\"data-bits\");\n```\n\nWith ES modules syntax :\n\n```js\nimport { DataBits } from \"data-bits\";\n```\n\nCreate a new instance of class DataBits with an array of data (string) and the bits of user (number) (optional).\n\n```js\nconst DataManager = new DataBits([\"FLAG_1\", \"FLAG_2\", \"FLAG_3\"]);\n```\n\n## DataBits.default\n\nReturn the default manager bits as a integer.\n\nType : Number\n\n## DataBits.MAX\n\nReturn the max bit as a string (an addition of the value of each flag).\n\nType : String\n\n## DataBits.bits\n\nReturns the bits of the collection (has a string).\n\nType : String\n\n## DataBits#find(name)\n\nFind the FLAG object by name or value\n\nParams :\n\n- name : The name or value of flag (string|number or Array\\\u003cstring|number\u003e)\n\nReturn :\n\n- The flag (Array\\\u003cObject\u003e or empty array)\n\n```js\nconsole.log(DataManager.find(4));\n```\n\n## DataBits#toArray()\n\nReturn an array of name of flags of the collection\n\nReturn :\n\nArray\\\u003cstring\u003e\n\n```js\nconsole.log(DataManager.toArray());\n```\n\n## DataBits#toString()\n\nReturn a string of names of flags of the collection (separate by `,` )\n\nReturn :\n\nString\n\n```js\nconsole.log(DataManager.toString());\n```\n\n## DataBits#hasAnyflag()\n\nReturn true if collection contains at least one value.\n\nReturn :\n\nBoolean\n\n```js\nconsole.log(DataManager.hasAnyflag());\n```\n\n## DataBits#has(flag)\n\nReturn true if user have permission(s).\n\nParams :\n\n- flag : The flag to check (Array, String, Number)\n\nReturn :\n\nBoolean\n\n```js\nconsole.log(DataManager.has([\"FLAG_1\"]));\n```\n\n## DataBits#missing(flag)\n\nReturn the missing(s) flag(s) of collection in the parameter.\n\nParams :\n\n- flag : The flag to check (Array, String, Number)\n\nReturn :\n\nFlag | null\n\n```js\nconsole.log(DataManager.missing([\"3\"]));\n```\n\n## DataBits#equals(other)\n\nReturn true if collection flags are equal to parameter.\n\nParams :\n\n- other : The compared (Array, String, Number)\n\nReturn :\n\nBoolean\n\n```js\nconsole.log(DataManager.equals([1, 4]));\n```\n\n## DataBits#addAllFlags()\n\nAdd all flags from collection.\n\nReturn :\n\nString (the new bits flags)\n\n```js\nconsole.log(DataManager.addAllFlags());\n```\n\n## DataBits#add(flags)\n\nAdd flag(s) from collection.\n\nParams :\n\n- flags : The flags to add (String, Number, Array)\n\nReturn :\n\nString (the new bits flags)\n\n```js\nconsole.log(DataManager.add(\"FLAG_1\"));\n```\n\n## DataBits#removeAllFlags()\n\nRemove all flags from collection.\n\nReturn :\n\nString (the new bits flags)\n\n```js\nconsole.log(DataManager.removeAllFlags());\n```\n\n## DataBits#remove(flags)\n\nRemove flag(s) from collection.\n\nParams :\n\n- flags : The flags to remove (String, Number, Array)\n\nReturn :\n\nString (the new bits flags)\n\n```js\nconsole.log(DataManager.remove(\"FLAG_1\"));\n```\n\n## Example\n\nSee the [example file](./EXAMPLE.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmaug6739%2Fdata-bit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmaug6739%2Fdata-bit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmaug6739%2Fdata-bit/lists"}