Initial commit
This commit is contained in:
commit
b3a51a4115
10336 changed files with 2381973 additions and 0 deletions
33
node_modules/fast-check/lib/arbitrary/_internals/helpers/StrictlyEqualSet.js
generated
vendored
Normal file
33
node_modules/fast-check/lib/arbitrary/_internals/helpers/StrictlyEqualSet.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StrictlyEqualSet = void 0;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const safeNumberIsNaN = Number.isNaN;
|
||||
class StrictlyEqualSet {
|
||||
constructor(selector) {
|
||||
this.selector = selector;
|
||||
this.selectedItemsExceptNaN = new globals_1.Set();
|
||||
this.data = [];
|
||||
}
|
||||
tryAdd(value) {
|
||||
const selected = this.selector(value);
|
||||
if (safeNumberIsNaN(selected)) {
|
||||
(0, globals_1.safePush)(this.data, value);
|
||||
return true;
|
||||
}
|
||||
const sizeBefore = this.selectedItemsExceptNaN.size;
|
||||
(0, globals_1.safeAdd)(this.selectedItemsExceptNaN, selected);
|
||||
if (sizeBefore !== this.selectedItemsExceptNaN.size) {
|
||||
(0, globals_1.safePush)(this.data, value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
size() {
|
||||
return this.data.length;
|
||||
}
|
||||
getData() {
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
exports.StrictlyEqualSet = StrictlyEqualSet;
|
||||
Loading…
Add table
Add a link
Reference in a new issue