Comparing version
@@ -0,1 +1,14 @@ | ||
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 | ||
@@ -10,3 +23,3 @@ ================== | ||
* Added tests, npmignore and gitignore. | ||
* Clarifications in README | ||
* Clarifications in README. | ||
@@ -16,3 +29,3 @@ 1.0.1 / 2014-09-24 | ||
* Actually include 'invariant.js' | ||
* Actually include 'invariant.js'. | ||
@@ -22,2 +35,2 @@ 1.0.0 / 2014-09-24 | ||
* Initial release | ||
* Initial release. |
{ | ||
"name": "invariant", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "invariant", | ||
"license": "BSD", | ||
"keywords": [ | ||
"test" | ||
], | ||
"license": "BSD-4-Clause", | ||
"author": "Andres Suarez <zertosh@gmail.com>", | ||
"files": [ | ||
"README.md", | ||
"invariant.js", | ||
"browser.js" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/zertosh/invariant.git" | ||
}, | ||
"repository": "zertosh/invariant", | ||
"scripts": { | ||
"test": "NODE_ENV=production mocha && NODE_ENV=development mocha" | ||
"test": "NODE_ENV=production tap test/*.js && NODE_ENV=development tap test/*.js" | ||
}, | ||
"dependencies": { | ||
"envify": "^3.0.0" | ||
"loose-envify": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^2.1.0" | ||
"browserify": "^11.0.1", | ||
"tap": "^1.4.0" | ||
}, | ||
"engines": { | ||
"node": ">=0.10" | ||
}, | ||
"main": "invariant.js", | ||
@@ -32,5 +29,5 @@ "browser": "browser.js", | ||
"transform": [ | ||
"envify" | ||
"loose-envify" | ||
] | ||
} | ||
} |
@@ -1,21 +0,35 @@ | ||
# invariant # | ||
# invariant | ||
A mirror of Facebook's `invariant` (e.g. [React](https://github.com/facebook/react/blob/master/src/vendor/core/invariant.js), [flux](https://github.com/facebook/flux/blob/master/src/invariant.js)). | ||
[](https://travis-ci.org/zertosh/invariant) | ||
### Usage | ||
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 envify invariant | ||
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 | ||
``` | ||
#### Browser | ||
**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. | ||
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`. | ||
### Browser | ||
#### Node | ||
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) |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
5954
18.04%0
-100%0
-100%36
63.64%2
100%1
Infinity%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed