< Summary - Jellyfin

Information
Class: Jellyfin.Extensions.Json.Utf8JsonExtensions
Assembly: Jellyfin.Extensions
File(s): /srv/git/jellyfin/src/Jellyfin.Extensions/Json/Utf8JsonExtensions.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 27
Line coverage: 100%
Branch coverage
62%
Covered branches: 5
Total branches: 8
Branch coverage: 62.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
IsEmptyString(...)62.5%88100%
IsNull(...)100%11100%

File(s)

/srv/git/jellyfin/src/Jellyfin.Extensions/Json/Utf8JsonExtensions.cs

#LineLine coverage
 1using System.Text.Json;
 2
 3namespace Jellyfin.Extensions.Json;
 4
 5/// <summary>
 6/// Extensions for Utf8JsonReader and Utf8JsonWriter.
 7/// </summary>
 8public static class Utf8JsonExtensions
 9{
 10    /// <summary>
 11    /// Determines if the reader contains an empty string.
 12    /// </summary>
 13    /// <param name="reader">The reader.</param>
 14    /// <returns>Whether the reader contains an empty string.</returns>
 15    public static bool IsEmptyString(this Utf8JsonReader reader)
 855816        => reader.TokenType == JsonTokenType.String
 855817           && ((reader.HasValueSequence && reader.ValueSequence.IsEmpty)
 855818               || (!reader.HasValueSequence && reader.ValueSpan.IsEmpty));
 19
 20    /// <summary>
 21    /// Determines if the reader contains a null value.
 22    /// </summary>
 23    /// <param name="reader">The reader.</param>
 24    /// <returns>Whether the reader contains null.</returns>
 25    public static bool IsNull(this Utf8JsonReader reader)
 216526        => reader.TokenType == JsonTokenType.Null;
 27}