Utilities
Utils are utility functions that can be used in hooks or anywhere else in your Feathers application. They can be used to perform common tasks such as mutating data, validating input, or formatting output.
| Utility | Description |
|---|---|
addSkip | Adds hook names to |
addToQuery | Safely merges properties into a Feathers query object. If a property already exists
with a different value, it wraps both in a |
checkContext | Validates that the hook context matches the expected type(s) and method(s). Throws an error if the context is invalid, preventing hooks from running in unsupported configurations. Typically used internally by other hooks. |
contextToJson | Converts a FeathersJS HookContext to a plain JSON object by calling |
defineHooks | TypeScript helper that provides full type inference and autocompletion when defining service hooks. It is an identity function that simply returns its input, but enables your IDE to infer the correct hook context types. |
getDataIsArray | Normalizes |
getExposedMethods | Returns the list of method names that are publicly exposed by a Feathers service.
Reads the internal |
getPaginate | Resolves the active pagination options for the current hook context.
Checks (in order): |
getResultIsArray | Normalizes |
iterateFind | Use This function is useful for iterating over large datasets without loading everything into memory at once. It uses pagination to fetch results in chunks, allowing you to process each item as it is retrieved. |
mutateData | Applies a transformer function to each item in |
mutateResult | Applies a transformer function to each item in |
patchBatch | Batch patching utility that takes an array of items to be changed and returns an array of arguments to be called with the This utility is useful when you need to patch multiple items with varying data in as few requests as possible. |
skipResult | Sets |
toPaginated | Ensures a result is in Feathers paginated format ( |
transformParams | Safely applies a |
walkQuery | Walks every property of a Feathers query (including nested |
