labag 2.6.0 → 2.6.1

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/dist/labag.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Mode } from "./mode";
2
- import { Pattern, LaBaGEvent } from "./types";
2
+ import { Pattern, LaBaGEvent, ModeName } from "./types";
3
3
  /**
4
4
  * 拉霸遊戲的主要類別。
5
5
  */
@@ -94,5 +94,6 @@ export declare class LaBaG {
94
94
  roundEnd(): void;
95
95
  gameOver(): void;
96
96
  play(): void;
97
+ getModes(name: ModeName): Mode<Record<string, any>, string>[];
97
98
  get isRunning(): boolean;
98
99
  }
package/dist/labag.js CHANGED
@@ -269,6 +269,9 @@ class LaBaG {
269
269
  this.gameOver();
270
270
  }
271
271
  }
272
+ getModes(name) {
273
+ return this.modes.filter((m) => m.name === name);
274
+ }
272
275
  get isRunning() {
273
276
  return this.played < this.times;
274
277
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "labag",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/labag.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Mode } from "./mode";
2
2
  import { patterns } from "./pattern";
3
- import { Pattern, LaBaGEvent, PatternName } from "./types";
3
+ import { Pattern, LaBaGEvent, PatternName, ModeName } from "./types";
4
4
  import { randInt } from "./utils/randInt";
5
5
 
6
6
  /**
@@ -290,6 +290,10 @@ export class LaBaG {
290
290
  }
291
291
  }
292
292
 
293
+ getModes(name: ModeName) {
294
+ return this.modes.filter((m) => m.name === name);
295
+ }
296
+
293
297
  get isRunning() {
294
298
  return this.played < this.times;
295
299
  }