invariant
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -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)). | ||
[![Build Status](https://travis-ci.org/zertosh/invariant.svg?branch=master)](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) |
Nonpermissive License
License(Experimental) A package's licensing information has fine-grained problems
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found
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
0
0
100
36
2
+ Addedloose-envify@^1.0.0
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
- Removedenvify@^3.0.0
- Removedacorn@5.7.4(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedast-types@0.9.6(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbase62@1.2.8(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcommander@2.20.3(transitive)
- Removedcommoner@0.10.8(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddefined@1.0.1(transitive)
- Removeddetective@4.7.1(transitive)
- Removedenvify@3.4.1(transitive)
- Removedesprima@3.1.3(transitive)
- Removedesprima-fb@15001.1.0-dev-harmony-fb(transitive)
- Removedglob@5.0.15(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjstransform@11.0.3(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedobject-assign@2.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedprivate@0.1.8(transitive)
- Removedq@1.5.1(transitive)
- Removedrecast@0.11.23(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsource-map@0.4.40.5.7(transitive)
- Removedthrough@2.3.8(transitive)
- Removedwrappy@1.0.2(transitive)