2.2.4 • Published 4 years ago

invariant v2.2.4

Weekly downloads
11,382,438
License
MIT
Repository
github
Last release
4 years ago

invariant

Build Status

A mirror of Facebook's invariant (e.g. React, flux).

A way to provide descriptive errors in development but generic errors in production.

Install

With npm do:

npm install invariant

invariant(condition, message)

var invariant = require('invariant');

invariant(someTruthyVal, 'This will not throw');
// No errors

invariant(someFalseyVal, 'This will throw an error with this message');
// Error: Invariant Violation: This will throw an error with this message

Note: When process.env.NODE_ENV is not production, the message is required. If omitted, invariant will throw regardless of the truthiness of the condition. When process.env.NODE_ENV is production, the message is optional – so they can be minified away.

Browser

When used with browserify, it'll use browser.js (instead of invariant.js) and the envify transform will inline the value of process.env.NODE_ENV.

Node

The node version is optimized around the performance implications of accessing process.env. The value of process.env.NODE_ENV is cached, and repeatedly used instead of reading process.env. See Server rendering is slower with npm react #812

babel-traversereact-helmet-asyncreact-sizeme@reach/routerrelay-runtimeuncontrollablebabel-preset-env@haravan/app-authtest-g-pcsola-react-nativetim-dva-corereact-native-bluetooth2killi8n-react-native-fast-image@invoice-simple/react-intl@likethemammal/react-primitives@likethemammal/react-primitives_react-native-web_latest@sinakhx/react-big-calendarreact-native-for-sanbotparadicms-base@tetherless-world/twxplore-base-libstrapi-plugin-upload-filepond@miot-plugin/react-navigation-redux-helperscarbon-addons-boomerang-react@epranka/test-schema@that1matt/react-css-themrjsx-stylexcaoliao-helper-plugincaoliao-plugin-content-managercaoliao-plugin-content-type-buildercaoliao-plugin-documentationcaoliao-plugin-settings-managercaoliao-plugin-uploadcaoliao-plugin-users-permissionsflowbuilder-test@fadi-saadeldin/react-big-calenderrn-send-smsrand-react-helmet-asyncr15-happy-router@amra-finance/ding@icanpm/api-master@runjuuu/react-native-webviewbutton-animations-react@darcusfenix/react-redux@darcusfenix/redux-form@mallpay/routerreact-tools-cliweb-deployredux-reqs@arisageha/react-lazyload@arisageha/react-lazyload-fixinfoniqa-client-corereact-awesome-tab@danielballardp/infoniqa-client-core@cashremit/cr-streamline-icons@sellics/rankingsreact-native-wk-viewreact-native-sketchappevaformrn-device-informationreplot-wordcloud@composer/routerredux-questvaluecoupon@paradicms/basegatsby-theme-lumenreact-redux-combine-components@nick-thompson/react-jucereact-native-template-rfbase@zaydek/document-titlevscode-intl-javascript-plugin-mdsegenie-rn-react-native-communityairscanairscan-examplepock-meta-statebb-chatredux-form-5redux-remakereact-native-esc-pos-sahaabmotivated@ihikmawan/tailwindcss-multi-theme-l2@borisovart/atol-kkt-module@phil8795/pecuniarius-api@drawerapp/react-native-webview@hgc-ab/coresweepr-react-native-webviewdeneme323112instant-bookerjw-react-naver-maps@bayerischer-rundfunk/react-intligen-react-native-webview@igen/react-native-webview@ntt_app/react-native-custom-notificationreact-native-custom-text-hwjames@hai5/react-native-onesignal@fugood/react-native-zoom-us@cutting/react-typed-mousetrap@ceed/components-react@rexlabs-spicerhaart/toast@rexlabs-spicerhaart/model-generator@rexlabs-spicerhaart/portal
2.2.4

4 years ago

2.2.3

4 years ago

2.2.2

6 years ago

2.2.1

6 years ago

2.2.0

7 years ago

2.1.3

7 years ago

2.1.2

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago