< Summary

Information
Class: Elsa.Expressions.JavaScript.Helpers.ObjectArrayHelper
Assembly: Elsa.Expressions.JavaScript
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.JavaScript/Helpers/ObjectArrayHelper.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
Total lines: 40
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 12
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
DetermineIfObjectIsArrayLikeClrCollection(...)0%156120%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.JavaScript/Helpers/ObjectArrayHelper.cs

#LineLine coverage
 1using System.Collections;
 2
 3namespace Elsa.Expressions.JavaScript.Helpers;
 4
 5/// <summary>
 6/// Contains helper methods for working with object arrays.
 7/// </summary>
 8[Obsolete("Jint decides array-likeness itself and attaches Array.prototype to array-like wrappers when Options.Interop.A
 9public static class ObjectArrayHelper
 10{
 11    /// <summary>
 12    /// Determines if the specified object is an array-like CLR collection.
 13    /// </summary>
 14    public static bool DetermineIfObjectIsArrayLikeClrCollection(Type type)
 15    {
 016        var isDictionary = typeof(IDictionary).IsAssignableFrom(type);
 17
 018        if (isDictionary)
 019            return false;
 20
 021        if (typeof(ICollection).IsAssignableFrom(type))
 022            return true;
 23
 024        foreach (var interfaceType in type.GetInterfaces())
 25        {
 026            if (!interfaceType.IsGenericType)
 27            {
 28                continue;
 29            }
 30
 031            if (interfaceType.GetGenericTypeDefinition() == typeof(IReadOnlyCollection<>)
 032                || interfaceType.GetGenericTypeDefinition() == typeof(ICollection<>))
 33            {
 034                return true;
 35            }
 36        }
 37
 038        return false;
 39    }
 40}