Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export class Path<T extends Record<string, any> = Record<string, any>> {

private getParams(type: string | RegExp): string[] {
const predicate =
type instanceof RegExp
typeof type !== 'string'
? (t: Token) => type.test(t.type)
: (t: Token) => t.type === type

Expand Down
2 changes: 1 addition & 1 deletion src/tokeniser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const tokenise = (str: string, tokens: Token[] = []): Token[] => {
match: match[0],
val: match.slice(1, 2),
otherVal: match.slice(2),
regex: rule.regex instanceof Function ? rule.regex(match) : rule.regex
regex: typeof rule.regex === 'function' ? rule.regex(match) : rule.regex
})

if (match[0].length < str.length) {
Expand Down