summaryrefslogtreecommitdiff
path: root/extensions/crypto/00_webidl.js
blob: 4545526bf945c1983e0f45dc97a236cfe37efb63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
"use strict";

((window) => {
  const webidl = window.__bootstrap.webidl;
  webidl.converters["AlgorithmIdentifier"] = (V, opts) => {
    // Union for (object or DOMString)
    if (typeof V == "object") {
      return webidl.converters["object"](V, opts);
    }

    return webidl.converters["DOMString"](V, opts);
  };

  const algorithmDictionary = [
    {
      key: "name",
      converter: webidl.converters["DOMString"],
    },
  ];

  webidl.converters["Algorithm"] = webidl.createDictionaryConverter(
    "Algorithm",
    algorithmDictionary,
  );
})(this);