@sigil-sifter/magic 1.0.0 → 1.0.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/package.json +1 -1
- package/src/index.js +1 -7
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import MagicCard from './core/MagicCard.js';
|
|
2
1
|
import ColorExtension from './extensions/ColorExtension.js';
|
|
3
2
|
import FormatExtension from './extensions/FormatExtension.js';
|
|
4
3
|
import GameExtension from './extensions/GameExtension.js';
|
|
@@ -9,11 +8,6 @@ import SetExtension from './extensions/SetExtension.js';
|
|
|
9
8
|
import * as keywords from './keywords/index.js';
|
|
10
9
|
|
|
11
10
|
export default function register(sifter, Card, data = {}) {
|
|
12
|
-
if (!Card)
|
|
13
|
-
throw new Error('A valid Card class must be provided.');
|
|
14
|
-
if (!(Card.prototype instanceof MagicCard))
|
|
15
|
-
throw new Error('Card class must inherit from MagicCard');
|
|
16
|
-
|
|
17
11
|
sifter.addKeywords(Object.values(keywords));
|
|
18
12
|
|
|
19
13
|
sifter.setBaseStringParser((sifter, operator, expression) => {
|
|
@@ -24,7 +18,7 @@ export default function register(sifter, Card, data = {}) {
|
|
|
24
18
|
return keyword;
|
|
25
19
|
});
|
|
26
20
|
|
|
27
|
-
sifter.setInputAdapter(Card);
|
|
21
|
+
if (Card) sifter.setInputAdapter(Card);
|
|
28
22
|
|
|
29
23
|
sifter.extend(ColorExtension, data);
|
|
30
24
|
sifter.extend(FormatExtension, data);
|