Skip to content

Commit 3f5123f

Browse files
committed
ref: Remove isArray and isNaN utils
1 parent c83c1c5 commit 3f5123f

File tree

3 files changed

+3
-26
lines changed

3 files changed

+3
-26
lines changed

packages/core/src/dsn.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { DsnComponents, DsnLike, DsnProtocol } from '@sentry/types';
22
import { SentryError } from '@sentry/utils/error';
3-
import { isNaN } from '@sentry/utils/is';
43

54
/** Regular expression used to parse a Dsn. */
65
const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w\.-]+)(?::(\d+))?\/(.+)/;
@@ -92,7 +91,7 @@ export class Dsn implements DsnComponents {
9291
throw new SentryError(`Invalid Dsn: Unsupported protocol "${this.protocol}"`);
9392
}
9493

95-
if (this.port && isNaN(parseInt(this.port, 10))) {
94+
if (this.port && Number.isNaN(parseInt(this.port, 10))) {
9695
throw new SentryError(`Invalid Dsn: Invalid port number "${this.port}"`);
9796
}
9897
}

packages/utils/src/is.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,6 @@ export function isPrimitive(wat: any): boolean {
9595
return wat === null || (typeof wat !== 'object' && typeof wat !== 'function');
9696
}
9797

98-
/**
99-
* Checks whether given value's type is an array
100-
* {@link isArray}.
101-
*
102-
* @param wat A value to be checked.
103-
* @returns A boolean representing the result.
104-
*/
105-
export function isArray(wat: any): boolean {
106-
return Object.prototype.toString.call(wat) === '[object Array]';
107-
}
108-
10998
/**
11099
* Checks whether given value's type is an object literal
111100
* {@link isPlainObject}.
@@ -128,17 +117,6 @@ export function isRegExp(wat: any): boolean {
128117
return Object.prototype.toString.call(wat) === '[object RegExp]';
129118
}
130119

131-
/**
132-
* Checks whether given value's type is a NaN
133-
* {@link isNaN}.
134-
*
135-
* @param wat A value to be checked.
136-
* @returns A boolean representing the result.
137-
*/
138-
export function isNaN(wat: any): boolean {
139-
return wat !== wat;
140-
}
141-
142120
/**
143121
* Checks whether given value has a then function.
144122
* @param wat A value to be checked.

packages/utils/src/object.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export function serializeObject<T>(value: T, depth: number): T | string | {} {
146146
});
147147

148148
return serialized;
149-
} else if (isArray(value)) {
149+
} else if (Array.isArray(value)) {
150150
const val = (value as any) as T[];
151151
return val.map(v => serializeObject(v, depth - 1));
152152
}
@@ -267,7 +267,7 @@ function normalizeValue(value: any, key?: any): any {
267267
return Object.getPrototypeOf(value) ? value.constructor.name : 'Event';
268268
}
269269

270-
if (isNaN(value)) {
270+
if (Number.isNaN(value as number)) {
271271
return '[NaN]';
272272
}
273273

0 commit comments

Comments
 (0)