From 1c518904456e4860889bbea9b867ce946895150a Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Wed, 18 Dec 2024 11:05:14 -0500 Subject: [PATCH] feat(core)!: Remove `arrayify` export --- docs/migration/v8-to-v9.md | 1 + packages/core/src/utils-hoist/index.ts | 2 -- packages/core/src/utils-hoist/misc.ts | 12 ---------- packages/core/test/utils-hoist/misc.test.ts | 25 --------------------- packages/utils/src/index.ts | 5 ----- 5 files changed, 1 insertion(+), 44 deletions(-) diff --git a/docs/migration/v8-to-v9.md b/docs/migration/v8-to-v9.md index 0f92cab5bc93..d3951290218a 100644 --- a/docs/migration/v8-to-v9.md +++ b/docs/migration/v8-to-v9.md @@ -106,6 +106,7 @@ It will be removed in a future major version. - The `getNumberOfUrlSegments` method has been removed. There is no replacement. - The `validSeverityLevels` export has been removed. There is no replacement. +- The `arrayify` export has been removed. There is no replacement. ### `@sentry/nestjs` diff --git a/packages/core/src/utils-hoist/index.ts b/packages/core/src/utils-hoist/index.ts index 4e1771ffb8fa..3bf0f1b9527e 100644 --- a/packages/core/src/utils-hoist/index.ts +++ b/packages/core/src/utils-hoist/index.ts @@ -42,8 +42,6 @@ export { addContextToFrame, addExceptionMechanism, addExceptionTypeValue, - // eslint-disable-next-line deprecation/deprecation - arrayify, checkOrSetAlreadyCaught, getEventDescription, parseSemver, diff --git a/packages/core/src/utils-hoist/misc.ts b/packages/core/src/utils-hoist/misc.ts index 58a416b0ae31..c7da454bcad2 100644 --- a/packages/core/src/utils-hoist/misc.ts +++ b/packages/core/src/utils-hoist/misc.ts @@ -230,15 +230,3 @@ function isAlreadyCaptured(exception: unknown): boolean | void { return (exception as { __sentry_captured__?: boolean }).__sentry_captured__; } catch {} // eslint-disable-line no-empty } - -/** - * Checks whether the given input is already an array, and if it isn't, wraps it in one. - * - * @param maybeArray Input to turn into an array, if necessary - * @returns The input, if already an array, or an array with the input as the only element, if not - * - * @deprecated This function has been deprecated and will not be replaced. - */ -export function arrayify(maybeArray: T | T[]): T[] { - return Array.isArray(maybeArray) ? maybeArray : [maybeArray]; -} diff --git a/packages/core/test/utils-hoist/misc.test.ts b/packages/core/test/utils-hoist/misc.test.ts index 3ae992d5f3bb..05f8736bc443 100644 --- a/packages/core/test/utils-hoist/misc.test.ts +++ b/packages/core/test/utils-hoist/misc.test.ts @@ -3,7 +3,6 @@ import type { Event, Mechanism, StackFrame } from '../../src/types-hoist'; import { addContextToFrame, addExceptionMechanism, - arrayify, checkOrSetAlreadyCaught, getEventDescription, uuid4, @@ -363,27 +362,3 @@ describe('uuid4 generation', () => { } }); }); - -describe('arrayify()', () => { - it('returns arrays untouched', () => { - // eslint-disable-next-line deprecation/deprecation - expect(arrayify([])).toEqual([]); - // eslint-disable-next-line deprecation/deprecation - expect(arrayify(['dogs', 'are', 'great'])).toEqual(['dogs', 'are', 'great']); - }); - - it('wraps non-arrays with an array', () => { - // eslint-disable-next-line deprecation/deprecation - expect(arrayify(1231)).toEqual([1231]); - // eslint-disable-next-line deprecation/deprecation - expect(arrayify('dogs are great')).toEqual(['dogs are great']); - // eslint-disable-next-line deprecation/deprecation - expect(arrayify(true)).toEqual([true]); - // eslint-disable-next-line deprecation/deprecation - expect(arrayify({})).toEqual([{}]); - // eslint-disable-next-line deprecation/deprecation - expect(arrayify(null)).toEqual([null]); - // eslint-disable-next-line deprecation/deprecation - expect(arrayify(undefined)).toEqual([undefined]); - }); -}); diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index f730b41b30fa..45b540109b14 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -29,7 +29,6 @@ import { addNormalizedRequestDataToEvent as addNormalizedRequestDataToEvent_imported, addRequestDataToEvent as addRequestDataToEvent_imported, applyAggregateErrorsToEvent as applyAggregateErrorsToEvent_imported, - arrayify as arrayify_imported, baggageHeaderToDynamicSamplingContext as baggageHeaderToDynamicSamplingContext_imported, basename as basename_imported, browserPerformanceTimeOrigin as browserPerformanceTimeOrigin_imported, @@ -608,10 +607,6 @@ export const flatten = flatten_imported; // eslint-disable-next-line deprecation/deprecation export const memoBuilder = memoBuilder_imported; -/** @deprecated Import from `@sentry/core` instead. */ -// eslint-disable-next-line deprecation/deprecation -export const arrayify = arrayify_imported; - /** @deprecated Import from `@sentry/core` instead. */ export const normalizeUrlToBase = normalizeUrlToBase_imported;