Browse Source

ref: Remove trim from utils.tsx (#71834)

https://github.com/getsentry/frontend-tsc/issues/13
Ryan Albrecht 9 months ago
parent
commit
4b978a9b94

+ 2 - 2
static/app/components/events/interfaces/crashContent/stackTrace/rawContent.tsx

@@ -1,7 +1,7 @@
 import {trimPackage} from 'sentry/components/events/interfaces/frame/utils';
 import type {ExceptionValue, Frame} from 'sentry/types';
 import type {StacktraceType} from 'sentry/types/stacktrace';
-import {defined, trim} from 'sentry/utils';
+import {defined} from 'sentry/utils';
 
 function getJavaScriptFrame(frame: Frame): string {
   let result = '';
@@ -72,7 +72,7 @@ export function getPythonFrame(frame: Frame): string {
   if (defined(frame.context)) {
     frame.context.forEach(item => {
       if (item[0] === frame.lineNo) {
-        result += '\n    ' + trim(item[1]);
+        result += '\n    ' + item[1].trim();
       }
     });
   }

+ 2 - 6
static/app/utils.tsx

@@ -104,15 +104,11 @@ export function objectIsEmpty(obj = {}): boolean {
   return true;
 }
 
-export function trim(str: string): string {
-  return str.replace(/^\s+|\s+$/g, '');
-}
-
 /**
  * Replaces slug special chars with a space
  */
 export function explodeSlug(slug: string): string {
-  return trim(slug.replace(/[-_]+/g, ' '));
+  return slug.replace(/[-_]+/g, ' ').trim();
 }
 
 export function defined<T>(item: T): item is Exclude<T, null | undefined> {
@@ -232,7 +228,7 @@ export function parseRepo<T>(repo: T): T {
 export function extractMultilineFields(value: string): string[] {
   return value
     .split('\n')
-    .map(f => trim(f))
+    .map(f => f.trim())
     .filter(f => f !== '');
 }