MCPcopy Index your code
hub / github.com/effector/effector / sample

Function sample

src/effector/sample.ts:44–87  ·  view source on GitHub ↗
(...args: any[])

Source from the content-addressed store, hash-verified

42}
43
44export function sample(...args: any[]) {
45 let target
46 let name
47 let [[source, clock, fn], metadata] = processArgsToConfig(args)
48 let sid
49 let batch = true
50 let filter
51 const errorTitle = generateErrorTitle('sample', metadata)
52 /** config case */
53 if (
54 isVoid(clock) &&
55 isObject(source) &&
56 validateSampleConfig(source, errorTitle)
57 ) {
58 clock = source.clock
59 fn = source.fn
60 if ('batch' in source) {
61 batch = source.batch
62 } else {
63 deprecate(!('greedy' in source), 'greedy in sample', 'batch', errorTitle)
64 batch = !source.greedy
65 }
66 filter = source.filter
67 /** optional target & name accepted only from config */
68 target = source.target
69 name = source.name
70 sid = source.sid
71 source = source.source
72 }
73 return createSampling(
74 'sample',
75 clock,
76 source,
77 filter,
78 target,
79 fn,
80 name,
81 metadata,
82 batch,
83 true,
84 false,
85 sid,
86 )
87}
88
89export const createSampling = (
90 method: string,

Callers 15

useUnit.test.tsxFile · 0.90
createCustomEntityFunction · 0.90
scopes.test.tsxFile · 0.90
createModelFunction · 0.90
split.test.tsFile · 0.90
createModelFunction · 0.90
factoryFunction · 0.90
store.test.tsFile · 0.90
guardOther.test.tsFile · 0.90

Calls 7

processArgsToConfigFunction · 0.90
generateErrorTitleFunction · 0.90
isVoidFunction · 0.90
isObjectFunction · 0.90
deprecateFunction · 0.90
validateSampleConfigFunction · 0.85
createSamplingFunction · 0.85

Tested by 11

createCustomEntityFunction · 0.72
createModelFunction · 0.72
createModelFunction · 0.72
factoryFunction · 0.72
generic1Function · 0.72
wrapFunction · 0.72
createCustomEntityFunction · 0.72
fnFunction · 0.72
factoryAFunction · 0.72
fFunction · 0.72
nameClashCheckFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…