@@ -64,8 +64,9 @@ The following functions are available when using `useViewAPI`:
6464 data without including parent block data.
6565- ` queryStepData ` , ` queryStepDataLeaf ` : See
6666 [ Data Query Methods] ( #data-query-methods ) .
67- - ` dataAlongPath ` : Getter for the raw data array of all steps in the current path.
68- This is useful when you need to access the raw data structure of the path.
67+ - ` dataAlongPath ` : Getter for the raw data array of all steps in the current
68+ path. This is useful when you need to access the raw data structure of the
69+ path.
6970- ` stepIndex ` : Returns the current step index among leaf nodes.
7071- ` blockIndex ` : Returns the current block index.
7172- ` pathString ` : Returns the current path as a string.
@@ -244,10 +245,14 @@ api.goToStep('trial/block1/step2', false)
244245 in use until the next route.
245246- ` randomAssignCondition(conditionObject) ` : Randomly assigns a condition based
246247 on the provided condition object. Supports weighted randomization.
247- - ` randomInt(min, max) ` : Generate a random integer between min and max (inclusive).
248- - ` shuffle(array) ` : Randomly reorder elements in an array using Fisher-Yates algorithm.
249- - ` sampleWithReplacement(array, n, weights) ` : Sample elements from an array with replacement.
250- - ` sampleWithoutReplacement(array, n) ` : Sample elements from an array without replacement.
248+ - ` randomInt(min, max) ` : Generate a random integer between min and max
249+ (inclusive).
250+ - ` shuffle(array) ` : Randomly reorder elements in an array using Fisher-Yates
251+ algorithm.
252+ - ` sampleWithReplacement(array, n, weights) ` : Sample elements from an array with
253+ replacement.
254+ - ` sampleWithoutReplacement(array, n) ` : Sample elements from an array without
255+ replacement.
251256- ` faker ` : Collection of faker distributions for generating random data.
252257
253258## Logging and Debugging
@@ -331,8 +336,10 @@ const trialData = api.queryStepDataLeaf('trial/block*')
331336
332337The difference between these methods:
333338
334- - ` queryStepData() ` returns the merged data for each leaf node (including parent block data)
335- - ` queryStepDataLeaf() ` returns only the data directly from each leaf node (without parent block data)
339+ - ` queryStepData() ` returns the merged data for each leaf node (including parent
340+ block data)
341+ - ` queryStepDataLeaf() ` returns only the data directly from each leaf node
342+ (without parent block data)
336343
337344Example:
338345
@@ -343,14 +350,11 @@ Example:
343350// trial2 (response: 'B')
344351
345352// queryStepData() returns (merged data):
346- [
353+ ; [
347354 { blockType: ' practice' , response: ' A' },
348- { blockType: ' practice' , response: ' B' }
349- ]
350-
351- // queryStepDataLeaf() returns (leaf data only):
352- [
353- { response: ' A' },
354- { response: ' B' }
355+ { blockType: ' practice' , response: ' B' },
356+ ][
357+ // queryStepDataLeaf() returns (leaf data only):
358+ ({ response: ' A' }, { response: ' B' })
355359]
356360```
0 commit comments