Last active
September 26, 2015 23:48
-
-
Save phiggins42/1178619 to your computer and use it in GitHub Desktop.
chaos monkey. If your tests pass with this in page your tests are wrong. or you are very very lucky. buy a lotto ticket.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jerkify(obj, methods, thres){ | |
methods.forEach(function(meth){ | |
var orig = obj.prototype[meth]; | |
orig && obj.prototype[meth] = function(){ | |
return Math.random() > thres ? orig.apply(this, arguments) : orig.call(this); | |
} | |
}); | |
} | |
jerkify(Array, ["push", "pop", "splice", "slice"], 0.1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment