aboutsummaryrefslogtreecommitdiff
path: root/node_modules/invariant
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/invariant')
-rw-r--r--node_modules/invariant/CHANGELOG.md33
-rw-r--r--node_modules/invariant/README.md35
-rw-r--r--node_modules/invariant/browser.js51
-rw-r--r--node_modules/invariant/invariant.js53
l---------node_modules/invariant/node_modules/.bin/loose-envify1
-rw-r--r--node_modules/invariant/package.json32
6 files changed, 205 insertions, 0 deletions
diff --git a/node_modules/invariant/CHANGELOG.md b/node_modules/invariant/CHANGELOG.md
new file mode 100644
index 000000000..5326f1a0e
--- /dev/null
+++ b/node_modules/invariant/CHANGELOG.md
@@ -0,0 +1,33 @@
+2.1.1 / 2015-09-20
+==================
+
+ * Use correct SPDX license.
+ * Test "browser.js" using browserify.
+ * Switch from "envify" to "loose-envify".
+
+2.1.0 / 2015-06-03
+==================
+
+ * Add "envify" as a dependency.
+ * Fixed license field in "package.json".
+
+2.0.0 / 2015-02-21
+==================
+
+ * Switch to using the "browser" field. There are now browser and server versions that respect the "format" in production.
+
+1.0.2 / 2014-09-24
+==================
+
+ * Added tests, npmignore and gitignore.
+ * Clarifications in README.
+
+1.0.1 / 2014-09-24
+==================
+
+ * Actually include 'invariant.js'.
+
+1.0.0 / 2014-09-24
+==================
+
+ * Initial release.
diff --git a/node_modules/invariant/README.md b/node_modules/invariant/README.md
new file mode 100644
index 000000000..813ee2647
--- /dev/null
+++ b/node_modules/invariant/README.md
@@ -0,0 +1,35 @@
+# invariant
+
+[![Build Status](https://travis-ci.org/zertosh/invariant.svg?branch=master)](https://travis-ci.org/zertosh/invariant)
+
+A mirror of Facebook's `invariant` (e.g. [React](https://github.com/facebook/react/blob/v0.13.3/src/vendor/core/invariant.js), [flux](https://github.com/facebook/flux/blob/2.0.2/src/invariant.js)).
+
+## Install
+
+With [npm](http://npmjs.org) do:
+
+```sh
+npm install invariant
+```
+
+## `invariant(condition, message)`
+
+```js
+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](https://github.com/substack/node-browserify), it'll use `browser.js` (instead of `invariant.js`) and the [envify](https://github.com/hughsk/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 `proces.env`. See [Server rendering is slower with npm react #812](https://github.com/facebook/react/issues/812)
diff --git a/node_modules/invariant/browser.js b/node_modules/invariant/browser.js
new file mode 100644
index 000000000..29ead5043
--- /dev/null
+++ b/node_modules/invariant/browser.js
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ */
+
+'use strict';
+
+/**
+ * Use invariant() to assert state which your program assumes to be true.
+ *
+ * Provide sprintf-style format (only %s is supported) and arguments
+ * to provide information about what broke and what you were
+ * expecting.
+ *
+ * The invariant message will be stripped in production, but the invariant
+ * will remain to ensure logic does not differ in production.
+ */
+
+var invariant = function(condition, format, a, b, c, d, e, f) {
+ if (process.env.NODE_ENV !== 'production') {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ }
+
+ if (!condition) {
+ var error;
+ if (format === undefined) {
+ error = new Error(
+ 'Minified exception occurred; use the non-minified dev environment ' +
+ 'for the full error message and additional helpful warnings.'
+ );
+ } else {
+ var args = [a, b, c, d, e, f];
+ var argIndex = 0;
+ error = new Error(
+ format.replace(/%s/g, function() { return args[argIndex++]; })
+ );
+ error.name = 'Invariant Violation';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+};
+
+module.exports = invariant;
diff --git a/node_modules/invariant/invariant.js b/node_modules/invariant/invariant.js
new file mode 100644
index 000000000..1859a2a52
--- /dev/null
+++ b/node_modules/invariant/invariant.js
@@ -0,0 +1,53 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ */
+
+'use strict';
+
+/**
+ * Use invariant() to assert state which your program assumes to be true.
+ *
+ * Provide sprintf-style format (only %s is supported) and arguments
+ * to provide information about what broke and what you were
+ * expecting.
+ *
+ * The invariant message will be stripped in production, but the invariant
+ * will remain to ensure logic does not differ in production.
+ */
+
+var NODE_ENV = process.env.NODE_ENV;
+
+var invariant = function(condition, format, a, b, c, d, e, f) {
+ if (NODE_ENV !== 'production') {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ }
+
+ if (!condition) {
+ var error;
+ if (format === undefined) {
+ error = new Error(
+ 'Minified exception occurred; use the non-minified dev environment ' +
+ 'for the full error message and additional helpful warnings.'
+ );
+ } else {
+ var args = [a, b, c, d, e, f];
+ var argIndex = 0;
+ error = new Error(
+ format.replace(/%s/g, function() { return args[argIndex++]; })
+ );
+ error.name = 'Invariant Violation';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+};
+
+module.exports = invariant;
diff --git a/node_modules/invariant/node_modules/.bin/loose-envify b/node_modules/invariant/node_modules/.bin/loose-envify
new file mode 120000
index 000000000..2a6b8df6a
--- /dev/null
+++ b/node_modules/invariant/node_modules/.bin/loose-envify
@@ -0,0 +1 @@
+../../../loose-envify/cli.js \ No newline at end of file
diff --git a/node_modules/invariant/package.json b/node_modules/invariant/package.json
new file mode 100644
index 000000000..3d3ca247d
--- /dev/null
+++ b/node_modules/invariant/package.json
@@ -0,0 +1,32 @@
+{
+ "name": "invariant",
+ "version": "2.2.1",
+ "description": "invariant",
+ "keywords": [
+ "test"
+ ],
+ "license": "BSD-3-Clause",
+ "author": "Andres Suarez <zertosh@gmail.com>",
+ "files": [
+ "invariant.js",
+ "browser.js"
+ ],
+ "repository": "zertosh/invariant",
+ "scripts": {
+ "test": "NODE_ENV=production tap test/*.js && NODE_ENV=development tap test/*.js"
+ },
+ "dependencies": {
+ "loose-envify": "^1.0.0"
+ },
+ "devDependencies": {
+ "browserify": "^11.0.1",
+ "tap": "^1.4.0"
+ },
+ "main": "invariant.js",
+ "browser": "browser.js",
+ "browserify": {
+ "transform": [
+ "loose-envify"
+ ]
+ }
+}