UNPKG

718 BPlain TextView Raw
1// Copyright (c) .NET Foundation. All rights reserved.
2// Licensed under the MIT License.
3
4import { RpcNullableString } from '@azure/functions-core';
5
6export function fromNullableMapping(
7 nullableMapping: Record<string, RpcNullableString> | null | undefined,
8 originalMapping?: Record<string, string> | null
9): Record<string, string> {
10 let converted = {};
11 if (nullableMapping && Object.keys(nullableMapping).length > 0) {
12 for (const key in nullableMapping) {
13 converted[key] = nullableMapping[key].value || '';
14 }
15 } else if (originalMapping && Object.keys(originalMapping).length > 0) {
16 converted = originalMapping;
17 }
18 return converted;
19}