@scalar/snippetz 0.2.10 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ export declare function snippetz(): {
9
9
  target: "c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift" | "dart";
10
10
  client: "libcurl" | "clj_http" | "httpclient" | "restsharp" | "native" | "http" | "http1.1" | "asynchttp" | "nethttp" | "okhttp" | "unirest" | "axios" | "fetch" | "jquery" | "ofetch" | "xhr" | "undici" | "nsurlsession" | "cohttp" | "curl" | "guzzle" | "restmethod" | "webrequest" | "python3" | "requests" | "httr" | "httpie" | "wget";
11
11
  }[];
12
- findPlugin<T extends TargetId>(target: T | string, client: ClientId<T> | string): import("./types/index.js").Plugin | undefined;
12
+ findPlugin: <T extends TargetId>(target: T | string, client: ClientId<T> | string) => import("./types/index.js").Plugin | undefined;
13
13
  hasPlugin<T extends TargetId>(target: T | string, client: ClientId<T> | string): boolean;
14
14
  };
15
15
  //# sourceMappingURL=snippetz.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"snippetz.d.ts","sourceRoot":"","sources":["../src/snippetz.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAE7D;;GAEG;AACH,wBAAgB,QAAQ;UAEd,CAAC,SAAS,QAAQ,UACd,CAAC,UACD,QAAQ,CAAC,CAAC,CAAC,WACV,OAAO,CAAC,UAAU,CAAC;;;;;;eAenB,CAAC,SAAS,QAAQ,UACnB,CAAC,GAAG,MAAM,UACV,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM;cAMpB,CAAC,SAAS,QAAQ,UAClB,CAAC,GAAG,MAAM,UACV,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM;EAKjC"}
1
+ {"version":3,"file":"snippetz.d.ts","sourceRoot":"","sources":["../src/snippetz.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAE7D;;GAEG;AACH,wBAAgB,QAAQ;UAWd,CAAC,SAAS,QAAQ,UACd,CAAC,UACD,QAAQ,CAAC,CAAC,CAAC,WACV,OAAO,CAAC,UAAU,CAAC;;;;;;iBAbZ,CAAC,SAAS,QAAQ,UAC5B,CAAC,GAAG,MAAM,UACV,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM;cA2BlB,CAAC,SAAS,QAAQ,UAClB,CAAC,GAAG,MAAM,UACV,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM;EAKjC"}
package/dist/snippetz.js CHANGED
@@ -4,9 +4,14 @@ import { clients } from './clients.js';
4
4
  * Generate code examples for HAR requests
5
5
  */
6
6
  function snippetz() {
7
+ function findPlugin(target, client) {
8
+ return clients
9
+ .find(({ key }) => key === target)
10
+ ?.clients.find((plugin) => plugin.client === client);
11
+ }
7
12
  return {
8
13
  print(target, client, request) {
9
- return this.findPlugin(target, client)?.generate(request);
14
+ return findPlugin(target, client)?.generate(request);
10
15
  },
11
16
  clients() {
12
17
  return clients;
@@ -17,13 +22,9 @@ function snippetz() {
17
22
  client: plugin.client,
18
23
  })));
19
24
  },
20
- findPlugin(target, client) {
21
- return clients
22
- .find(({ key }) => key === target)
23
- ?.clients.find((plugin) => plugin.client === client);
24
- },
25
+ findPlugin,
25
26
  hasPlugin(target, client) {
26
- return Boolean(this.findPlugin(target, client));
27
+ return Boolean(findPlugin(target, client));
27
28
  },
28
29
  };
29
30
  }
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "url": "git+https://github.com/scalar/scalar.git",
10
10
  "directory": "packages/snippetz"
11
11
  },
12
- "version": "0.2.10",
12
+ "version": "0.2.11",
13
13
  "engines": {
14
14
  "node": ">=18"
15
15
  },