Minor cleanup

This commit is contained in:
Sipke Schoorstra 2023-08-14 14:47:35 +02:00
parent 811827c393
commit 7ad3da2c2a
3 changed files with 5 additions and 5 deletions

View file

@ -12,11 +12,11 @@ namespace Elsa.Http.Scripting.JavaScript;
[PublicAPI]
public class HttpJavaScriptHandler : INotificationHandler<EvaluatingJavaScript>
{
/// <inheritdoc />
public async Task HandleAsync(EvaluatingJavaScript notification, CancellationToken cancellationToken)
public Task HandleAsync(EvaluatingJavaScript notification, CancellationToken cancellationToken)
{
var engine = notification.Engine;
engine.RegisterType<HttpRequestHeaders>();
return Task.CompletedTask;
}
}

View file

@ -25,7 +25,7 @@ public class RouteMatcher : IRouteMatcher
foreach (var parameter in parsedTemplate.Parameters)
if (parameter.DefaultValue != null)
result.Add(parameter.Name, parameter.DefaultValue);
result.Add(parameter.Name!, parameter.DefaultValue);
return result;
}

View file

@ -149,11 +149,11 @@ public class JintJavaScriptEvaluator : IJavaScriptEvaluator
if (obj == null)
return null!;
// If it's not an IEnumerable or it's a string or dictionary, return the original object
// If it's not an IEnumerable or it's a string or dictionary, return the original object.
if (obj is not IEnumerable enumerable || obj is string || obj is IDictionary)
return obj;
// Use LINQ to convert the IEnumerable to an array
// Use LINQ to convert the IEnumerable to an array.
var elementType = obj.GetType().GetGenericArguments().FirstOrDefault();
if (elementType == null)