{"id":19066522,"url":"https://github.com/geut/nanocustomassert","last_synced_at":"2025-04-28T12:29:49.915Z","repository":{"id":57307877,"uuid":"218408220","full_name":"geut/nanocustomassert","owner":"geut","description":"more than assert!","archived":false,"fork":false,"pushed_at":"2020-03-14T15:14:30.000Z","size":77,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-01-18T12:53:37.560Z","etag":null,"topics":["assertion-library","error-handling","geut"],"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/geut.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-30T00:15:38.000Z","updated_at":"2024-01-18T12:53:37.560Z","dependencies_parsed_at":"2022-09-09T00:52:34.758Z","dependency_job_id":null,"html_url":"https://github.com/geut/nanocustomassert","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geut%2Fnanocustomassert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geut%2Fnanocustomassert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geut%2Fnanocustomassert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geut%2Fnanocustomassert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geut","download_url":"https://codeload.github.com/geut/nanocustomassert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223772173,"owners_count":17199977,"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":["assertion-library","error-handling","geut"],"created_at":"2024-11-09T00:57:12.869Z","updated_at":"2024-11-09T00:57:13.540Z","avatar_url":"https://github.com/geut.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nanocustomassert\n\n[![Build Status](https://travis-ci.com/geut/nanocustomassert.svg?branch=master)](https://travis-ci.com/geut/nanocustomassert)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\n\u003e assert your code + throw custom errors = 🎰\n\n## \u003ca name=\"install\"\u003e\u003c/a\u003e Install\n\n```\nnpm i nanocustomassert\n```\n\n## \u003ca name=\"usage\"\u003e\u003c/a\u003e Usage\n\n```javascript\nconst assert = require('nanocustomassert')\n\n// simple assert =\u003e AssertionError\nassert('a' === 'a', 'should be equal')\n\n// or custom errors =\u003e MyError\nclass MyError extends Error {}\nconst key1 = 'a1'\nconst key2 = 'b2'\nassert(key1 === key2, MyError)\n\n// or nanoerrors!!!\nconst nanoerror = require('nanoerror')\nconst CoolError = nanoerror('COOL_ERR', '🤖COOL ERROR FOUND: %s')\nassert(false, CoolError, \"Oops 🙈\")\n```\n\n## \u003ca name=\"api\"\u003e\u003c/a\u003e API\n\n`const assert = require('nanocustomassert')`\n\n### assert\n\n\u003e `assert(expresion: JS expresion, message: string || function constructor, ...params)`\n\nEvaluates the expresion, if falsy throws an AssertionError or a custom error. See [nanoerror](https://github.com/geut/nanoerror).\n\n- expression: the expresion to assert\n- message: can be a `string` used as a message for the AssertionError or a `function` constructor. This is useful to throw a custom error. **Optional**\n- params: these params are applied to the custom constructor function. **Optional**\n\n## \u003ca name=\"inspiration\"\u003e\u003c/a\u003eInspiration\n\nThis module is heavily inspired by [nanoassert](https://github.com/emilbayes/nanoassert) from Emil Bayes. :clap:\n\n## \u003ca name=\"issues\"\u003e\u003c/a\u003e Issues\n\n:bug: If you found an issue we encourage you to report it on [github](https://github.com/geut/nanocustomassert/issues). Please specify your OS and the actions to reproduce it.\n\n## \u003ca name=\"contribute\"\u003e\u003c/a\u003e Contributing\n\n:busts_in_silhouette: Ideas and contributions to the project are welcome. You must follow this [guideline](https://github.com/geut/nanocustomassert/blob/master/CONTRIBUTING.md).\n\n## License\n\nMIT © A [**GEUT**](http://geutstudio.com/) project\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeut%2Fnanocustomassert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeut%2Fnanocustomassert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeut%2Fnanocustomassert/lists"}