Skip to content

Commit d6aea9e

Browse files
committed
get function name properly
1 parent 03d9d9f commit d6aea9e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

packages/firestore/src/util/input_validation.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,10 @@ export function valueDescription(input: unknown): string {
132132
}
133133
}
134134

135-
/** Hacky method to try to get the constructor name for an object. */
135+
/** try to get the constructor name for an object. */
136136
export function tryGetCustomObjectType(input: object): string | null {
137137
if (input.constructor) {
138-
const funcNameRegex = /function\s+([^\s(]+)\s*\(/;
139-
const results = funcNameRegex.exec(input.constructor.toString());
140-
if (results && results.length > 1) {
141-
return results[1];
142-
}
138+
return input.constructor.name;
143139
}
144140
return null;
145141
}

0 commit comments

Comments
 (0)