/**1* Copyright (c) 2014-2015, Facebook, Inc.2* All rights reserved.3*4* This source code is licensed under the BSD-style license found in the5* LICENSE file in the root directory of this source tree. An additional grant6* of patent rights can be found in the PATENTS file in the same directory.7*8* @providesModule invariant9*/1011"use strict";1213/**14* Use invariant() to assert state which your program assumes to be true.15*16* Provide sprintf-style format (only %s is supported) and arguments17* to provide information about what broke and what you were18* expecting.19*20* The invariant message will be stripped in production, but the invariant21* will remain to ensure logic does not differ in production.22*/2324var invariant = function(condition, format, a, b, c, d, e, f) {25if (__DEV__) {26if (format === undefined) {27throw new Error('invariant requires an error message argument');28}29}3031if (!condition) {32var error;33if (format === undefined) {34error = new Error(35'Minified exception occurred; use the non-minified dev environment ' +36'for the full error message and additional helpful warnings.'37);38} else {39var args = [a, b, c, d, e, f];40var argIndex = 0;41error = new Error(42'Invariant Violation: ' +43format.replace(/%s/g, function() { return args[argIndex++]; })44);45}4647error.framesToPop = 1; // we don't care about invariant's own frame48throw error;49}50};5152module.exports = invariant;535455