using Microsoft.Extensions.Primitives;
// ReSharper disable once CheckNamespace
namespace Elsa.Extensions;
///
/// Contains extension methods for the Enumerable dictonaries.
///
public static class StringValueExtensions
{
///
/// Convert the collection to the desired dictionary type.
///
///
///
public static Dictionary ToObjectDictionary(this IEnumerable> collection)
{
return collection.ToDictionary, string, object>(
item => item.Key,
item => item.Value.Count <= 1 ?
item.Value[0]!
: item.Value.ToArray());
}
}