The library for web and native user interfaces.
Remove second argument to invariant()
petehunt committed
Jun 16, 2013 at 19:35 UTC
7053f59ad11c3483da1c163f80c4b2de7f901f77
1 file changed
+9
vendor/constants.js
+9
@@ -34,6 +34,15 @@ var ConstantVisitor = recast.Visitor.extend({
34
}
35
},
36
37
+ visitCallExpression: function(call) {
38
+ if (!this.constants.__DEV__) {
39
+ if (call.callee.type === 'Identifier' && call.callee.name === 'invariant') {
40
+ call.arguments.length = 1;
41
+ }
42
+ }
43
+ this.genericVisit(call);
44
+ },
45
+
46
visitIfStatement: function(stmt) {
47
// Replaces all identifiers in this.constants with literal values.
48
this.genericVisit(stmt);