Skip to content

transformParams

utils
Source Code | Documentation

Safely applies a transformParams function to a params object. If no function is provided, the original params are returned unchanged. The function receives a shallow copy of params, so the original is not mutated.

ts
  import { 
transformParams
} from 'feathers-utils/utils';

Example

ts
import { transformParams } from 'feathers-utils/utils'

const params = transformParams(context.params, (p) => { delete p.provider; return p })

Type declaration

Show Type Declarations
ts
/**
 * Safely applies a `transformParams` function to a params object.
 * If no function is provided, the original params are returned unchanged.
 * The function receives a shallow copy of params, so the original is not mutated.
 *
 * @example
 * ```ts
 *
 *
 * const params = transformParams(context.params, (p) => { delete p.provider; return p })
 * ```
 *
 * @see https://utils.feathersjs.com/utils/transform-params.html
 */
export declare const transformParams: <P extends Params = Params>(
  params: P,
  fn: TransformParamsFn<P> | undefined,
) => P
ArgumentTypeDescription
paramsP
fnTransformParamsFn<P> | undefined

Released under the MIT License.