{"id":27115029,"url":"https://github.com/jhk1090/range-admin","last_synced_at":"2026-04-28T08:02:55.846Z","repository":{"id":231541878,"uuid":"782019619","full_name":"jhk1090/range-admin","owner":"jhk1090","description":"Range Admin - Effectively Managing Range","archived":false,"fork":false,"pushed_at":"2024-04-06T01:30:48.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-26T07:56:43.456Z","etag":null,"topics":["commonjs","compare","ecmascript","javascript","range","typescript","util"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/range-admin","language":"TypeScript","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/jhk1090.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2024-04-04T13:37:49.000Z","updated_at":"2024-04-05T11:07:39.000Z","dependencies_parsed_at":"2024-04-04T14:54:36.543Z","dependency_job_id":"19221192-8ab2-4937-9ed4-996a0e7d227d","html_url":"https://github.com/jhk1090/range-admin","commit_stats":null,"previous_names":["jhk1090/range-admin"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jhk1090/range-admin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhk1090%2Frange-admin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhk1090%2Frange-admin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhk1090%2Frange-admin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhk1090%2Frange-admin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhk1090","download_url":"https://codeload.github.com/jhk1090/range-admin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhk1090%2Frange-admin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32371673,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"online","status_checked_at":"2026-04-28T02:00:07.250Z","response_time":56,"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":["commonjs","compare","ecmascript","javascript","range","typescript","util"],"created_at":"2025-04-07T04:39:47.977Z","updated_at":"2026-04-28T08:02:55.806Z","avatar_url":"https://github.com/jhk1090.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Range Admin - Effectively Managing Range\n![license](https://img.shields.io/github/license/jhk1090/range-admin\n) \n![npm-version](https://img.shields.io/npm/v/range-admin)\n![GitHub last commit](https://img.shields.io/github/last-commit/jhk1090/range-admin)\n\n```js\nimport { Range } from \"range-admin\"\n\n(new Range(1, 10)).isEqual(new Range(1, 10)) // true\n(new Range(1, 10)).compare(new Range(5, 13)) // \"OVERLAP\"\n(new Range(1, 10)).findCommon(new Range(5, 10)) // new Range(5, 10)\n```\n\n```sh\n# npm\nnpm install range-admin\n\n# yarn\nyarn add range-admin\n```\n * Github Repository: https://github.com/jhk1090/range-admin\n * NPM Library: https://npmjs.com/package/range-admin\n---\n * [Feature](#feature)\n    * [Range](#range)\n    * [isEqual](#isequalranges-range)\n    * [isDisjoint](#isdisjointranges-range)\n    * [isSubset](#issubsetranges-range)\n    * [isSuperset](#issupersetranges-range)\n    * [isAdjacent](#isadjacentranges-range)\n    * [makeRangeArray](#makerangearrayrange-range--number-number-step-number)\n * [Contribution](#contribution)\n\n# Feature\n## Range\n```js\nnew Range(1, 10)\n```\n * ```toString()``` - Returns string representation of the range: start~end\n * [```toArray(step: number)```](#toarraystep-number) - Returns array based on the range\n * ```isEqual(otherRange: Range)``` - Check if two ranges are equal\n * ```isDisjoint(otherRange: Range)``` - Check if two ranges are disjoint (no relationship)\n * ```isSubsetOf(otherRange: Range)``` - Check if range is subset of otherRange (range is contained in otherRange)\n * ```isOverlap(otherRange: Range)``` - Check if two ranges are overlapped with each other\n * ```isAdjacent(otherRange: Range)``` - Check if two ranges are adjacent\n * [```compare(otherRange: Range)```](#compareotherrange-range) - Compare relationship with other range.\n * [```findCommon(otherRange: Range)```](#findcommonotherrange-range) - Find common part of the range with other range.\n### toArray(step: number)\n```js\n(new Range(1, 11)).toArray() // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n(new Range(0, 1001)).toArray(2) // [0, 2, 4, 6, ..., 998, 1000]\n```\n\n### compare(otherRange: Range)\n```js\n(new Range(3, 5)).compare(new Range(1, 4)) // \"OVERLAP\"\n(new Range(3, 5)).compare(new Range(1, 5)) // \"SUBSET\"\n```\n\nThe types of relationship are as follows: \"equal\", \"subset\", \"superset\", \"disjoint\", \"overlap\"\n\n### findCommon(otherRange: Range)\n```js\n(new Range(3, 5)).compare(new Range(1, 4)) // new Range(3, 4)\n(new Range(3, 5)).compare(new Range(9, 10)) // null\n```\n\n## isEqual(...ranges: Range[])\n```js\nconst range1 = new Range(1, 3)\nconst range2 = new Range(2, 5)\n\nisEqual(range1, range1, range1) // true\nisEqual(range2, range1, range1) // false\n```\nCheck if all the ranges are equal.\n\n## isDisjoint(...ranges: Range[])\n```js\nconst range1 = new Range(1, 3)\nconst range2 = new Range(3, 5)\n\nisDisjoint(range1, range2, new Range(9, 10)) // true\nisDisjoint(range1, range1, new Range(9, 10)) // false\n```\nCheck if all the ranges are disjoint.\n\n## isSubset(...ranges: Range[])\n```js\nisSubset(new Range(1, 3), new Range(1, 8)) // false (2nd range is superset of 1st range)\nisSubset(new Range(1, 100), new Range(1, 10), new Range(1, 2)) // true\n```\nCheck if the range is subset of its preceding range. (e.g. 2nd range should be subset of the 1st range)\\\nOpposite with [```isSuperset```](#issupersetranges-range).\n\n## isSuperset(...ranges: Range[])\n```js\nisSuperset(new Range(1, 3), new Range(1, 8)) // false (2nd range is superset of 1st range)\nisSuperset(new Range(1, 100), new Range(1, 10), new Range(1, 2)) // true\n```\nCheck if the range is superset of its following range. (e.g. 2nd range should be superset of the 1st range)\\\nOpposite with [```isSubset```](#issubsetranges-range).\n\n## isAdjacent(...ranges: Range[])\n```js\nisAdjacent(new Range(1, 2), new Range(2, 3), new Range(3, 10)) // true\nisAdjacent(new Range(1, 2), new Range(4, 5), new Range(5, 6)) // false\n```\nCheck if all the ranges are adjacent with each other.\n\n## makeRangeArray(range: Range | [number, number], step?: number)\n```js\nmakeRangeArray([0, 11], 2) // [0, 2, 4, 6, 8, 10]\nmakeRangeArray(new Range(0, 11), 2) // [0, 2, 4, 6, 8, 10]\n// equivalent of new Range(0, 11).toArray(2)\n```\n\nMake array of range.\n\n# Contribution\n```sh\n# build\nnpm run build\n\n# build (using nodemon)\nnpm run dev\n\n# test (using jest)\nnpm test\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhk1090%2Frange-admin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhk1090%2Frange-admin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhk1090%2Frange-admin/lists"}