@2captcha/captcha-solver 1.0.2 → 1.0.3

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../src/utils/generic.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,CAKvD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;CAAC,GAAG,GAAG,GAAG,MAAM,CAQ3F;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,oBAE/B"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /*
3
+ A file fill of generic utility functions.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.sleep = exports.objectToURI = exports.castBool = void 0;
7
+ /**
8
+ * Changes 0 and 1 falsy/truthy values into a boolean.
9
+ * @private
10
+ * @param input boolean or number
11
+ */
12
+ function castBool(input) {
13
+ if (input == false)
14
+ return 0;
15
+ if (input == true)
16
+ return 1;
17
+ if (input != 0 && input != 1)
18
+ return 0;
19
+ else
20
+ return input;
21
+ }
22
+ exports.castBool = castBool;
23
+ /**
24
+ * Constructs uri parameters from an object
25
+ * @private
26
+ * @param input The input object
27
+ */
28
+ function objectToURI(input) {
29
+ let res = "?";
30
+ const keys = Object.keys(input);
31
+ keys.forEach((key, index) => {
32
+ res += encodeURIComponent(key) + "=" + encodeURIComponent(input[key]);
33
+ if (index + 1 != keys.length)
34
+ res += "&";
35
+ });
36
+ return res;
37
+ }
38
+ exports.objectToURI = objectToURI;
39
+ /**
40
+ * Returns a promise that resolves after x ms
41
+ * @private
42
+ * @param ms time to sleep for
43
+ */
44
+ function sleep(ms) {
45
+ return new Promise((resolve) => setTimeout(resolve, ms));
46
+ }
47
+ exports.sleep = sleep;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2captcha/captcha-solver",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "JavaScript library for easy integration with the API of 2captcha captcha solving service to bypass reCAPTCHA, hCaptcha, funcaptcha, geetest and solve any other captchas.",
5
5
  "main": "dist/index.js",
6
6
  "repository": {