Skip to content

result

Reads or rewrites context.result.

NameCategoryDescription
setResult
hooks

Sets a property on each item in context.result from another property on the hook context. Supports dot-notation paths for both source and target, and can optionally operate on context.dispatch as well.

transformResult
hooks

Transforms each item in context.result using the provided transformer function. The transformer receives each item and can mutate it in place or return a new object. Optionally operates on context.dispatch via the dispatch option.

traverse
hooks

Recursively walks and transforms fields in record(s) using neotraverse. The getObject function extracts the target from the context, and transformer is called for every node during traversal --- ideal for deep, structural transformations.

getResultIsArray
utils

Normalizes context.result (or context.dispatch) into an array for uniform processing. Handles paginated results by extracting the data array. Returns { result, isArray, key } where key indicates whether 'result' or 'dispatch' was used.

mutateResult
utils

Applies a transformer function to each item in context.result (and optionally context.dispatch). Handles paginated results, single items, and arrays transparently. Use the dispatch option to control whether result, dispatch, or both are transformed.

skipResult
utils

Sets context.result to an appropriate empty value based on the hook method. Returns an empty paginated object for paginated find, an empty array for multi operations, or null for single-item operations. Does nothing if a result already exists.

toPaginated
utils

Ensures a result is in Feathers paginated format ({ total, limit, skip, data }). If the input is already paginated, it is returned as-is. If it is a plain array, it is wrapped in a paginated object with total and limit set to the array length.

zipDataResult
utils

Pairs each item in context.data with its corresponding item in context.result by index. Handles both single-item and array data, normalizing them into an array of { data, result } pairs. Only works in after/around hooks for create, update, and patch methods.

resolveResult
resolvers

Resolves and transforms context.result using a map of resolver functions. Each property in the resolver object receives the current value and can return a transformed value. Runs after next() in the hook pipeline.

isPaginated
predicates

Checks if the current find operation is paginated by inspecting params.paginate and the service's pagination options via getPaginate. Returns false for all methods other than find or when pagination is disabled.

See all tags for the full vocabulary.

Released under the MIT License.