{"name":"tiny-warning","version":"0.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"},"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-cli":"^6.26.0","babel-core":"^6.26.3","babel-plugin-transform-es2015-modules-commonjs":"^6.26.2","babel-preset-env":"^1.7.0","babel-preset-flow":"^6.23.0","flow-bin":"^0.78.0","jest":"^23.5.0","prettier":"^1.14.2","rimraf":"^2.6.2","rollup":"^0.64.1","rollup-plugin-babel":"^3.0.7","rollup-plugin-replace":"^2.0.0","rollup-plugin-uglify":"^4.0.0"},"gitHead":"a49955461bf2e8bdbbb2b1173273329611d339a1","_id":"tiny-warning@0.0.1","_npmVersion":"6.1.0","_nodeVersion":"8.11.3","_npmUser":{"name":"alexreardon","email":"alexreardon@gmail.com"},"dist":{"integrity":"sha512-XaDGcgZwOgejSWN6CL3GVqCdMwr8ZFu7hTFrl2cnE6/LEGuffvQYePWAYbwtKkJhnzhClySc9W5nTGprPM0oKw==","shasum":"a0f5fce64a15c8d5c16e985136feaca5a3a8ae2c","tarball":"http://registry-npm.ywwl.com/tiny-warning/download/tiny-warning-0.0.1.tgz","fileCount":8,"unpackedSize":3420,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbsxF+CRA9TVsSAnZWagAACTMP/iRISIPv+rQFd8rX4c22\nAXEveP6N1qZLB/jrG6IX+H32jWDMUWzSXJrsrYm05sHR0gj357uAMucWs92R\nHJGELHV586DBF3eKKctmzHtrx/f8YbQnf33qC0ef7viHrggUlxoL+x0tLBDh\nbjTbPm1u1IDrawwzfCLz9h9xday5Ajj1ZT+pTXF3ADwGdWJzTy/zK3cVBESV\nJv2+X0i88Xo1/gG+mYAZO5a4b+DJbDt6n5ofE9jCU7FCE0mAQ1chFG/V89/o\ngYbtiFxVYZQ4mHTGGpJ0WL61/Et91QzPygw75sjiBCGyTDRTKSvPzd7rGDtk\nGn7wq59wusZc0/qNhfMfamaBuFwH2Har72uCb8wM7YnHfauue/Uhv16EcM+i\nZzvxmM26ldSHLwRqfEODSSimKqfjjrHjnUy+8hl3D3WDYyvCd8ZuHlGDK5ce\nn8lOqkyWeZlwKoQo61+fDoyDM29x0bwYDNczkYYKTpEQ0i1nhJwzk8/9EBdp\nMpjq3uDDYrTf14YaVbf97WW9gFU1xXcqAUKcwVEetLTrMlaN+fR9/Sqm0r35\nK10FzlaCOt7BGFJID06aS47uLtsEG1y0tPoqkblGnnI7PzvDKvjqTj90G30Q\n1Yk506Iczr1k2pvequbUFgdtKKM6Rw1Zp0MFLfmX4VXjRv5lVeGheo5Xns0P\nUwaz\r\n=nFbx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCakTioGzWZQLb1+dzLgsXlT6PvrilTj4Fb7Yq2zz483wIgGh7zcojvpz3V2r17XZE7WclztWoXHxE6iJAvz1YY4xM="}],"size":1497,"noattachment":false,"key":"/tiny-warning/-/tiny-warning-0.0.1.tgz"},"maintainers":[{"name":"alexreardon","email":"alexreardon@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tiny-warning_0.0.1_1538462077811_0.7287856968953319"},"_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":1538462077973,"_cnpm_publish_time":1538462077973,"dist-tags":{"latest":"1.0.3"}}