2021-03-10 08:48:34 +01:00
|
|
|
// Copyright BigchainDB GmbH and BigchainDB contributors
|
|
|
|
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
|
|
|
// Code is Apache-2.0 and docs are CC-BY-4.0
|
|
|
|
|
|
|
|
declare type FilterFn = (val: any, key?: string) => void;
|
|
|
|
|
|
|
|
declare function filterFromObject<I = Record<string, any>>(
|
|
|
|
obj: I,
|
2022-02-15 14:12:27 +01:00
|
|
|
filter: Array<any> | FilterFn,
|
|
|
|
conf: { isInclusion?: boolean }
|
2021-03-10 08:48:34 +01:00
|
|
|
): Partial<I>;
|
|
|
|
|
|
|
|
declare function applyFilterOnObject<I = Record<string, any>>(
|
|
|
|
obj: I,
|
|
|
|
filterFn?: FilterFn
|
|
|
|
): Partial<I>;
|
|
|
|
|
|
|
|
declare function selectFromObject<I = Record<string, any>>(
|
|
|
|
obj: I,
|
2022-02-15 14:12:27 +01:00
|
|
|
filter: Array<any> | FilterFn
|
2021-03-10 08:48:34 +01:00
|
|
|
): Partial<I>;
|
|
|
|
|
|
|
|
export default function sanitize<I = Record<string, any>>(
|
|
|
|
obj: I
|
|
|
|
): Partial<I> | I;
|