@tktb-tess/util-fns 0.4.1 → 0.5.0

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
@@ -2,47 +2,29 @@
2
2
 
3
3
  Utility functions for personal use
4
4
 
5
+ ESM only
6
+
7
+ Available in both a browser and Node.js environment.
8
+
5
9
  ## Install
6
10
 
7
11
  ```bash
8
12
  npm i @tktb-tess/util-fns
9
13
  ```
10
14
 
11
- ## ⚠ Caution
12
-
13
- Some functions such as `modPow()` use WebAssembly module internally. If you use these funcs, please initialize WebAssembly before you call it by calling `initWasm()` with `await`.
14
-
15
- `initWasm()` doesn't need to be called multiple times. It must be called once before you use the functions at first.
15
+ ### Usage
16
16
 
17
17
  ```ts
18
- import { modPow, initWasm } from '@tktb-tess/util-fns';
18
+ import { modPow } from '@tktb-tess/util-fns';
19
19
 
20
20
  const main = async () => {
21
- await initWasm(); // needed
22
-
23
21
  const ans = modPow(2n, 16n, 17n);
24
22
 
25
- const ans2 = modPow(2n, 17n, 17n);
26
-
27
- console.log(ans, ans2); // 1n 2n
23
+ console.log(ans); // 1n
28
24
  };
29
25
 
30
26
  main();
31
- ```
32
-
33
- ### Wrong example
34
27
 
35
- ```ts
36
- import { modPow } from '@tktb-tess/util-fns';
37
-
38
- const main = async () => {
39
-
40
- const ans = modPow(2n, 16n, 17n); // Uncaught Error: The function 'modPow()' uses wasm internally, but it hasn't been initialized yet. Please call 'initWasm()' before using 'modPow()'.
41
-
42
- console.log(ans);
43
- };
44
-
45
- main();
46
28
  ```
47
29
 
48
30