{"name":"tiny-warning","version":"1.0.1","keywords":["warning","warn"],"description":"A tiny warning function","main":"dist/tiny-warning.cjs.js","module":"dist/tiny-warning.esm.js","sideEffects":false,"author":{"name":"Alex Reardon","email":"alexreardon@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/alexreardon/tiny-warning.git"},"license":"MIT","scripts":{"test":"yarn jest","lint":"yarn prettier --debug-check src/** test/**","typecheck":"yarn flow","validate":"yarn lint && yarn flow","build:clean":"rimraf dist","build:flow":"echo \"// @flow\n\nexport * from '../src';\" > dist/tiny-warning.cjs.js.flow","build:dist":"yarn rollup --config rollup.config.js","build":"yarn build:clean && yarn build:dist && yarn build:flow","prepublishOnly":"yarn build"},"devDependencies":{"@babel/core":"^7.2.2","@babel/preset-env":"^7.2.0","@babel/preset-flow":"^7.0.0","babel-core":"7.0.0-bridge.0","babel-jest":"^23.6.0","flow-bin":"0.89.0","jest":"^23.6.0","prettier":"1.15.3","rimraf":"^2.6.2","rollup":"^0.68.0","rollup-plugin-babel":"^4.1.0","rollup-plugin-replace":"^2.1.0","rollup-plugin-uglify":"^6.0.0"},"gitHead":"229c545812da2b2caa240432b86552d61fd70779","bugs":{"url":"https://github.com/alexreardon/tiny-warning/issues"},"homepage":"https://github.com/alexreardon/tiny-warning#readme","_id":"tiny-warning@1.0.1","_npmVersion":"6.1.0","_nodeVersion":"8.11.3","_npmUser":{"name":"alexreardon","email":"alexreardon@gmail.com"},"dist":{"integrity":"sha512-kcH7qxiyGWPe7xWOFnLrea2F4QYKRjXDRPmXqT9vqF7AhCPcljGoyG2xD6S7N73S5NWVJDfpPSS8d3HKdhcbSA==","shasum":"5e4d3eb25eb1733252dcd676ff673c3335bff517","tarball":"http://registry-npm.ywwl.com/tiny-warning/download/tiny-warning-1.0.1.tgz","fileCount":8,"unpackedSize":6890,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcGLfqCRA9TVsSAnZWagAAk+0QAIMSB96JBhyyDbIa5kdR\nQLhY64h+CVwrrTo9e4V4lDIJDiIdjL4GoJexPUrBAd620lPEvhNRR1fHR3v+\nqEQh6qkiywWzFg+342pefS6ssvX77P84FHAk3m0drkZB4a3z+KNwHKa817AT\nE5suOO8ML0h0AnJqwasGuLNVb8WptCIAoTVUQ2gHwJX/N4+yjWSwcCeJv3Qn\n8zvyhDf+/hXceLYNpyAUCna5ZYyNwhe0LALk2cvR4kiqvSxi9XFaf1JV5LYZ\nw+jQVNuK9boJFFYfoMtNJkk4Q3lERdWzNScdD8CLZEfZYgG3ckcVt02k84xm\n4n4dLE1W9XvfjVfvIAZktXgs3P8Jy9Y+EMhNFNRNuA98N6SgPSz+568xvoPj\nJK7tR3AylHytQL5PFqyl4Y/EThPk32mU3tMv3iptgDI0DjskWdWUUttjGAtd\nMTSa3JOkiQ+mt+2O8LDuV5xTq5KZIHTf2Q6n/GKaMfCzwiwkzwAAfm5s/9X6\ncIMRFcp1I596N6hhXii3v1GGec5MdmJjRiPPNPgKdqYl6MxG/5zAer97en7f\nLa3aps2e+G3Iz1ZEz5CEhWdqCl+vDMnHa9N6B0YbskcR12Zvm4EAxYf0NJ/k\nac5p7fk9yXqydnxi2aKNRso8Kz+Hmcuzi1N3exeAnK+BiJfMsknMIrJSD6ek\nFJX/\r\n=ZxwY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCL2JOaN0G8xXjbVs5HjiyRqvl0Frlu0A721qVRBl4DSQIhAOTfQICjerKK+3TtvEn5AKJq7RXif31Gw4ikdf9pOl9e"}],"size":2829,"noattachment":false,"key":"/tiny-warning/-/tiny-warning-1.0.1.tgz"},"maintainers":[{"name":"alexreardon","email":"alexreardon@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tiny-warning_1.0.1_1545123817514_0.7342832092487652"},"_hasShrinkwrap":false,"readme":"# tiny-warning 🔬⚠️\n\n[![Build Status](https://travis-ci.org/alexreardon/tiny-warning.svg?branch=master)](https://travis-ci.org/alexreardon/tiny-warning)\n[![npm](https://img.shields.io/npm/v/tiny-warning.svg)](https://www.npmjs.com/package/tiny-warning) [![Downloads per month](https://img.shields.io/npm/dm/tiny-warning.svg)](https://www.npmjs.com/package/tiny-warning) [![dependencies](https://david-dm.org/alexreardon/tiny-warning.svg)](https://david-dm.org/alexreardon/tiny-warning)\n[![min](https://img.shields.io/bundlephobia/min/tiny-warning.svg)](https://www.npmjs.com/package/tiny-warning)\n[![minzip](https://img.shields.io/bundlephobia/minzip/tiny-warning.svg)](https://www.npmjs.com/package/tiny-warning)\n\nA tiny [`warning`](https://www.npmjs.com/package/warning) alternative.\n\n```js\nimport warning from 'tiny-warning';\n\nwarning(truthyValue, 'This should not log a warning');\n\nwarning(falsyValue, 'This should log a warning');\n// console.warn('Warning: This should log a warning');\n```\n\n## API: `(condition: mixed, message: string) => void`\n\n- `condition` is required and can be anything\n- `message` is an required string that will be passed onto `console.warn`\n\n## Why `tiny-warning`?\n\nThe [`library: warning`](https://www.npmjs.com/package/warning) supports passing in arguments to the `warning` function in a sprintf style `(condition, format, a, b, c, d, e, f)`. It has internal logic to execute the sprintf substitutions. `tiny-warning` has dropped all of the sprintf logic. `tiny-warning` allows you to pass a single string message. With [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) there is really no need for a custom message formatter to be built into the library. If you need a multi part message you can just do this: `warning(condition, 'Hello, ${name} - how are you today?')`\n\n## Dropping your `warning` for kb savings!\n\nWe recommend using [`babel-plugin-dev-expression`](https://www.npmjs.com/package/babel-plugin-dev-expression) to remove `warning` calls from your production build. This saves you kb's as well as avoids logging warnings to the console for production.\n\nWhat it does it turn your code that looks like this:\n\n```js\nwarning(condition, 'My cool message that takes up a lot of kbs');\n```\n\nInto this\n\n```js\nif ('production' !== process.env.NODE_ENV) {\n  warning(condition, 'My cool message that takes up a lot of kbs');\n}\n```\n\nYour bundler can then drop the code in the `\"production\" !== process.env.NODE_ENV` block for your production builds\n\nFinal result:\n\n```js\n// nothing to see here! 👍\n```\n\n> For `rollup` use [rollup-plugin-replace](https://github.com/rollup/rollup-plugin-replace) and set `NODE_ENV` to `production` and then `rollup` will treeshake out the unused code\n>\n> [`Webpack` instructions](https://webpack.js.org/guides/production/#specify-the-mode)\n\n## Builds\n\n- We have a `es` (EcmaScript module) build (because you _know_ you want to deduplicate this super heavy library)\n- We have a `cjs` (CommonJS) build\n- We have a `umd` (Universal module definition) build in case you needed it\n\nWe expect `process.env.NODE_ENV` to be available at module compilation. We cache this value\n\n## That's it!\n\n🤘\n","publish_time":1545123817653,"_cnpm_publish_time":1545123817653,"dist-tags":{"latest":"1.0.3"}}