{"_id":"clean-assert-util","_rev":"4175171","name":"clean-assert-util","description":"Common utilities for `clean-assert`","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"isiahmeadows","email":""}],"time":{"modified":"2026-03-01T21:29:35.000Z","created":"2017-01-09T18:20:44.744Z","1.0.1":"2017-01-09T19:05:16.881Z","1.0.0":"2017-01-09T18:20:44.744Z"},"users":{},"author":{"name":"Isiah Meadows"},"repository":{"type":"git","url":"git+https://github.com/isiahmeadows/clean-assert-util.git"},"versions":{"1.0.1":{"name":"clean-assert-util","version":"1.0.1","description":"Common utilities for `clean-assert`","scripts":{"lint":"eslint .","test":"eslint . && npm run test:node","test:all":"eslint . && npm run test:node && npm run test:chrome && npm run test:firefox && npm run test:phantomjs","test:node":"mocha --colors","test:chrome":"karma start --colors --single-run --browsers Chrome","test:firefox":"karma start --colors --single-run --browsers Firefox","test:phantomjs":"karma start --colors --single-run --browsers PhantomJS"},"browser":{"./inspect.js":"./browser-inspect.js"},"files":["browser-inspect.js","index.js","index.d.ts","inspect.js"],"author":{"name":"Isiah Meadows"},"license":"ISC","devDependencies":{"browserify":"^13.0.1","eslint":"^3.13.0","eslint-config-isiahmeadows":"^0.1.8","karma":"^1.1.0","karma-browserify":"^5.0.5","karma-chrome-launcher":"^2.0.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.1.1","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.2.0","watchify":"^3.7.0"},"dependencies":{"util-inspect":"^0.1.8"},"repository":{"type":"git","url":"git+https://github.com/isiahmeadows/clean-assert-util.git"},"bugs":{"url":"https://github.com/isiahmeadows/clean-assert-util/issues"},"homepage":"https://github.com/isiahmeadows/clean-assert-util#readme","gitHead":"ecedbb9bfac644b8f7983643ceadee4c1307f298","_id":"clean-assert-util@1.0.1","_shasum":"ab40ac29db595121af7950039e199d0a8380b496","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"isiahmeadows","email":"me@isiahmeadows.com"},"dist":{"shasum":"ab40ac29db595121af7950039e199d0a8380b496","size":3737,"noattachment":false,"key":"/clean-assert-util/-/clean-assert-util-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/clean-assert-util/download/clean-assert-util-1.0.1.tgz"},"maintainers":[{"name":"isiahmeadows","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/clean-assert-util-1.0.1.tgz_1483988716252_0.510853409068659"},"directories":{},"publish_time":1483988716881,"_hasShrinkwrap":false,"deprecated":"Internalized to Clean Assert: https://github.com/isiahmeadows/clean-assert","_cnpm_publish_time":1483988716881,"_cnpmcore_publish_time":"2021-12-17T03:41:19.696Z"},"1.0.0":{"name":"clean-assert-util","version":"1.0.0","description":"Common utilities for `clean-assert`","scripts":{"lint":"eslint .","test":"eslint . && npm run test:node","test:all":"eslint . && npm run test:node && npm run test:chrome && npm run test:firefox && npm run test:phantomjs","test:node":"mocha --colors","test:chrome":"karma start --colors --single-run --browsers Chrome","test:firefox":"karma start --colors --single-run --browsers Firefox","test:phantomjs":"karma start --colors --single-run --browsers PhantomJS"},"browser":{"./inspect.js":"./node_modules/util-inspect/index.js"},"files":["index.js","inspect.js","index.d.ts"],"author":{"name":"Isiah Meadows"},"license":"ISC","devDependencies":{"browserify":"^13.0.1","eslint":"^3.13.0","eslint-config-isiahmeadows":"^0.1.8","karma":"^1.1.0","karma-browserify":"^5.0.5","karma-chrome-launcher":"^2.0.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.1.1","karma-phantomjs-launcher":"^1.0.2","mocha":"^3.2.0","watchify":"^3.7.0"},"dependencies":{"util-inspect":"^0.1.8"},"repository":{"type":"git","url":"git+https://github.com/isiahmeadows/clean-assert-util.git"},"bugs":{"url":"https://github.com/isiahmeadows/clean-assert-util/issues"},"homepage":"https://github.com/isiahmeadows/clean-assert-util#readme","gitHead":"5cfbc483f2fe268a0f2a4ef8ed7ed5e21eb08a83","_id":"clean-assert-util@1.0.0","_shasum":"2fa61ea6071bf26dbbb26f8335455406600167c6","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"isiahmeadows","email":"me@isiahmeadows.com"},"dist":{"shasum":"2fa61ea6071bf26dbbb26f8335455406600167c6","size":3672,"noattachment":false,"key":"/clean-assert-util/-/clean-assert-util-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/clean-assert-util/download/clean-assert-util-1.0.0.tgz"},"maintainers":[{"name":"isiahmeadows","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/clean-assert-util-1.0.0.tgz_1483986042795_0.9072791966609657"},"directories":{},"publish_time":1483986044744,"_hasShrinkwrap":false,"deprecated":"Internalized to Clean Assert: https://github.com/isiahmeadows/clean-assert","_cnpm_publish_time":1483986044744,"_cnpmcore_publish_time":"2021-12-17T03:41:19.929Z"}},"readme":"[![Build Status](https://travis-ci.org/isiahmeadows/clean-assert-util.svg?branch=master)](https://travis-ci.org/isiahmeadows/cclean-assert-util)\n\n# clean-assert-util\n\nCommon utilities for [`clean-assert`](https://www.npmjs.com/package/clean-assert), separated for better stability and easier use, so you can create your own assertions and still make them just as clean, neat, and native-looking as any of `clean-assert`'s own assertion methods. No more of this:\n\n```js\nassert(something.isntRight(), \"Something isn't right\")\n// AssertionError: Something isn't right\n```\n\nInstead, this could look like this, with beautiful error messages to match:\n\n```js\nif (something.isntRight()) {\n    assertUtil.fail(\"Something isn't right: expected {expected}, found {actual}\", {\n        expected: good,\n        actual: bad,\n    })\n}\n// AssertionError: Something isn't right: expected 1, found 2\n```\n\n## Installation\n\nInstall via [npm](https://www.npmjs.com/package/clean-assert-util):\n\n```\nnpm install --save clean-assert-util\n```\n\n## API\n\nJust the basics, a common, non-volatile core.\n\n### assertUtil.inspect(object, ...opts?)\n\n```js\nassertUtil.inspect(object, ...opts)\n```\n\nAn alias of Node's `util.inspect`, but resolved to use `util-inspect` in browsers. Much easier than using `util.inspect` directly, with less excess in the bundle.\n\n### class assertUtil.AssertionError\n\n```js\nnew assertUtil.AssertionError(message=\"\", expected=undefined, actual=undefined)\n```\n\nThe assertion error constructor used in this assertion library. Don't worry, it's only used here, and the rest of Thallium really doesn't care what assertion library you use, if any. It simply checks for the error's `name` to be `\"AssertionError\"`, nothing else.\n\n### assertUtil.assert(condition, message?)\n\n```js\nassertUtil.assert(condition, message=\"\")\n```\n\nThe basic assert method. Most assertion libraries have some variant of this: test a `condition`, and if it's falsy, throw an assertion error with a `message`.\n\n### assertUtil.fail(message?)\n\n```js\nassertUtil.fail(message=\"\")\n```\n\nThe basic automatic failure method. Most assertion libraries have some variant of this: throw an assertion error with a `message`.\n\n### assertUtil.format(message, args, formatter?)\n\n```js\nassertUtil.format(message, args, prettify=util.inspect)\n```\n\nCreate a formatted message from the template `message`, using `args` to fill it in and `prettify` to pretty-print it to a string.\n\n### assertUtil.fail(message, args, formatter?)\n\n```js\nassertUtil.fail(message, args, prettify=util.inspect)\n```\n\nThrow a formatted assertion error, formatted with `assertUtil.format`, and with `args.expected` and `args.actual` being passed directly to the `assertUtil.AssertionError` constructor.\n\n### assertUtil.escape(string)\n\n```js\nassertUtil.escape(string)\n```\n\nEscape a string so that `assertUtil.format` returns the raw string instead of \"pretty-printing\" it (e.g. for function names injected into templates).\n\n## License\n\nCopyright (c) 2016 and later, Isiah Meadows <me@isiahmeadows.com>.\n\nPermission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n","_attachments":{},"homepage":"https://github.com/isiahmeadows/clean-assert-util#readme","bugs":{"url":"https://github.com/isiahmeadows/clean-assert-util/issues"},"license":"ISC"}