You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
454 B
18 lines
454 B
|
3 years ago
|
// @flow
|
||
|
|
import memoize from '@emotion/memoize'
|
||
|
|
|
||
|
|
declare var codegen: { require: string => RegExp }
|
||
|
|
|
||
|
|
const reactPropsRegex = codegen.require('./props')
|
||
|
|
|
||
|
|
// https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
|
||
|
|
const isPropValid = /* #__PURE__ */ memoize(
|
||
|
|
prop =>
|
||
|
|
reactPropsRegex.test(prop) ||
|
||
|
|
(prop.charCodeAt(0) === 111 /* o */ &&
|
||
|
|
prop.charCodeAt(1) === 110 /* n */ &&
|
||
|
|
prop.charCodeAt(2) < 91) /* Z+1 */
|
||
|
|
)
|
||
|
|
|
||
|
|
export default isPropValid
|