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