mahjong-seatings-rs-node 1.0.0 → 1.2.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.
@@ -174,8 +174,8 @@ function getStringFromWasm0(ptr, len) {
174
174
  * @param {any} val
175
175
  * @returns {any}
176
176
  */
177
- module.exports.make_seating_shuffled = function(val) {
178
- const ret = wasm.make_seating_shuffled(val);
177
+ module.exports.make_seating_interval = function(val) {
178
+ const ret = wasm.make_seating_interval(val);
179
179
  return ret;
180
180
  };
181
181
 
@@ -183,8 +183,8 @@ module.exports.make_seating_shuffled = function(val) {
183
183
  * @param {any} val
184
184
  * @returns {any}
185
185
  */
186
- module.exports.make_seating_interval = function(val) {
187
- const ret = wasm.make_seating_interval(val);
186
+ module.exports.make_seating_swiss = function(val) {
187
+ const ret = wasm.make_seating_swiss(val);
188
188
  return ret;
189
189
  };
190
190
 
@@ -192,8 +192,8 @@ module.exports.make_seating_interval = function(val) {
192
192
  * @param {any} val
193
193
  * @returns {any}
194
194
  */
195
- module.exports.make_seating_swiss = function(val) {
196
- const ret = wasm.make_seating_swiss(val);
195
+ module.exports.make_seating_shuffled = function(val) {
196
+ const ret = wasm.make_seating_shuffled(val);
197
197
  return ret;
198
198
  };
199
199
 
Binary file
@@ -0,0 +1,38 @@
1
+ import orig from "./mahjong_seatings_rs.js";
2
+
3
+ export function make_seating_shuffled(val) {
4
+ const input = {
5
+ players_map: Object.entries(val.playersMap).map(([k, v]) => [
6
+ parseInt(k.toString(), 10),
7
+ v,
8
+ ]),
9
+ previous_seatings: val.previousSeatings,
10
+ groups_count: val.groupsCount,
11
+ rand_factor: val.randFactor,
12
+ };
13
+ return orig.make_seating_shuffled(input).result;
14
+ }
15
+
16
+ export function make_seating_interval(val) {
17
+ const input = {
18
+ players_map: Object.entries(val.playersMap).map(([k, v]) => [
19
+ parseInt(k.toString(), 10),
20
+ v,
21
+ ]),
22
+ step: val.step,
23
+ rand_factor: val.randFactor,
24
+ };
25
+ return orig.make_seating_interval(input).result;
26
+ }
27
+
28
+ export function make_seating_swiss(val) {
29
+ const input = {
30
+ players_map: Object.entries(val.playersMap).map(([k, v]) => [
31
+ parseInt(k.toString(), 10),
32
+ v,
33
+ ]),
34
+ previous_seatings: val.previousSeatings,
35
+ rand_factor: val.randFactor,
36
+ };
37
+ return orig.make_seating_swiss(input).result;
38
+ }
package/package.json CHANGED
@@ -3,13 +3,20 @@
3
3
  "collaborators": [
4
4
  "Oleg Klimenko <me@ctizen.dev>"
5
5
  ],
6
- "version": "1.0.0",
6
+ "version": "1.2.0",
7
7
  "files": [
8
8
  "mahjong_seatings_rs_node.js",
9
+ "mahjong_seatings_rs_node.mjs",
9
10
  "mahjong_seatings_rs.d.ts",
10
11
  "mahjong_seatings_rs_bg.wasm",
11
12
  "mahjong_seatings_rs.js"
12
13
  ],
13
14
  "main": "mahjong_seatings_rs_node.js",
14
- "types": "mahjong_seatings_rs.d.ts"
15
+ "types": "mahjong_seatings_rs.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./mahjong_seatings_rs.d.ts",
19
+ "default": "./mahjong_seatings_rs_node.mjs"
20
+ }
21
+ }
15
22
  }