mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
* Migrate envvarService
* update
* fix tests
* nit
* Fix
* Fix
* 💄
---------
Co-authored-by: Huiwen <mhqnwt@gmail.com>
19 lines
579 B
TypeScript
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;
|
|
}
|