Skip to content

Commit e5f4574

Browse files
committed
Small fixes to the function regexes.
1 parent f19ca32 commit e5f4574

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ The marshalled version of the input data.
5353

5454
## Changelog:
5555

56+
**v1.13.0**:
57+
58+
- Small fixes to the function regexes.
59+
5660
**v1.12.0**:
5761

5862
- Switched to `new Function()` for marshalling strings to objects.

src/Marshaller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import {ITypeDetector, IArbitraryObject} from "@wessberg/typedetector";
77
*/
88
export class Marshaller implements IMarshaller {
99
private static readonly SYMBOL_REGEX: RegExp = /Symbol\(([^)]*)\)/;
10-
private static readonly FUNCTION_REGEX_1: RegExp = /^function\s*\w*\s*\([^)]*\)\s*{/;
11-
private static readonly FUNCTION_REGEX_2: RegExp = /^\([^)]*\)\s*=>/;
10+
private static readonly FUNCTION_REGEX_1: RegExp = /^\(*function\s*\w*\s*\([^)]*\)\s*{/;
11+
private static readonly FUNCTION_REGEX_2: RegExp = /^\(+[^)]*\)\s*=>/;
1212
private static readonly FUNCTION_REGEX_3: RegExp = /^\w+\s*=>/;
1313

1414
constructor (private typeDetector: ITypeDetector) {}

0 commit comments

Comments
 (0)