{"name":"tiny-warning","version":"0.0.3","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"},"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.1.2","@babel/preset-env":"^7.1.0","@babel/preset-flow":"^7.0.0","babel-core":"7.0.0-bridge.0","babel-jest":"^23.6.0","flow-bin":"^0.82.0","jest":"^23.6.0","prettier":"^1.14.3","rimraf":"^2.6.2","rollup":"^0.66.2","rollup-plugin-babel":"^4.0.3","rollup-plugin-replace":"^2.0.0","rollup-plugin-uglify":"^6.0.0"},"gitHead":"83303f89f8c41d5ed7e6a204904a5527a15c70e2","_id":"tiny-warning@0.0.3","_npmVersion":"6.1.0","_nodeVersion":"8.11.3","_npmUser":{"name":"alexreardon","email":"alexreardon@gmail.com"},"dist":{"integrity":"sha512-r0SSA5Y5IWERF9Xh++tFPx0jITBgGggOsRLDWWew6YRw/C2dr4uNO1fw1vanrBmHsICmPyMLNBZboTlxUmUuaA==","shasum":"1807eb4c5f81784a6354d58ea1d5024f18c6c81f","tarball":"http://registry-npm.ywwl.com/tiny-warning/download/tiny-warning-0.0.3.tgz","fileCount":8,"unpackedSize":5891,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbs1wYCRA9TVsSAnZWagAAZeYQAJqB2dkx0eJRCKNJHbIc\nLp5gsSpXspl+0GhsJIR8zl66jjpOr7va9k80PQeCGOShHkX69iWOE/k2KN0f\n5jYRjY+JPwpVnpNsKZCbJt8an5KeHiDNzah26iZPP//Plscx2p5AX0TRRcCf\nf3alfHex0QMEGJaWN9pPdypBygByWIGTjhdovgtM+5Qq/EURj5GlRglriscj\n2w/eUY8WwyPFmAiN+13GvyuDF+GYnfnVVM9Mq38MGgnQf2EFNuOkEHoRj0Vy\nKo0n470r+A3g5kh5UjPGD+GtGqj6T5bzjKE1+AdYYCwd6S2obQkBWIhYFydc\nUyWG3KMRZoQAxhJbZi/hqGMAs/DPmiQ/CxOERuEdAa5dr1emuADosVGLMWJu\n7uNjJsNGzaI5I8UpYYNO8/lCbxAQ1vqhJpiecjpErhpPUgbGun3x0g/mApPx\n1G+/PIeseDE/y0qht05iFxQUxBna7+5xHeyzDDjYr7VQ7GSVxOIY+aA1aS8b\nyglI9Rj7vxWmn7FhN0vnRIlCk+KGiYsSO940rTW8g32/AN4/eQdoc7p0JMIC\n5EVgeuoHr5lNkzqZWSoR88MHzj44IEzvRD6HMIBan/Sn46KmDyh+LkQ751ol\nN0c7n/7NsE0e55QVVzlBkSK1mBrV2dccHUZrEIDHOuEwO/7nFyC6Gie6uE1Q\nzPBE\r\n=uLaG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCQwoxvZx2bjmqcYVZwZXpRMY7G0vaFpkMqhaDiLCsCKAIhAMoGU5SYISYEXxCECKTC92EG1hlASUDk/gbG3GZeY43s"}],"size":2555,"noattachment":false,"key":"/tiny-warning/-/tiny-warning-0.0.3.tgz"},"maintainers":[{"name":"alexreardon","email":"alexreardon@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tiny-warning_0.0.3_1538481175606_0.43387464292125144"},"_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":1538481175704,"_cnpm_publish_time":1538481175704,"dist-tags":{"latest":"1.0.3"}}