{"id":22092236,"url":"https://github.com/pirxpilot/bounds","last_synced_at":"2025-07-24T20:32:09.666Z","repository":{"id":7049068,"uuid":"8328727","full_name":"pirxpilot/bounds","owner":"pirxpilot","description":"Mixin for checking if value is inside or outside of bounds","archived":false,"fork":false,"pushed_at":"2024-01-31T09:33:09.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-08-09T16:53:02.087Z","etag":null,"topics":[],"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/pirxpilot.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","contributing":null,"funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-21T05:04:38.000Z","updated_at":"2022-04-13T15:34:32.000Z","dependencies_parsed_at":"2022-09-05T06:41:13.584Z","dependency_job_id":null,"html_url":"https://github.com/pirxpilot/bounds","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Fbounds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Fbounds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Fbounds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Fbounds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pirxpilot","download_url":"https://codeload.github.com/pirxpilot/bounds/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227476143,"owners_count":17779417,"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":[],"created_at":"2024-12-01T03:08:49.290Z","updated_at":"2024-12-01T03:08:49.699Z","avatar_url":"https://github.com/pirxpilot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM version][npm-image]][npm-url]\n[![Build Status][build-image]][build-url]\n\n# bounds\n\n  Mixin for checking if value is inside or outside of bounds You can use `Bounds` for any objects for\n  which you can define compare function (dates, vectors etc.)\n\n  In addition to regular range checking `Bounds` supports reversed ranges: if\n  min is bigger than max it considers values outside ot the max, min range as valid.\n\n## Installation\n\n    $ npm install bounds\n\n## API\n\n###\t.compare(fn)\n\nSets comparison function. `fn` should take 2 arguments and behave like sort comparison function i.e.\nreturn 0 if items are equal, -1 if the first is smaller than the second, 1 is the first is bigger\nthan the second.\n\n### .min(v)\n\nSet lower bound (inclusive) to `v`\n\n### .max(v)\n\nSet upper bound (inclusive) to `v`\n\n### .in(v)\n\nReturn `true` if `v` is in bounds i.e. `min \u003c= v \u003c= max`\n\n### .out(v)\n\nReturn `true` if `v` is outside of bounds i.e. `v \u003c min` OR `max \u003c v`\n\n### .before(v)\n\nReturn `true` if `v \u003c min`\n\n### .after(v)\n\nReturn `true` if `v \u003e max`\n\n### .valid(v)\n\nFor regular ranges it's the same as `in`. For reversed ranges it considers as valid values that are\noutside of the range (it's still inclusive so `min` and `max` are still considered valid)\n\n### .restrict(v)\n\nReturns the passed value for `valid` values. For invalid values returns the closest boundary (`min`\nor `max`). `restrict` only works for reverse ranges if `distance` function is defined.\n\n###\t.distance(fn)\n\nOptional distance function: it's only used when calculating proper restriction for reversed ranges.\nIf restricted value is closed to `min` than to `max`, then the `min` is returned.\n\n## License\n\n  MIT\n\n[npm-url]: https://npmjs.org/package/bounds\n[npm-image]: https://img.shields.io/npm/v/bounds\n\n[build-url]: https://github.com/pirxpilot/bounds/actions/workflows/check.yaml\n[build-image]: https://img.shields.io/github/actions/workflow/status/pirxpilot/bounds/check.yaml?branch=main\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirxpilot%2Fbounds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpirxpilot%2Fbounds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirxpilot%2Fbounds/lists"}