Files
twenty/packages/twenty-front/src/utils/array/toSpliced.ts
T
Charles Bochet f4da7767f8 chore: remove Chromatic dependencies and configuration (#21221)
## Summary

- Remove `chromatic` and `@chromatic-com/storybook` devDependencies from
twenty-front
- Remove global `chromatic` Nx target from nx.json and twenty-front
project.json override
- Remove commented Chromatic Storybook addon from twenty-front
- Remove `CHROMATIC_PROJECT_TOKEN` from .env.example
- Update README to remove Chromatic sponsor reference (image was already
missing)
- Update stale Chromatic comment in toSpliced.ts

## Context

Visual regression testing has moved from Chromatic SaaS to self-hosted
Argos at `argos.twenty-internal.com`. These are dead references that are
no longer used by any CI workflow.

**Note:** Story `parameters.chromatic: { disableSnapshot: true }`
entries are intentionally kept — the Argos plugin reads them as a
fallback.

## Test plan

- Verify `yarn install` succeeds after dependency removal
- Verify no workflow references `chromatic` or `nx chromatic`
2026-06-04 13:15:23 +00:00

29 lines
1.0 KiB
TypeScript

type ToSplicedFn = {
<T>(array: T[], start: number, deleteCount?: number): T[];
<T>(array: T[], start: number, deleteCount: number, ...items: T[]): T[];
};
/**
* Returns a new array with some elements removed and/or replaced at a given index.
* This does the same as `Array.prototype.toSpliced`.
* Polyfill for environments that don't support Array.prototype.toSpliced.
*
* @param array - The array to remove and/or replace elements from.
* @param start - The index at which to start changing the array.
* @param deleteCount - The number of elements in the array to remove from `start`.
* @param items - The elements to add to the array at `start`.
*
* @returns A new array with elements removed and/or replaced at a given index.
*
* @example
* toSpliced(['a', 'b', 'c'], 0, 1)
* => ['b', 'c']
* toSpliced(['a', 'b', 'c'], 0, 1, 'd')
* => ['d', 'b', 'c']
*/
export const toSpliced: ToSplicedFn = (array, ...args) => {
const arrayCopy = [...array];
arrayCopy.splice(...(args as [number, number, ...any[]]));
return arrayCopy;
};