from static method

JsonLdEncoderOptions from(
  1. RdfGraphEncoderOptions options
)

Creates a JSON-LD encoder options object from generic RDF encoder options

This factory method ensures that when generic RdfGraphEncoderOptions are provided to a method expecting JSON-LD-specific options, they are properly converted.

If the provided options are already a JsonLdEncoderOptions instance, they are returned as-is. Otherwise, a new instance is created with the custom prefixes from the generic options.

Implementation

static JsonLdEncoderOptions from(RdfGraphEncoderOptions options) =>
    switch (options) {
      JsonLdEncoderOptions _ => options,
      _ => JsonLdEncoderOptions(customPrefixes: options.customPrefixes),
    };