Skip to content

Commit 43f37df

Browse files
authored
feat(core)!: Remove arrayify method (#14782)
ref: #14268 Deprecation PR: #14405 Removes `arrayify`. This has no replacement.
1 parent 2d4f8e9 commit 43f37df

File tree

5 files changed

+1
-44
lines changed

5 files changed

+1
-44
lines changed

docs/migration/v8-to-v9.md

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ It will be removed in a future major version.
106106

107107
- The `getNumberOfUrlSegments` method has been removed. There is no replacement.
108108
- The `validSeverityLevels` export has been removed. There is no replacement.
109+
- The `arrayify` export has been removed. There is no replacement.
109110

110111
### `@sentry/nestjs`
111112

packages/core/src/utils-hoist/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ export {
4242
addContextToFrame,
4343
addExceptionMechanism,
4444
addExceptionTypeValue,
45-
// eslint-disable-next-line deprecation/deprecation
46-
arrayify,
4745
checkOrSetAlreadyCaught,
4846
getEventDescription,
4947
parseSemver,

packages/core/src/utils-hoist/misc.ts

-12
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,3 @@ function isAlreadyCaptured(exception: unknown): boolean | void {
230230
return (exception as { __sentry_captured__?: boolean }).__sentry_captured__;
231231
} catch {} // eslint-disable-line no-empty
232232
}
233-
234-
/**
235-
* Checks whether the given input is already an array, and if it isn't, wraps it in one.
236-
*
237-
* @param maybeArray Input to turn into an array, if necessary
238-
* @returns The input, if already an array, or an array with the input as the only element, if not
239-
*
240-
* @deprecated This function has been deprecated and will not be replaced.
241-
*/
242-
export function arrayify<T = unknown>(maybeArray: T | T[]): T[] {
243-
return Array.isArray(maybeArray) ? maybeArray : [maybeArray];
244-
}

packages/core/test/utils-hoist/misc.test.ts

-25
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { Event, Mechanism, StackFrame } from '../../src/types-hoist';
33
import {
44
addContextToFrame,
55
addExceptionMechanism,
6-
arrayify,
76
checkOrSetAlreadyCaught,
87
getEventDescription,
98
uuid4,
@@ -363,27 +362,3 @@ describe('uuid4 generation', () => {
363362
}
364363
});
365364
});
366-
367-
describe('arrayify()', () => {
368-
it('returns arrays untouched', () => {
369-
// eslint-disable-next-line deprecation/deprecation
370-
expect(arrayify([])).toEqual([]);
371-
// eslint-disable-next-line deprecation/deprecation
372-
expect(arrayify(['dogs', 'are', 'great'])).toEqual(['dogs', 'are', 'great']);
373-
});
374-
375-
it('wraps non-arrays with an array', () => {
376-
// eslint-disable-next-line deprecation/deprecation
377-
expect(arrayify(1231)).toEqual([1231]);
378-
// eslint-disable-next-line deprecation/deprecation
379-
expect(arrayify('dogs are great')).toEqual(['dogs are great']);
380-
// eslint-disable-next-line deprecation/deprecation
381-
expect(arrayify(true)).toEqual([true]);
382-
// eslint-disable-next-line deprecation/deprecation
383-
expect(arrayify({})).toEqual([{}]);
384-
// eslint-disable-next-line deprecation/deprecation
385-
expect(arrayify(null)).toEqual([null]);
386-
// eslint-disable-next-line deprecation/deprecation
387-
expect(arrayify(undefined)).toEqual([undefined]);
388-
});
389-
});

packages/utils/src/index.ts

-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import {
2929
addNormalizedRequestDataToEvent as addNormalizedRequestDataToEvent_imported,
3030
addRequestDataToEvent as addRequestDataToEvent_imported,
3131
applyAggregateErrorsToEvent as applyAggregateErrorsToEvent_imported,
32-
arrayify as arrayify_imported,
3332
baggageHeaderToDynamicSamplingContext as baggageHeaderToDynamicSamplingContext_imported,
3433
basename as basename_imported,
3534
browserPerformanceTimeOrigin as browserPerformanceTimeOrigin_imported,
@@ -608,10 +607,6 @@ export const flatten = flatten_imported;
608607
// eslint-disable-next-line deprecation/deprecation
609608
export const memoBuilder = memoBuilder_imported;
610609

611-
/** @deprecated Import from `@sentry/core` instead. */
612-
// eslint-disable-next-line deprecation/deprecation
613-
export const arrayify = arrayify_imported;
614-
615610
/** @deprecated Import from `@sentry/core` instead. */
616611
export const normalizeUrlToBase = normalizeUrlToBase_imported;
617612

0 commit comments

Comments
 (0)