2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
2020-11-04 19:56:49 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
export function getOwn<TObject extends object, TKey extends keyof TObject>(
|
|
|
|
obj: TObject,
|
|
|
|
key: TKey
|
|
|
|
): TObject[TKey] | undefined {
|
2023-01-19 19:56:02 +00:00
|
|
|
return Object.hasOwn(obj, key) ? obj[key] : undefined;
|
2020-11-04 19:56:49 +00:00
|
|
|
}
|