{"_id":"@jsdevtools/ono","_rev":"333396","name":"@jsdevtools/ono","description":"Throw better errors.","dist-tags":{"latest":"7.1.3"},"maintainers":[{"name":"jamesmessinger","email":"james.messinger@gmail.com"},{"name":"mcous","email":""},{"name":"philsturgeon","email":"me@philsturgeon.uk"}],"time":{"modified":"2021-06-08T13:12:16.000Z","created":"2020-02-16T13:05:16.011Z","7.1.3":"2020-07-15T10:29:27.700Z","7.1.2":"2020-04-18T15:58:21.283Z","7.1.1":"2020-03-15T15:01:56.541Z","7.1.0":"2020-03-03T13:59:26.930Z","7.0.1":"2020-02-16T14:21:25.735Z","7.0.0":"2020-02-16T13:35:47.175Z","6.0.1":"2020-02-16T13:05:16.011Z"},"users":{},"author":{"name":"James Messinger","url":"https://jamesmessinger.com"},"repository":{"type":"git","url":"git+https://github.com/JS-DevTools/ono.git"},"versions":{"7.1.3":{"name":"@jsdevtools/ono","version":"7.1.3","description":"Throw better errors.","keywords":["throw","error","errors","exception","printf","format","wrap","inner","original","stack","properties"],"author":{"name":"James Messinger","url":"https://jamesmessinger.com"},"license":"MIT","homepage":"https://jstools.dev/ono","repository":{"type":"git","url":"git+https://github.com/JS-DevTools/ono.git"},"main":"cjs/index.js","module":"esm/index.js","typings":"esm/index.d.ts","browser":{"./cjs/isomorphic.node.js":"./cjs/isomorphic.browser.js","./esm/isomorphic.node.js":"./esm/isomorphic.browser.js"},"scripts":{"clean":"shx rm -rf .nyc_output coverage cjs esm","lint":"eslint src test","build":"npm run build:cjs && npm run build:esm","build:esm":"tsc","build:cjs":"tsc --module commonjs --outDir cjs","test":"npm run test:node && npm run test:typescript && npm run test:browser && npm run lint","test:node":"mocha","test:browser":"karma start --single-run","test:typescript":"tsc --noEmit test/specs/typescript.spec.ts","coverage":"npm run coverage:node && npm run coverage:browser","coverage:node":"nyc node_modules/mocha/bin/mocha","coverage:browser":"npm run test:browser -- --coverage","upgrade":"npm-check -u && npm audit fix","bump":"bump --tag --push --all","release":"npm run upgrade && npm run clean && npm run build && npm test && npm run bump"},"devDependencies":{"@babel/polyfill":"^7.10.4","@jsdevtools/eslint-config":"^1.0.0","@jsdevtools/host-environment":"^2.0.3","@jsdevtools/karma-config":"^3.1.6","@jsdevtools/version-bump-prompt":"^6.0.3","@types/node":"^14.0.19","chai":"^4.2.0","eslint":"^7.4.0","karma":"^5.1.0","karma-cli":"^2.0.0","mocha":"^8.0.1","npm-check":"^5.9.2","nyc":"^15.1.0","shx":"^0.3.2","typescript":"^3.9.6"},"dependencies":{},"gitHead":"6aefd43e9524de4b7425a4e8143271942b906766","bugs":{"url":"https://github.com/JS-DevTools/ono/issues"},"_id":"@jsdevtools/ono@7.1.3","_nodeVersion":"10.21.0","_npmVersion":"6.14.4","dist":{"shasum":"9df03bbd7c696a5c58885c34aa06da41c8543796","size":21504,"noattachment":false,"key":"/@jsdevtools/ono/-/@jsdevtools/ono-7.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/@jsdevtools/ono/download/@jsdevtools/ono-7.1.3.tgz"},"maintainers":[{"name":"jamesmessinger","email":"james.messinger@gmail.com"},{"name":"mcous","email":""},{"name":"philsturgeon","email":"me@philsturgeon.uk"}],"_npmUser":{"name":"jamesmessinger","email":"james.messinger@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ono_7.1.3_1594808967530_0.2742534739641169"},"_hasShrinkwrap":false,"publish_time":1594808967700,"_cnpm_publish_time":1594808967700},"7.1.2":{"name":"@jsdevtools/ono","version":"7.1.2","description":"Throw better errors.","keywords":["throw","error","errors","exception","printf","format","wrap","inner","original","stack","properties"],"author":{"name":"James Messinger","url":"https://jamesmessinger.com"},"license":"MIT","homepage":"https://jstools.dev/ono","repository":{"type":"git","url":"git+https://github.com/JS-DevTools/ono.git"},"main":"cjs/index.js","module":"esm/index.js","typings":"esm/index.d.ts","browser":{"./cjs/isomorphic.node.js":"./cjs/isomorphic.browser.js","./esm/isomorphic.node.js":"./esm/isomorphic.browser.js"},"scripts":{"clean":"shx rm -rf .nyc_output coverage cjs esm","lint":"npm run lint:typescript && npm run lint:javascript","lint:typescript":"tslint -p tsconfig.json","lint:javascript":"eslint test ./*.js","build":"npm run build:cjs && npm run build:esm","build:esm":"tsc","build:cjs":"tsc --module commonjs --outDir cjs","test":"npm run test:node && npm run test:typescript && npm run test:browser && npm run lint","test:node":"mocha","test:browser":"karma start --single-run","test:typescript":"tsc --noEmit test/specs/typescript.spec.ts","coverage":"npm run coverage:node && npm run coverage:browser","coverage:node":"nyc node_modules/mocha/bin/mocha","coverage:browser":"npm run test:browser -- --coverage","upgrade":"npm-check -u && npm audit fix","bump":"bump --tag --push --all","release":"npm run upgrade && npm run clean && npm run build && npm test && npm run bump"},"devDependencies":{"@babel/polyfill":"^7.8.7","@jsdevtools/eslint-config-modular":"^8.0.3","@jsdevtools/host-environment":"^2.0.3","@jsdevtools/karma-config":"^3.1.4","@jsdevtools/tslint-modular":"^2.0.5","@jsdevtools/version-bump-prompt":"^6.0.3","@types/node":"^13.13.0","chai":"^4.2.0","eslint":"^6.8.0","karma":"^5.0.2","karma-cli":"^2.0.0","mocha":"^7.1.1","npm-check":"^5.9.2","nyc":"^15.0.1","shx":"^0.3.2","tslint":"^6.1.1","typescript":"^3.8.3","typescript-tslint-plugin":"^0.5.5"},"dependencies":{},"gitHead":"5cb1587217e6ffb800650fded62cba05a43c2fec","bugs":{"url":"https://github.com/JS-DevTools/ono/issues"},"_id":"@jsdevtools/ono@7.1.2","_nodeVersion":"10.20.1","_npmVersion":"6.14.4","dist":{"shasum":"373995bb40a6686589a7fcfec06b0e6e304ef6c6","size":21297,"noattachment":false,"key":"/@jsdevtools/ono/-/@jsdevtools/ono-7.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@jsdevtools/ono/download/@jsdevtools/ono-7.1.2.tgz"},"maintainers":[{"name":"jamesmessinger","email":"james.messinger@gmail.com"},{"name":"mcous","email":""},{"name":"philsturgeon","email":"me@philsturgeon.uk"}],"_npmUser":{"name":"jamesmessinger","email":"james.messinger@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ono_7.1.2_1587225501056_0.2634554141210581"},"_hasShrinkwrap":false,"publish_time":1587225501283,"_cnpm_publish_time":1587225501283},"7.1.1":{"name":"@jsdevtools/ono","version":"7.1.1","description":"Throw better errors.","keywords":["throw","error","errors","exception","printf","format","wrap","inner","original","stack","properties"],"author":{"name":"James Messinger","url":"https://jamesmessinger.com"},"license":"MIT","homepage":"https://jstools.dev/ono","repository":{"type":"git","url":"git+https://github.com/JS-DevTools/ono.git"},"main":"cjs/index.js","module":"esm/index.js","typings":"esm/index.d.ts","browser":{"./cjs/isomorphic.node.js":"./cjs/isomorphic.browser.js","./esm/isomorphic.node.js":"./esm/isomorphic.browser.js"},"scripts":{"clean":"shx rm -rf .nyc_output coverage cjs esm","lint":"npm run lint:typescript && npm run lint:javascript","lint:typescript":"tslint -p tsconfig.json","lint:javascript":"eslint test ./*.js","build":"npm run build:cjs && npm run build:esm","build:esm":"tsc","build:cjs":"tsc --module commonjs --outDir cjs","test":"npm run test:node && npm run test:typescript && npm run test:browser && npm run lint","test:node":"mocha","test:browser":"karma start --single-run","test:typescript":"tsc --noEmit test/specs/typescript.spec.ts","coverage":"npm run coverage:node && npm run coverage:browser","coverage:node":"nyc node_modules/mocha/bin/mocha","coverage:browser":"npm run test:browser -- --coverage","upgrade":"npm-check -u && npm audit fix","bump":"bump --tag --push --all","release":"npm run upgrade && npm run clean && npm run build && npm test && npm run bump"},"devDependencies":{"@babel/polyfill":"^7.8.3","@jsdevtools/eslint-config-modular":"^8.0.0","@jsdevtools/host-environment":"^2.0.2","@jsdevtools/karma-config":"^3.1.2","@jsdevtools/tslint-modular":"^2.0.1","@jsdevtools/version-bump-prompt":"^6.0.1","@types/node":"^13.7.7","chai":"^4.2.0","eslint":"^6.8.0","karma":"^4.4.1","karma-cli":"^2.0.0","mocha":"^7.1.0","npm-check":"^5.9.2","nyc":"^15.0.0","shx":"^0.3.2","tslint":"^6.0.0","typescript":"^3.8.3","typescript-tslint-plugin":"^0.5.5"},"dependencies":{},"gitHead":"2656e8051902c278c907a08781957e8895b252e9","bugs":{"url":"https://github.com/JS-DevTools/ono/issues"},"_id":"@jsdevtools/ono@7.1.1","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"shasum":"36034f9cb0fb456858c137a3f3e6d6db67ab5cc5","size":20844,"noattachment":false,"key":"/@jsdevtools/ono/-/@jsdevtools/ono-7.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@jsdevtools/ono/download/@jsdevtools/ono-7.1.1.tgz"},"maintainers":[{"name":"jamesmessinger","email":"james.messinger@gmail.com"},{"name":"mcous","email":""},{"name":"philsturgeon","email":"me@philsturgeon.uk"}],"_npmUser":{"name":"jamesmessinger","email":"james.messinger@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ono_7.1.1_1584284516365_0.028431925956307724"},"_hasShrinkwrap":false,"publish_time":1584284516541,"_cnpm_publish_time":1584284516541},"7.1.0":{"name":"@jsdevtools/ono","version":"7.1.0","description":"Throw better errors.","keywords":["throw","error","errors","exception","printf","format","wrap","inner","original","stack","properties"],"author":{"name":"James Messinger","url":"https://jamesmessinger.com"},"license":"MIT","homepage":"https://jstools.dev/ono","repository":{"type":"git","url":"git+https://github.com/JS-DevTools/ono.git"},"main":"cjs/index.js","module":"esm/index.js","typings":"esm/index.d.ts","browser":{"./cjs/isomorphic.node.js":"./cjs/isomorphic.browser.js","./esm/isomorphic.node.js":"./esm/isomorphic.browser.js"},"scripts":{"clean":"shx rm -rf .nyc_output coverage cjs esm","lint":"npm run lint:typescript && npm run lint:javascript","lint:typescript":"tslint -p tsconfig.json","lint:javascript":"eslint test ./*.js","build":"npm run build:cjs && npm run build:esm","build:esm":"tsc","build:cjs":"tsc --module commonjs --outDir cjs","test":"npm run test:node && npm run test:typescript && npm run test:browser && npm run lint","test:node":"mocha","test:browser":"karma start --single-run","test:typescript":"tsc --noEmit test/specs/typescript.spec.ts","coverage":"npm run coverage:node && npm run coverage:browser","coverage:node":"nyc --reporter=text --reporter=lcov node_modules/mocha/bin/mocha","coverage:browser":"npm run test:browser -- --coverage","upgrade":"npm-check -u && npm audit fix","bump":"bump --tag --push --all","release":"npm run upgrade && npm run clean && npm run build && npm test && npm run bump"},"devDependencies":{"@babel/polyfill":"^7.8.3","@jsdevtools/eslint-config-modular":"^8.0.0","@jsdevtools/host-environment":"^2.0.2","@jsdevtools/karma-config":"^3.1.2","@jsdevtools/tslint-modular":"^2.0.1","@jsdevtools/version-bump-prompt":"^6.0.1","@types/node":"^13.7.7","chai":"^4.2.0","eslint":"^6.8.0","karma":"^4.4.1","karma-cli":"^2.0.0","mocha":"^7.1.0","npm-check":"^5.9.2","nyc":"^15.0.0","shx":"^0.3.2","tslint":"^6.0.0","typescript":"^3.8.3","typescript-tslint-plugin":"^0.5.5"},"dependencies":{},"gitHead":"53780ce746c63b6655acd70cd53538ae52edebbf","bugs":{"url":"https://github.com/JS-DevTools/ono/issues"},"_id":"@jsdevtools/ono@7.1.0","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"shasum":"f4704197ed4ce4964ae8931f45c81d11e97742e5","size":20639,"noattachment":false,"key":"/@jsdevtools/ono/-/@jsdevtools/ono-7.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@jsdevtools/ono/download/@jsdevtools/ono-7.1.0.tgz"},"maintainers":[{"name":"jamesmessinger","email":"james.messinger@gmail.com"},{"name":"mcous","email":""},{"name":"philsturgeon","email":"me@philsturgeon.uk"}],"_npmUser":{"name":"jamesmessinger","email":"james.messinger@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ono_7.1.0_1583243966843_0.31513752063424416"},"_hasShrinkwrap":false,"publish_time":1583243966930,"_cnpm_publish_time":1583243966930},"7.0.1":{"name":"@jsdevtools/ono","version":"7.0.1","description":"Throw better errors.","keywords":["throw","error","errors","exception","printf","format","wrap","inner","original","stack","properties"],"author":{"name":"James Messinger","url":"https://jamesmessinger.com"},"license":"MIT","homepage":"https://jstools.dev/ono","repository":{"type":"git","url":"git+https://github.com/JS-DevTools/ono.git"},"main":"cjs/index.js","module":"esm/index.js","typings":"esm/index.d.ts","browser":{"./cjs/isomorphic.node.js":"./cjs/isomorphic.browser.js","./esm/isomorphic.node.js":"./esm/isomorphic.browser.js"},"scripts":{"clean":"shx rm -rf .nyc_output coverage cjs esm","lint":"npm run lint:typescript && npm run lint:javascript","lint:typescript":"tslint -p tsconfig.json","lint:javascript":"eslint test ./*.js","build":"npm run build:cjs && npm run build:esm","build:esm":"tsc","build:cjs":"tsc --module commonjs --outDir cjs","test":"npm run test:node && npm run test:typescript && npm run test:browser && npm run lint","test:node":"mocha","test:browser":"karma start --single-run","test:typescript":"tsc --noEmit test/specs/typescript.spec.ts","coverage":"npm run coverage:node && npm run coverage:browser","coverage:node":"nyc --reporter=text --reporter=lcov node_modules/mocha/bin/mocha","coverage:browser":"npm run test:browser -- --coverage","upgrade":"npm-check -u && npm audit fix","bump":"bump --tag --push --all","release":"npm run upgrade && npm run clean && npm run build && npm test && npm run bump"},"devDependencies":{"@babel/polyfill":"^7.8.3","@jsdevtools/eslint-config-modular":"^8.0.0","@jsdevtools/host-environment":"^2.0.1","@jsdevtools/karma-config":"^3.1.1","@jsdevtools/tslint-modular":"^2.0.1","@jsdevtools/version-bump-prompt":"^6.0.0","@types/node":"^13.7.1","chai":"^4.2.0","eslint":"^6.8.0","karma":"^4.4.1","karma-cli":"^2.0.0","mocha":"^7.0.1","npm-check":"^5.9.0","nyc":"^15.0.0","shx":"^0.3.2","tslint":"^6.0.0","typescript":"^3.7.5","typescript-tslint-plugin":"^0.5.5"},"dependencies":{},"gitHead":"1e3e5ed57d600b7a94511ca717ddce8dbf7b5d92","bugs":{"url":"https://github.com/JS-DevTools/ono/issues"},"_id":"@jsdevtools/ono@7.0.1","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"shasum":"7dd55176a94ef4151ac0c030e835e34e7530db99","size":20135,"noattachment":false,"key":"/@jsdevtools/ono/-/@jsdevtools/ono-7.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@jsdevtools/ono/download/@jsdevtools/ono-7.0.1.tgz"},"maintainers":[{"name":"jamesmessinger","email":"james.messinger@gmail.com"},{"name":"mcous","email":""},{"name":"philsturgeon","email":"me@philsturgeon.uk"}],"_npmUser":{"name":"jamesmessinger","email":"james.messinger@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ono_7.0.1_1581862885624_0.07855824867884031"},"_hasShrinkwrap":false,"publish_time":1581862885735,"_cnpm_publish_time":1581862885735},"7.0.0":{"name":"@jsdevtools/ono","version":"7.0.0","description":"Throw better errors.","keywords":["throw","error","errors","exception","printf","format","wrap","inner","original","stack","properties"],"author":{"name":"James Messinger","url":"https://jamesmessinger.com"},"license":"MIT","homepage":"https://jstools.dev/ono","repository":{"type":"git","url":"git+https://github.com/JS-DevTools/ono.git"},"main":"cjs/index.js","module":"esm/index.js","typings":"esm/index.d.ts","browser":{"./cjs/isomorphic.node.js":"./cjs/isomorphic.browser.js","./esm/isomorphic.node.js":"./esm/isomorphic.browser.js"},"scripts":{"clean":"shx rm -rf .nyc_output coverage cjs esm","lint":"npm run lint:typescript && npm run lint:javascript","lint:typescript":"tslint -p tsconfig.json","lint:javascript":"eslint test ./*.js","build":"npm run build:cjs && npm run build:esm","build:esm":"tsc","build:cjs":"tsc --module commonjs --outDir cjs","test":"npm run test:node && npm run test:typescript && npm run test:browser && npm run lint","test:node":"mocha","test:browser":"karma start --single-run","test:typescript":"tsc --noEmit test/specs/typescript.spec.ts","coverage":"npm run coverage:node && npm run coverage:browser","coverage:node":"nyc --reporter=text --reporter=lcov node_modules/mocha/bin/mocha","coverage:browser":"npm run test:browser -- --coverage","upgrade":"npm-check -u && npm audit fix","bump":"bump --tag --push --all","release":"npm run upgrade && npm run clean && npm run build && npm test && npm run bump"},"devDependencies":{"@babel/polyfill":"^7.8.3","@jsdevtools/eslint-config-modular":"^8.0.0","@jsdevtools/host-environment":"^2.0.1","@jsdevtools/karma-config":"^3.1.1","@jsdevtools/tslint-modular":"^2.0.1","@jsdevtools/version-bump-prompt":"^6.0.0","@types/node":"^13.7.1","chai":"^4.2.0","eslint":"^6.8.0","karma":"^4.4.1","karma-cli":"^2.0.0","mocha":"^7.0.1","npm-check":"^5.9.0","nyc":"^15.0.0","shx":"^0.3.2","tslint":"^6.0.0","typescript":"^3.7.5","typescript-tslint-plugin":"^0.5.5"},"dependencies":{},"gitHead":"b9f388992e093ad2f468c10788f2f84d4dce212d","bugs":{"url":"https://github.com/JS-DevTools/ono/issues"},"_id":"@jsdevtools/ono@7.0.0","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"shasum":"823cb99e1c91c238abf6f725331745844c1f6812","size":20134,"noattachment":false,"key":"/@jsdevtools/ono/-/@jsdevtools/ono-7.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@jsdevtools/ono/download/@jsdevtools/ono-7.0.0.tgz"},"maintainers":[{"name":"jamesmessinger","email":"james.messinger@gmail.com"},{"name":"mcous","email":""},{"name":"philsturgeon","email":"me@philsturgeon.uk"}],"_npmUser":{"name":"jamesmessinger","email":"james.messinger@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ono_7.0.0_1581860147037_0.6154010965719874"},"_hasShrinkwrap":false,"publish_time":1581860147175,"_cnpm_publish_time":1581860147175},"6.0.1":{"name":"@jsdevtools/ono","version":"6.0.1","description":"Throw better errors.","keywords":["throw","error","errors","exception","printf","format","wrap","inner","original","stack","properties"],"author":{"name":"James Messinger","url":"https://jamesmessinger.com"},"license":"MIT","homepage":"https://jstools.dev/ono","repository":{"type":"git","url":"git+https://github.com/JS-DevTools/ono.git"},"main":"cjs/index.js","module":"esm/index.js","typings":"esm/index.d.ts","browser":{"./cjs/isomorphic.node.js":"./cjs/isomorphic.browser.js","./esm/isomorphic.node.js":"./esm/isomorphic.browser.js"},"scripts":{"clean":"shx rm -rf .nyc_output coverage cjs esm","lint":"npm run lint:typescript && npm run lint:javascript","lint:typescript":"tslint -p tsconfig.json","lint:javascript":"eslint test ./*.js","build":"npm run build:cjs && npm run build:esm","build:esm":"tsc","build:cjs":"tsc --module commonjs --outDir cjs","test":"npm run test:node && npm run test:typescript && npm run test:browser && npm run lint","test:node":"mocha","test:browser":"karma start --single-run","test:typescript":"tsc --noEmit test/specs/typescript.spec.ts","coverage":"npm run coverage:node && npm run coverage:browser","coverage:node":"nyc --reporter=text --reporter=lcov node_modules/mocha/bin/mocha","coverage:browser":"npm run test:browser -- --coverage","upgrade":"npm-check -u && npm audit fix","bump":"bump --tag --push --all","release":"npm run upgrade && npm run clean && npm run build && npm test && npm run bump"},"devDependencies":{"@babel/polyfill":"^7.8.3","@jsdevtools/eslint-config-modular":"^8.0.0","@jsdevtools/host-environment":"^2.0.1","@jsdevtools/karma-config":"^3.1.1","@jsdevtools/tslint-modular":"^2.0.1","@jsdevtools/version-bump-prompt":"^6.0.0","@types/node":"^13.7.1","chai":"^4.2.0","eslint":"^6.8.0","karma":"^4.4.1","karma-cli":"^2.0.0","mocha":"^7.0.1","npm-check":"^5.9.0","nyc":"^15.0.0","shx":"^0.3.2","tslint":"^6.0.0","typescript":"^3.7.5","typescript-tslint-plugin":"^0.5.5"},"dependencies":{},"gitHead":"bb918d347d4202d4e81a67a0425ec076ba331e03","bugs":{"url":"https://github.com/JS-DevTools/ono/issues"},"_id":"@jsdevtools/ono@6.0.1","_nodeVersion":"13.3.0","_npmVersion":"6.13.1","dist":{"shasum":"85537c2a87e2c4c0cdac7eacae8bfa56a68bd93d","size":20038,"noattachment":false,"key":"/@jsdevtools/ono/-/@jsdevtools/ono-6.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@jsdevtools/ono/download/@jsdevtools/ono-6.0.1.tgz"},"maintainers":[{"name":"jamesmessinger","email":"james.messinger@gmail.com"},{"name":"mcous","email":""},{"name":"philsturgeon","email":"me@philsturgeon.uk"}],"_npmUser":{"name":"jamesmessinger","email":"james.messinger@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ono_6.0.1_1581858315828_0.8089903253245421"},"_hasShrinkwrap":false,"publish_time":1581858316011,"_cnpm_publish_time":1581858316011}},"readme":"ono (Oh No!)\n============================\n### Throw better errors.\n\n[![npm](https://img.shields.io/npm/v/@jsdevtools/ono.svg)](https://www.npmjs.com/package/@jsdevtools/ono)\n[![License](https://img.shields.io/npm/l/@jsdevtools/ono.svg)](LICENSE)\n[![Buy us a tree](https://img.shields.io/badge/Treeware-%F0%9F%8C%B3-lightgreen)](https://plant.treeware.earth/JS-DevTools/ono)\n\n[![Build Status](https://github.com/JS-DevTools/ono/workflows/CI-CD/badge.svg)](https://github.com/JS-DevTools/ono/actions)\n[![Coverage Status](https://coveralls.io/repos/github/JS-DevTools/ono/badge.svg?branch=master)](https://coveralls.io/github/JS-DevTools/ono)\n[![Dependencies](https://david-dm.org/JS-DevTools/ono.svg)](https://david-dm.org/JS-DevTools/ono)\n\n[![OS and Browser Compatibility](https://jstools.dev/img/badges/ci-badges-with-ie.svg)](https://github.com/JS-DevTools/ono/actions)\n\n\n\nFeatures\n--------------------------\n- Wrap and re-throw an error _without_ losing the original error's type, message, stack trace, and properties\n\n- Add custom properties to errors &mdash; great for error numbers, status codes, etc.\n\n- Use [format strings](#format-option) for error messages &mdash; great for localization\n\n- Enhanced support for [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) and [`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) &mdash; great for logging\n\n- Supports and enhances your own [custom error classes](#custom-error-classes)\n\n- Tested on Node.js and all modern web browsers on Mac, Windows, and Linux.\n\n\n\nExample\n--------------------------\n\n```javascript\nconst ono = require(\"@jsdevtools/ono\");\n\n// Throw an error with custom properties\nthrow ono({ code: \"NOT_FOUND\", status: 404 }, `Resource not found: ${url}`);\n\n// Wrap an error without losing the original error's stack and props\nthrow ono(originalError, \"An error occurred while saving your changes\");\n\n// Wrap an error and add custom properties\nthrow ono(originalError, { code: 404, status: \"NOT_FOUND\" });\n\n// Wrap an error, add custom properties, and change the error message\nthrow ono(originalError, { code: 404, status: \"NOT_FOUND\" }, `Resource not found: ${url}`);\n\n// Throw a specific Error subtype instead\n// (works with any of the above signatures)\nthrow ono.range(...);                           // RangeError\nthrow ono.syntax(...);                          // SyntaxError\nthrow ono.reference(...);                       // ReferenceError\n\n// Create an Ono method for your own custom error class\nconst { Ono } = require(\"@jsdevtools/ono\");\nclass MyErrorClass extends Error {}\nono.myError = new Ono(MyErrorClass);\n\n// And use it just like any other Ono method\nthrow ono.myError(...);                         // MyErrorClass\n```\n\n\n\nInstallation\n--------------------------\nInstall using [npm](https://docs.npmjs.com/about-npm/):\n\n```bash\nnpm install @jsdevtools/ono\n```\n\n\n\nUsage\n--------------------------\nWhen using Ono in Node.js apps, you'll probably want to use **CommonJS** syntax:\n\n```javascript\nconst ono = require(\"@jsdevtools/ono\");\n```\n\nWhen using a transpiler such as [Babel](https://babeljs.io/) or [TypeScript](https://www.typescriptlang.org/), or a bundler such as [Webpack](https://webpack.js.org/) or [Rollup](https://rollupjs.org/), you can use **ECMAScript modules** syntax instead:\n\n```javascript\nimport ono from \"@jsdevtools/ono\";\n```\n\n\n\nBrowser support\n--------------------------\nOno supports recent versions of every major web browser.  Older browsers may require [Babel](https://babeljs.io/) and/or [polyfills](https://babeljs.io/docs/en/next/babel-polyfill).\n\nTo use Ono in a browser, you'll need to use a bundling tool such as [Webpack](https://webpack.js.org/), [Rollup](https://rollupjs.org/), [Parcel](https://parceljs.org/), or [Browserify](http://browserify.org/). Some bundlers may require a bit of configuration, such as setting `browser: true` in [rollup-plugin-resolve](https://github.com/rollup/rollup-plugin-node-resolve).\n\n\n\nAPI\n--------------------------\n### `ono([originalError], [props], [message, ...])`\nCreates an [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object with the given properties.\n\n* `originalError` - _(optional)_ The original error that occurred, if any. This error's message, stack trace, and properties will be copied to the new error. If this error's type is one of the [known error types](#specific-error-types), then the new error will be of the same type.\n\n* `props` - _(optional)_ An object whose properties will be copied to the new error. Properties can be anything, including objects and functions.\n\n* `message` - _(optional)_ The error message string. If it contains placeholders, then pass each placeholder's value as an additional parameter.  See the [`format` option](#format-option) for more info.\n\n### Specific error types\nThe default `ono()` function may return an instance of the base [`Error` class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error), or it may return a more specific sub-class, based on the type of the `originalError` argument.  If you want to _explicitly_ create a specific type of error, then you can use any of the following methods:\n\nThe method signatures and arguments are exactly the same as [the default `ono()` function](#onooriginalerror-props-message-).\n\n|Method                      | Return Type\n|:---------------------------|:-------------------\n|`ono.error()`               |[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)\n|`ono.eval()`                |[`EvalError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError)\n|`ono.range()`               |[`RangeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError)\n|`ono.reference()`           |[`ReferenceError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError)\n|`ono.syntax()`              |[`SyntaxError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError)\n|`ono.type()`                |[`TypeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError)\n|`ono.uri()`                 |[`URIError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError)\n|`ono.yourCustomErrorHere()` |Add your own [custom error classes](#custom-error-classes) to ono\n\n\n\n### `Ono(Error, [options])`\nThe `Ono` constructor is used to create your own [custom `ono` methods](#custom-error-classes) for custom error types, or to change the default behavior of the built-in methods.\n\n> **Warning:** Be sure not to confuse `ono` (lowercase) and `Ono` (capitalized). The latter one is a class.\n\n* `Error` - The Error sub-class that this Ono method will create instances of\n\n* `options` - _(optional)_ An [options object](#options), which customizes the behavior of the Ono method\n\n\n\nOptions\n---------------------------------\nThe `Ono` constructor takes an optional options object as a second parameter. The object can have the following properties, all of which are optional:\n\n|Option           |Type        |Default      |Description\n|-----------------|------------|-------------|---------------------------------------------------------------\n|`concatMessages` |boolean     |`true`       |When Ono is used to wrap an error, this setting determines whether the inner error's message is appended to the new error message.\n|`format`         |function or boolean |[`util.format()`](https://nodejs.org/api/util.html#util_util_format_format_args) in Node.js<br><br>`false` in web browsers|A function that replaces placeholders like in error messages with values.<br><br>If set to `false`, then error messages will be treated as literals and no placeholder replacement will occur.\n\n\n### `concatMessages` Option\nWhen wrapping an error, Ono's default behavior is to append the error's message to your message, with a newline between them.  For example:\n\n```javascript\nconst ono = require(\"@jsdevtools/ono\");\n\nfunction createArray(length) {\n  try {\n    return new Array(length);\n  }\n  catch (error) {\n    // Wrap and re-throw the error\n    throw ono(error, \"Sorry, I was unable to create the array.\");\n  }\n}\n\n// Try to create an array with a negative length\ncreateArray(-5);\n```\n\nThe above code produces the following error message:\n\n```\nSorry, I was unable to create the array.\nInvalid array length;\n```\n\nIf you'd rather not include the original message, then you can set the `concatMessages` option to `false`. For example:\n\n```javascript\nconst { ono, Ono } = require(\"@jsdevtools/ono\");\n\n// Override the default behavior for the RangeError\nono.range = new Ono(RangeError, { concatMessages: false });\n\nfunction createArray(length) {\n  try {\n    return new Array(length);\n  }\n  catch (error) {\n    // Wrap and re-throw the error\n    throw ono(error, \"Sorry, I was unable to create the array.\");\n  }\n}\n\n// Try to create an array with a negative length\ncreateArray(-5);\n```\n\nNow the error only includes your message, not the original error message.\n\n```\nSorry, I was unable to create the array.\n```\n\n\n### `format` option\nThe `format` option let you set a format function, which replaces placeholders in error messages with values.\n\nWhen running in Node.js, Ono uses [the `util.format()` function](https://nodejs.org/api/util.html#util_util_format_format_args) by default, which lets you use placeholders such as %s, %d, and %j. You can provide the values for these placeholders when calling any Ono method:\n\n```javascript\nthrow ono(\"%s is invalid. Must be at least %d characters.\", username, minLength);\n```\n\nOf course, the above example could be accomplished using [ES6 template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) instead of format strings:\n\n```javascript\nthrow ono(`${username} is invalid. Must be at least ${minLength} characters.`);\n```\n\nFormat strings are most useful when you don't alrady know the values at the time that you're writing the string. A common scenario is localization.  Here's a simplistic example:\n\n```javascript\nconst errorMessages {\n  invalidLength: {\n    en: \"%s is invalid. Must be at least %d characters.\",\n    es: \"%s no es válido. Debe tener al menos %d caracteres.\",\n    zh: \"%s 无效。 必须至少%d个字符。\",\n  }\n}\n\nlet lang = getCurrentUsersLanguage();\n\nthrow ono(errorMessages.invalidLength[lang], username, minLength);\n```\n\n#### The `format` option in web browsers\nWeb browsers don't have a built-in equivalent of Node's [`util.format()` function](https://nodejs.org/api/util.html#util_util_format_format_args), so format strings are only supported in Node.js by default.  However, you can set the `format` option to any compatible polyfill library to enable this functionality in web browsers too.\n\nHere are some compatible polyfill libraries:\n\n- [format](https://www.npmjs.com/package/format)\n- [format-util](https://github.com/tmpfs/format-util)\n\n\n#### Custom `format` implementation\nIf the standard [`util.format()`](https://nodejs.org/api/util.html#util_util_format_format_args) functionality isn't sufficient for your needs, then you can set the `format` option to your own custom implementation.  Here's a simplistic example:\n\n```javascript\nconst { ono, Ono } = require(\"@jsdevtools/ono\");\n\n// This is a simple formatter that replaces $0, $1, $2, ... with the corresponding argument\nlet options = {\n  format(message, ...args) {\n    for (let [index, arg] of args.entries()) {\n      message = message.replace(\"$\" + index, arg);\n    }\n    return message;\n  }\n};\n\n// Use your custom formatter for all of the built-in error types\nono.error = new Ono(Error, options);\nono.eval = new Ono(EvalError, options);\nono.range = new Ono(RangeError, options);\nono.reference = new Ono(ReferenceError, options);\nono.syntax = new Ono(SyntaxError, options);\nono.type = new Ono(TypeError, options);\nono.uri = new Ono(URIError, options);\n\n// Now all Ono functions support your custom formatter\nthrow ono(\"$0 is invalid. Must be at least $1 characters.\", username, minLength);\n```\n\n\n\n\nCustom Error Classes\n-----------------------------\nThere are two ways to use Ono with your own custom error classes.  Which one you choose depends on what parameters your custom error class accepts, and whether you'd prefer to use `ono.myError()` syntax or `new MyError()` syntax.\n\n### Option 1: Standard Errors\nOno has built-in support for all of [the built-in JavaScript Error types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types).  For example, you can use `ono.reference()` to create a `ReferenceError`, or `ono.syntax()` to create a `SyntaxError`.\n\nAll of these built-in JavaScript Error types accept a single parameter: the error message string. If your own error classes also work this way, then you can create Ono methods for your custom error classes. Here's an example:\n\n```javascript\nconst { ono, Ono } = require(\"@jsdevtools/ono\");\nlet counter = 0;\n\n// A custom Error class that assigns a unique ID and timestamp to each error\nclass MyErrorClass extends Error {\n  constructor(message) {\n    super(message);\n    this.id = ++counter;\n    this.timestamp = new Date();\n  }\n}\n\n// Create a new Ono method for your custom Error class\nono.myError = new Ono(MyErrorClass);\n\n// You can use this method just like any other Ono method\nthrow ono.myError({ code: 404, status: \"NOT_FOUND\" }, `Resource not found: ${url}`);\n```\n\nThe code above throws an instance of `MyErrorClass` that looks like this:\n\n```javascript\n{\n  \"name\": \"MyErrorClass\",\n  \"message\": \"Resource not found: xyz.html\",\n  \"id\": 1,\n  \"timestamp\": \"2019-01-01T12:30:00.456Z\",\n  \"code\": 404,\n  \"status\": \"NOT_FOUND\",\n  \"stack\": \"MyErrorClass: Resource not found: xyz.html\\n   at someFunction (index.js:24:5)\",\n}\n```\n\n### Option 2: Enhanced Error Classes\nIf your custom error classes require more than just an error message string parameter, then you'll need to use Ono differently. Rather than creating a [custom Ono method](#option-1-standard-errors) and using `ono.myError()` syntax, you'll use Ono _inside_ your error class's constructor. This has a few benefits:\n\n- Your error class can accept whatever parameters you want\n- Ono is encapsulated within your error class\n- You can use `new MyError()` syntax rather than `ono.myError()` syntax\n\n```javascript\nconst { ono, Ono } = require(\"@jsdevtools/ono\");\n\n// A custom Error class for 404 Not Found\nclass NotFoundError extends Error {\n  constructor(method, url) {\n    super(`404: ${method} ${url} was not found`);\n\n    // Add custom properties, enhance JSON.stringify() support, etc.\n    Ono.extend(this, { statusCode: 404, method, url });\n  }\n}\n\n// A custom Error class for 500 Server Error\nclass ServerError extends Error {\n  constructor(originalError, method, url) {\n    super(`500: A server error occurred while responding to ${method} ${url}`);\n\n    // Append the stack trace and custom properties of the original error,\n    // and add new custom properties, enhance JSON.stringify() support, etc.\n    Ono.extend(this, originalError, { statusCode: 500, method, url });\n  }\n}\n```\n\n\n\nContributing\n--------------------------\nContributions, enhancements, and bug-fixes are welcome!  [Open an issue](https://github.com/JS-DevTools/ono/issues) on GitHub and [submit a pull request](https://github.com/JS-DevTools/ono/pulls).\n\n#### Building/Testing\nTo build/test the project locally on your computer:\n\n1. __Clone this repo__<br>\n`git clone https://github.com/JS-DevTools/ono.git`\n\n2. __Install dependencies__<br>\n`npm install`\n\n3. __Run the build script__<br>\n`npm run build`\n\n4. __Run the tests__<br>\n`npm test`\n\n\n\nLicense\n--------------------------\nOno is 100% free and open-source, under the [MIT license](LICENSE). Use it however you want.\n\nThis package is [Treeware](http://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/JS-DevTools/ono) to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.\n\n\n\nBig Thanks To\n--------------------------\nThanks to these awesome companies for their support of Open Source developers ❤\n\n[![Travis CI](https://jstools.dev/img/badges/travis-ci.svg)](https://travis-ci.com)\n[![SauceLabs](https://jstools.dev/img/badges/sauce-labs.svg)](https://saucelabs.com)\n[![Coveralls](https://jstools.dev/img/badges/coveralls.svg)](https://coveralls.io)\n","_attachments":{},"homepage":"https://jstools.dev/ono","bugs":{"url":"https://github.com/JS-DevTools/ono/issues"},"license":"MIT"}