{"id":48071783,"url":"https://github.com/snowfluke/ip-calc-regex","last_synced_at":"2026-04-04T14:43:40.520Z","repository":{"id":57276412,"uuid":"371557020","full_name":"snowfluke/ip-calc-regex","owner":"snowfluke","description":"NPM Package IP calculator based on (Netmask/CIDR/Host) with regex validation (Javascript).","archived":false,"fork":false,"pushed_at":"2025-10-02T10:31:43.000Z","size":9,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-05T17:27:54.509Z","etag":null,"topics":["ipaddress","ipcalc","ipv4","mini-project","network","npm","regex"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snowfluke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-28T02:24:37.000Z","updated_at":"2025-10-02T10:31:46.000Z","dependencies_parsed_at":"2022-08-26T12:33:14.745Z","dependency_job_id":null,"html_url":"https://github.com/snowfluke/ip-calc-regex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/snowfluke/ip-calc-regex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowfluke%2Fip-calc-regex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowfluke%2Fip-calc-regex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowfluke%2Fip-calc-regex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowfluke%2Fip-calc-regex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snowfluke","download_url":"https://codeload.github.com/snowfluke/ip-calc-regex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowfluke%2Fip-calc-regex/sbom","scorecard":{"id":834935,"data":{"date":"2025-08-11","repo":{"name":"github.com/snowfluke/ip-calc-regex","commit":"f818d6c52c49f6ef33da24b0999c9c8c66e0bad7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-23T18:44:43.912Z","repository_id":57276412,"created_at":"2025-08-23T18:44:43.912Z","updated_at":"2025-08-23T18:44:43.912Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31403459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ipaddress","ipcalc","ipv4","mini-project","network","npm","regex"],"created_at":"2026-04-04T14:43:40.047Z","updated_at":"2026-04-04T14:43:40.515Z","avatar_url":"https://github.com/snowfluke.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ip-calc-regex\n\nIP Calculator based on Netmask/CIDR/Host with regex validation.\n\n## Installation\n\n```bash\nnpm install ip-calc-regex --save\n```\n\n## Usage\n\n```js\n// ES6 import\nimport { ipCalc } from 'ip-calc-regex';\n\n// CommonJS require\nconst { ipCalc } = require('ip-calc-regex');\n\n// Example: Calculate using CIDR notation\nconst result = ipCalc('192.168.1.1', 1, '24');\nconsole.log(result);\n```\n\n### Output\n\n```js\n{\n  'IP Address': '192.168.1.1',\n  'Netmask': '255.255.255.0',\n  'CIDR': '/24',\n  'Wildcard': '0.0.0.255',\n  'Class': 'Class C',\n  'Network Address': '192.168.1.0',\n  'Host min': '192.168.1.1',\n  'Host max': '192.168.1.254',\n  'Broadcast': '192.168.1.255',\n  'Total Subnets': 256,\n  'Total Hosts': '254'\n}\n```\n\n### Error Handling\n\nIf invalid input is provided, the function returns an error object:\n\n```js\n{\n  errorMsg: 'Invalid IP Address!' // or other error message\n}\n```\n\n## API\n\n### `ipCalc(ipAddress, type, typeValue)`\n\n#### Parameters\n\n| Parameter | Type | Description | Values |\n|-----------|------|-------------|--------|\n| `ipAddress` | string | IPv4 address | e.g., `'192.168.100.1'` |\n| `type` | number | Input type | `0` = Netmask\u003cbr\u003e`1` = CIDR\u003cbr\u003e`2` = Total Hosts |\n| `typeValue` | string | Value corresponding to the type | Depends on `type` parameter |\n\n#### Return Value\n\nReturns an object containing:\n- `IP Address`: Original IP address\n- `Netmask`: Subnet mask in dotted decimal notation\n- `CIDR`: CIDR notation (e.g., /24)\n- `Wildcard`: Wildcard mask\n- `Class`: IP address class (A, B, C, D, or E)\n- `Network Address`: Network address\n- `Host min`: First usable host address\n- `Host max`: Last usable host address\n- `Broadcast`: Broadcast address\n- `Total Subnets`: Total number of subnets\n- `Total Hosts`: Total usable hosts (formatted with dot separators)\n\nOr an error object with `errorMsg` property if validation fails.\n\n## Examples\n\n### Using Netmask (type = 0)\n\n```js\nipCalc('192.168.1.1', 0, '255.255.255.0')\n\n// Output:\n// {\n//   'IP Address': '192.168.1.1',\n//   'Netmask': '255.255.255.0',\n//   'CIDR': '/24',\n//   'Wildcard': '0.0.0.255',\n//   'Class': 'Class C',\n//   'Network Address': '192.168.1.0',\n//   'Host min': '192.168.1.1',\n//   'Host max': '192.168.1.254',\n//   'Broadcast': '192.168.1.255',\n//   'Total Subnets': 256,\n//   'Total Hosts': '254'\n// }\n```\n\n### Using CIDR Notation (type = 1)\n\n```js\nipCalc('172.20.78.0', 1, '24')\n\n// Output:\n// {\n//   'IP Address': '172.20.78.0',\n//   'Netmask': '255.255.255.0',\n//   'CIDR': '/24',\n//   'Wildcard': '0.0.0.255',\n//   'Class': 'Class B',\n//   'Network Address': '172.20.78.0',\n//   'Host min': '172.20.78.1',\n//   'Host max': '172.20.78.254',\n//   'Broadcast': '172.20.78.255',\n//   'Total Subnets': 65536,\n//   'Total Hosts': '254'\n// }\n```\n\n### Using Host Count (type = 2)\n\n```js\nipCalc('192.168.1.1', 2, '12')\n\n// Output:\n// {\n//   'IP Address': '192.168.1.1',\n//   'Netmask': '255.240.0.0',\n//   'CIDR': '/28',\n//   'Wildcard': '0.15.255.255',\n//   'Class': 'Class C',\n//   'Network Address': '192.160.0.0',\n//   'Host min': '192.160.0.1',\n//   'Host max': '192.175.255.254',\n//   'Broadcast': '192.175.255.255',\n//   'Total Subnets': 16,\n//   'Total Hosts': '14'\n// }\n```\n\n## Validation\n\nThe calculator validates:\n- **IP Address**: Must be a valid IPv4 address (0-255 for each octet)\n- **Netmask**: Must be a valid subnet mask\n- **CIDR**: Must be between 1 and 32\n- **Host Count**: Must be a positive integer\n\n## Features\n\n- ✅ Supports all IP classes (A, B, C, D, E)\n- ✅ Works with any valid CIDR notation (1-32)\n- ✅ Regex-based input validation\n- ✅ Calculates network address, broadcast, and host range\n- ✅ Computes total subnets and usable hosts\n- ✅ Well-documented code with JSDoc comments\n- ✅ No external dependencies\n\n## License\n\nISC\n\n## Author\n\nAwal Ariansyah\n\n## Repository\n\n[https://github.com/snowfluke/ip-calc-regex](https://github.com/snowfluke/ip-calc-regex)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowfluke%2Fip-calc-regex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnowfluke%2Fip-calc-regex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowfluke%2Fip-calc-regex/lists"}