Skip to content

Commit b189803

Browse files
committed
refactor: isOn check to use regex
This ensures we only match `onXyz` where X is *not* a lowercase letter.
1 parent 49b2b4e commit b189803

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/shared/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ export function debug(
99
Trace.write(s, category as string, Trace.messageType.log)
1010
}
1111

12-
export const isOn = (key: string) => key.startsWith('on')
12+
const onRE = /^on[^a-z]/
13+
export const isOn = (key: string) => onRE.test(key)

0 commit comments

Comments
 (0)