Jean Pierre 4ac04ee19e
[public-api] Migrate envvarService (#19067)
* Migrate envvarService

* update

* fix tests

* nit

* Fix

* Fix

* 💄

---------

Co-authored-by: Huiwen <mhqnwt@gmail.com>
2023-11-20 17:27:57 +02:00

19 lines
579 B
TypeScript

/**
* Copyright (c) 2023 Gitpod GmbH. All rights reserved.
* Licensed under the GNU Affero General Public License (AGPL).
* See License.AGPL.txt in the project root for license information.
*/
export function filter(
obj: { [key: string]: any },
predicate: (key: string, value: any) => boolean,
): { [key: string]: any } {
const result = Object.create({}); // typeorm doesn't like Object.create(null)
for (const [key, value] of Object.entries(obj)) {
if (predicate(key, value)) {
result[key] = value;
}
}
return result;
}