We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
0 parents commit af55d75Copy full SHA for af55d75
mod.js
@@ -0,0 +1,24 @@
1
+function internal(shouldReturnValue, count, testFunction) {
2
+ if (testFunction === undefined) {
3
+ testFunction = count;
4
+ count = 1000;
5
+ }
6
+
7
+ let currentValue;
8
+ const first = testFunction();
9
10
+ for (let index = 0; index < count; index++) {
11
+ currentValue = testFunction();
12
13
+ if (currentValue !== first) {
14
+ return shouldReturnValue ? currentValue : false;
15
16
17
18
+ return shouldReturnValue ? first : true;
19
+}
20
21
+const stableFunction = internal.bind(null, false);
22
+stableFunction.returnValue = internal.bind(null, true);
23
24
+export default stableFunction;
0 commit comments