Unverified Commit bea12ab6 authored by Hong Minhee's avatar Hong Minhee
Browse files

Remove deprecated `expand` option from `toJsonLd()` method

parent b1d918b8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,9 @@ Version 0.15.0

To be released.

 -  Removed `expand` option of `Object.toJsonLd()` method, which was deprecated
    in version 0.14.0.  Use `format: "expand"` option instead.


Version 0.14.3
--------------
+2 −2
Original line number Diff line number Diff line
@@ -97,9 +97,9 @@ export const command = new Command()
        Deno.exit(1);
      }
      if (options.compact) {
        printJson(await object.toJsonLd({ contextLoader }));
        printJson(await object.toJsonLd({ format: "compact", contextLoader }));
      } else if (options.expand) {
        printJson(await object.toJsonLd({ expand: true, contextLoader }));
        printJson(await object.toJsonLd({ format: "expand", contextLoader }));
      } else {
        console.log(object);
      }
+0 −819

File changed.

Preview size limit exceeded, changes collapsed.

+0 −13
Original line number Diff line number Diff line
@@ -28,22 +28,9 @@ export async function* generateEncoder(
   */
  async toJsonLd(options: {
    format?: "compact" | "expand",
    expand?: boolean,
    contextLoader?: DocumentLoader,
    context?: string | Record<string, string> | (string | Record<string, string>)[],
  } = {}): Promise<unknown> {
    if (options.expand != null) {
      if (options.format != null) {
        throw new TypeError(
          "The expand option, which is deprecated, cannot be used together " +
          "with the format option."
        );
      }
      getLogger(["fedify", "vocab"]).warn(
        "The expand option is deprecated; use format: 'expand' instead.",
      );
      options = { ...options, format: "expand", expand: undefined };
    }
    if (options.format == null && this.#cachedJsonLd != null) {
      return this.#cachedJsonLd;
    }