Page Contents

Home > @loopback/rest > sanitizeJsonParse

sanitizeJsonParse() function

Factory to create a reviver function for JSON.parse to sanitize keys

Signature:

export declare function sanitizeJsonParse(reviver?: (key: any, value: any) => any, prohibitedKeys?: string[]): (key: string, value: any) => any;

Parameters

Parameter Type Description
reviver (key: any, value: any) => any (Optional) Reviver function
prohibitedKeys string[] (Optional) An array of keys to be rejected

Returns:

(key: string, value: any) => any