Files
pr-preview/node_modules/fast-check/lib/arbitrary/uniqueArray.js
T
space a71f801c3f feat: initial scaffold - backend, frontend, Prisma schema, Docker
- Prisma schema: User, Session, RepoConfig, Preview, Job, WebhookToken, NoConfigComment, AdminSettings
- Backend: auth (login/logout/me/first-user setup), webhook handler with HMAC verification, EC2 service, SSH service, deploy pipeline, job queue worker, cron workers
- Frontend: Login with first-user detection, Dashboard, PreviewDetail with live log streaming, Settings, Repos config, Admin panel, SetupWizard, Privacy page
- Docker Compose and Dockerfile for self-hosted deployment
- Uses bcryptjs for Node 24 compatibility

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-25 00:18:08 +02:00

46 lines
2.6 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.uniqueArray = uniqueArray;
const ArrayArbitrary_1 = require("./_internals/ArrayArbitrary");
const MaxLengthFromMinLength_1 = require("./_internals/helpers/MaxLengthFromMinLength");
const CustomEqualSet_1 = require("./_internals/helpers/CustomEqualSet");
const StrictlyEqualSet_1 = require("./_internals/helpers/StrictlyEqualSet");
const SameValueSet_1 = require("./_internals/helpers/SameValueSet");
const SameValueZeroSet_1 = require("./_internals/helpers/SameValueZeroSet");
function buildUniqueArraySetBuilder(constraints) {
if (typeof constraints.comparator === 'function') {
if (constraints.selector === undefined) {
const comparator = constraints.comparator;
const isEqualForBuilder = (nextA, nextB) => comparator(nextA.value_, nextB.value_);
return () => new CustomEqualSet_1.CustomEqualSet(isEqualForBuilder);
}
const comparator = constraints.comparator;
const selector = constraints.selector;
const refinedSelector = (next) => selector(next.value_);
const isEqualForBuilder = (nextA, nextB) => comparator(refinedSelector(nextA), refinedSelector(nextB));
return () => new CustomEqualSet_1.CustomEqualSet(isEqualForBuilder);
}
const selector = constraints.selector || ((v) => v);
const refinedSelector = (next) => selector(next.value_);
switch (constraints.comparator) {
case 'IsStrictlyEqual':
return () => new StrictlyEqualSet_1.StrictlyEqualSet(refinedSelector);
case 'SameValueZero':
return () => new SameValueZeroSet_1.SameValueZeroSet(refinedSelector);
case 'SameValue':
case undefined:
return () => new SameValueSet_1.SameValueSet(refinedSelector);
}
}
function uniqueArray(arb, constraints = {}) {
const minLength = constraints.minLength !== undefined ? constraints.minLength : 0;
const maxLength = constraints.maxLength !== undefined ? constraints.maxLength : MaxLengthFromMinLength_1.MaxLengthUpperBound;
const maxGeneratedLength = (0, MaxLengthFromMinLength_1.maxGeneratedLengthFromSizeForArbitrary)(constraints.size, minLength, maxLength, constraints.maxLength !== undefined);
const depthIdentifier = constraints.depthIdentifier;
const setBuilder = buildUniqueArraySetBuilder(constraints);
const arrayArb = new ArrayArbitrary_1.ArrayArbitrary(arb, minLength, maxGeneratedLength, maxLength, depthIdentifier, setBuilder, []);
if (minLength === 0)
return arrayArb;
return arrayArb.filter((tab) => tab.length >= minLength);
}