{"id":20254683,"url":"https://github.com/dsys/invar","last_synced_at":"2025-10-09T19:10:52.407Z","repository":{"id":57295186,"uuid":"53091716","full_name":"dsys/invar","owner":"dsys","description":":nut_and_bolt: Expressive runtime invariants for JavaScript","archived":false,"fork":false,"pushed_at":"2016-08-11T03:57:38.000Z","size":37,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T00:03:55.916Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dsys.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}},"created_at":"2016-03-03T23:24:20.000Z","updated_at":"2019-03-17T10:58:26.000Z","dependencies_parsed_at":"2022-08-30T18:51:59.008Z","dependency_job_id":null,"html_url":"https://github.com/dsys/invar","commit_stats":null,"previous_names":["pavlovml/invar"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dsys/invar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsys%2Finvar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsys%2Finvar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsys%2Finvar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsys%2Finvar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dsys","download_url":"https://codeload.github.com/dsys/invar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsys%2Finvar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001982,"owners_count":26083243,"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-10-09T02:00:07.460Z","response_time":59,"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":[],"created_at":"2024-11-14T10:34:22.993Z","updated_at":"2025-10-09T19:10:52.365Z","avatar_url":"https://github.com/dsys.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/pavlovml/invar/master/resources/logo.png\" alt=\"logo\" width=\"220\" /\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cem\u003e\u003cstrong\u003eThe reign of poor error messages is over!\u003c/strong\u003e\u003c/em\u003e\u003cbr /\u003eExpressive runtime invariants for JavaScript.\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://travis-ci.org/pavlovml/invar\"\u003e\u003cimg src=\"https://img.shields.io/travis/pavlovml/invar.svg\" alt=\"TravisCI shield\" /\u003e\u003c/a\u003e \u003ca href=\"https://www.npmjs.com/package/invar\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/invar.svg\" alt=\"npm shield\" /\u003e\u003c/a\u003e \u003ca href=\"http://standardjs.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat\" alt=\"JavaScript Standard Style\" /\u003e\u003c/a\u003e\u003c/p\u003e\n\n## Installation\n\n    $ npm install invar --save\n\n## Usage\n\n```javascript\nimport invar from 'invar'\n```\n\n---\n\n### `invar(message)`\n\nCheck for truthiness.\n\n#### Example\n\n```javascript\ninvar(2 + 2 === 5, \"I'm sorry Dave, I'm afraid I can't do that.\")\n```\n \n#### Throws\n\n    Invariant Violation: I'm sorry Dave, I'm afraid I can't do that.\n\n---\n\n### `invar.equal(actual, expected, message)`\n\nCheck for shallow equality.\n\n#### Example\n\n```javascript\ninvar.equal(2 + 2, 5, \"Daisy, Daisy, give me your answer do.\")\n```\n\n#### Throws\n\n    Invariant Violation: Daisy, Daisy, give me your answer do.\n        actual: 4\n      expected: 5\n\n---\n\n### `invar.notEqual(actual, expected, message)`\n\nCheck for shallow unequality.\n\n#### Example\n\n```javascript\ninvar.notEqual(2 + 2, 4, \"I've just picked up a fault in the AE35 unit.\")\n```\n\n#### Throws\n\n    Invariant Violation: I've just picked up a fault in the AE35 unit.\n        actual: 4\n      expected: not 4\n\n---\n\n### `invar.req(arg)`\n\nAlways fail. Used for mandatory function arguments.\n\n#### Example\n\n```javascript\nfunction myFunction (mandatoryArg = invar.req('mandatoryArg')) {}\nmyFunction()\n```\n\n#### Throws\n\n    Invariant Violation: Required argument 'mandatoryArg' not provided.\n\n---\n\n### `invar.fail(message)`\n\nAlways fail.\n\n#### Example\n\n```javascript\ninvar.fail(\"I'm afraid. I'm afraid, Dave. Dave, my mind is going.\")\n```\n\n#### Throws\n\n    Invariant Violation: I'm afraid. I'm afraid, Dave. Dave, my mind is going.\n\n## Development\n\nInvar uses [JavaScript Standard Style](https://github.com/feross/standard), [Babel](https://babeljs.io/) for ES6+ support, and [Jest](http://facebook.github.io/jest/) for testing.\n\n    $ git clone git@github.com:pavlovml/invar.git\n    $ make test\n\nTo run the tests on file changes:\n\n    $ env WATCH=true make test\n\n## License\n\n[BSD 3-Clause](https://github.com/pavlovml/invar/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsys%2Finvar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdsys%2Finvar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsys%2Finvar/lists"}