deno.land / x / jotai@v1.8.4 / src / babel / utils.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { types } from '@babel/core'
export function isAtom( t: typeof types, callee: babel.types.Expression | babel.types.V8IntrinsicIdentifier) { if (t.isIdentifier(callee) && atomFunctionNames.includes(callee.name)) { return true }
if (t.isMemberExpression(callee)) { const { property } = callee if (t.isIdentifier(property) && atomFunctionNames.includes(property.name)) { return true } } return false}
const atomFunctionNames = [ 'abortableAtom', 'atom', 'atomFamily', 'atomWithDefault', 'atomWithHash', 'atomWithImmer', 'atomWithInfiniteQuery', 'atomWithMachine', 'atomWithMutation', 'atomWithObservable', 'atomWithProxy', 'atomWithQuery', 'atomWithReducer', 'atomWithReset', 'atomWithSubscription', 'atomWithStorage', 'atomWithStore', 'freezeAtom', 'loadable', 'selectAtom', 'splitAtom',]
jotai

Version Info

Tagged at
2 years ago