(cherry picked from commit f911a29e4c)
Co-authored-by: Daniel Espino García <larkox@gmail.com>
6 lines
311 B
TypeScript
6 lines
311 B
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
export function secureGetFromRecord<T>(v: Record<string, T> | undefined, key: string) {
|
|
return typeof v === 'object' && v && Object.prototype.hasOwnProperty.call(v, key) ? v[key] : undefined;
|
|
}
|