{"id":22433728,"url":"https://github.com/gavinning/assert","last_synced_at":"2025-07-13T10:36:30.706Z","repository":{"id":51593274,"uuid":"213944870","full_name":"gavinning/assert","owner":"gavinning","description":"断言，失败信息支持携带err-code","archived":false,"fork":false,"pushed_at":"2022-12-30T19:46:59.000Z","size":21,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-30T01:54:57.638Z","etag":null,"topics":["assert","err-code","error-code","verify"],"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/gavinning.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":"2019-10-09T14:46:53.000Z","updated_at":"2020-03-02T04:16:59.000Z","dependencies_parsed_at":"2023-01-31T15:01:23.460Z","dependency_job_id":null,"html_url":"https://github.com/gavinning/assert","commit_stats":null,"previous_names":["gavinning/is"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Fassert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Fassert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Fassert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Fassert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gavinning","download_url":"https://codeload.github.com/gavinning/assert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245372380,"owners_count":20604491,"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":["assert","err-code","error-code","verify"],"created_at":"2024-12-05T22:15:44.978Z","updated_at":"2025-03-27T07:46:05.559Z","avatar_url":"https://github.com/gavinning.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"assert\n---\n断言，失败信息支持携带err-code\n\n### Install\n```sh\nnpm i @4a/assert\n```\n\n### Usage\n```js\nconst assert = require('@4a/assert')\n\ntry {\n    assert.ok(0, 100, 'error code 100')\n}\ncatch(err) {\n    console.log({\n        code: err.code,\n        message: err.message\n    })\n}\n\ntry {\n    assert.fail(1, 200, 'error code 200')\n}\ncatch(err) {\n    console.log({\n        code: err.code,\n        message: err.message\n    })\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinning%2Fassert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgavinning%2Fassert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinning%2Fassert/lists"}