Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* will remain to ensure logic does not differ in production.
*/

var invariant = function(condition, format, a, b, c, d, e, f) {
var invariant = function(condition, format, ...args) {
if (process.env.NODE_ENV !== 'production') {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
Expand All @@ -33,7 +33,6 @@ var invariant = function(condition, format, a, b, c, d, e, f) {
'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++]; })
Expand Down
3 changes: 1 addition & 2 deletions invariant.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

var NODE_ENV = process.env.NODE_ENV;

var invariant = function(condition, format, a, b, c, d, e, f) {
var invariant = function(condition, format, ...args) {
if (NODE_ENV !== 'production') {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
Expand All @@ -35,7 +35,6 @@ var invariant = function(condition, format, a, b, c, d, e, f) {
'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++]; })
Expand Down
2 changes: 1 addition & 1 deletion invariant.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
declare module.exports: (
condition: any,
format?: string,
...args: Array<any>
args?: Array<any>
) => void;