@ndriadev/futurable 1.0.1 → 1.0.2

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.
package/README.md CHANGED
@@ -75,6 +75,8 @@ const { Futurable } = require('futurable'); // ok
75
75
  ## Use-case
76
76
  ### React
77
77
  Thanks to the use of this library, there is a simple and effective way to be able to cancel an Api request executed in a useEffect which, due to the Strict Mode, is executed twice:
78
+
79
+ *Example*
78
80
  ```jsx
79
81
  export default function Component() {
80
82
  //...code
@@ -83,8 +85,7 @@ export default function Component() {
83
85
  const f;
84
86
  function callApi() {
85
87
  f = Futurable
86
- .fetch("https://jsonplaceholder.typicode.com/todos/2")
87
- .onAbort(() => console.log("aborted"))
88
+ .fetch("...")
88
89
  .then(resp => resp.json())
89
90
  .then(setTodo);
90
91
  }
@@ -100,7 +101,7 @@ export default function Component() {
100
101
  const controller = new AbortController();
101
102
  Futurable
102
103
  .fetch(
103
- "https://jsonplaceholder.typicode.com/todos/2",
104
+ "...",
104
105
  {
105
106
  signal: controller.signal
106
107
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@ndriadev/futurable",
3
3
  "description": "Extension Javascript's Promise API with more functionalities",
4
4
  "private": false,
5
- "version": "1.0.1",
5
+ "version": "1.0.2",
6
6
  "type": "module",
7
7
  "engines": {
8
8
  "node": ">=16.13.2"
@@ -27,9 +27,11 @@
27
27
  },
28
28
  "main": "./src/index.ts",
29
29
  "types": "./src/index.d.ts",
30
- "scripts": {
30
+ "//scripts": {
31
31
  "preinstall": "node ./scripts/preinstall.js --foreground-script",
32
- "postinstall": "echo 'postinstall executed'",
32
+ "postinstall": "echo 'postinstall executed'"
33
+ },
34
+ "scripts": {
33
35
  "build": "tsc && vite build",
34
36
  "test": "NODE_OPTIONS=--experimental-vm-modules jest",
35
37
  "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
@@ -1,17 +1,17 @@
1
- import { exec } from 'child_process';
1
+ // import { exec } from 'child_process';
2
2
 
3
- const result = process.versions;
3
+ // const result = process.versions;
4
4
 
5
- if (result && result.node && parseInt(result.node) < 16) {
6
- exec("npm install node-fetch", (err, stdout, sterr) => {
7
- if (err) {
8
- console.log("err", err.message);
9
- process.exit(1);
10
- } else if (sterr) {
11
- console.log("stderr", sterr);
12
- process.exit(1);
13
- }
14
- console.log("stdout", stdout);
15
- process.exit(0);
16
- });
17
- }
5
+ // if (result && result.node && parseInt(result.node) < 16) {
6
+ // exec("npm install node-fetch", (err, stdout, sterr) => {
7
+ // if (err) {
8
+ // console.log("err", err.message);
9
+ // process.exit(1);
10
+ // } else if (sterr) {
11
+ // console.log("stderr", sterr);
12
+ // process.exit(1);
13
+ // }
14
+ // console.log("stdout", stdout);
15
+ // process.exit(0);
16
+ // });
17
+ // }