optolith-database-schema 0.16.8 → 0.17.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/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.17.2](https://github.com/elyukai/optolith-database-schema/compare/v0.17.1...v0.17.2) (2024-10-06)
6
+
7
+ ### [0.17.1](https://github.com/elyukai/optolith-database-schema/compare/v0.17.0...v0.17.1) (2024-10-06)
8
+
9
+
10
+ ### Features
11
+
12
+ * add minimum and maximum UI strings with placeholders ([1bf8df1](https://github.com/elyukai/optolith-database-schema/commit/1bf8df1575c605b50d2990ed5cd85892d871ecba))
13
+ * add pluralization type definitions ([a8340e6](https://github.com/elyukai/optolith-database-schema/commit/a8340e6dd488945b63347a80de0f54f5eb5050e8))
14
+ * use @optolith/helpers package ([d8324f7](https://github.com/elyukai/optolith-database-schema/commit/d8324f7042f459201452704bffa3c06e1ec582fe))
15
+
16
+ ## [0.17.0](https://github.com/elyukai/optolith-database-schema/compare/v0.16.8...v0.17.0) (2024-10-03)
17
+
18
+
19
+ ### ⚠ BREAKING CHANGES
20
+
21
+ * add translations for library entries of spellworks and liturgical chants
22
+
23
+ ### Features
24
+
25
+ * add translations for library entries of spellworks and liturgical chants ([223a469](https://github.com/elyukai/optolith-database-schema/commit/223a469a63b44d0204d762b17905d622d7b6b9a2))
26
+
5
27
  ### [0.16.8](https://github.com/elyukai/optolith-database-schema/compare/v0.16.7...v0.16.8) (2024-03-01)
6
28
 
7
29
 
@@ -1,6 +1,6 @@
1
- import { isNotNullish } from "../helpers/nullable.js";
2
- import { mapObject } from "../helpers/object.js";
3
- import { assertExhaustive } from "../helpers/typeSafety.js";
1
+ import { isNotNullish } from "@optolith/helpers/nullable";
2
+ import { mapObject } from "@optolith/helpers/object";
3
+ import { assertExhaustive } from "@optolith/helpers/typeSafety";
4
4
  const PRINCIPLES_ID = 31;
5
5
  const PROPERTY_KNOWLEDGE_ID = 3;
6
6
  const ASPECT_KNOWLEDGE_ID = 1;
@@ -1,4 +1,4 @@
1
- import { assertExhaustive } from "../helpers/typeSafety.js";
1
+ import { assertExhaustive } from "@optolith/helpers/typeSafety";
2
2
  const BLESSED_ID = 12;
3
3
  const SPELLCASTER_ID = 47;
4
4
  const getAdvantageId = (type) => {
package/lib/errors.js CHANGED
@@ -1,4 +1,4 @@
1
- import { filterNullable } from "./helpers/array.js";
1
+ import { filterNonNullable } from "@optolith/helpers/array";
2
2
  import { collator } from "./helpers/i18n.js";
3
3
  /**
4
4
  * Pretty-prints an error map.
@@ -12,11 +12,11 @@ export const printErrors = (errorsByFile, printOptions = {}) => {
12
12
  return Object.entries(errorsByFile)
13
13
  .sort(([filePathA], [filePathB]) => collator.compare(filePathA, filePathB))
14
14
  .flatMap(verbose
15
- ? ([filePath, errors]) => filterNullable(errors.map(printVerboseError(filePath)))
15
+ ? ([filePath, errors]) => filterNonNullable(errors.map(printVerboseError(filePath)))
16
16
  : ([filePath, errors]) => [
17
- ...(errors
17
+ ...errors
18
18
  .filter((error) => error.keyword === "integrity" || error.keyword === "filename")
19
- .map(printVerboseError(filePath))),
19
+ .map(printVerboseError(filePath)),
20
20
  ...(errors.some(error => error.keyword !== "integrity" && error.keyword !== "filename")
21
21
  ? [errorMessageBlock([filePath], "has schema errors")]
22
22
  : []),
@@ -29,5 +29,5 @@ const printVerboseError = (filePath) => (error) => {
29
29
  };
30
30
  const errorMessageBlock = (path, message) => [
31
31
  ...path.map((segment, i) => `${" ".repeat(i * 2)}in "${segment}":`),
32
- `${" ".repeat(path.length * 2)}${message}`
32
+ `${" ".repeat(path.length * 2)}${message}`,
33
33
  ].join("\n");
@@ -11,4 +11,4 @@ declare global {
11
11
  objectFromEntries<K extends string, T>(this: [key: K, value: T][]): Record<K, T>;
12
12
  }
13
13
  }
14
- export declare const filterNullable: <T>(arr: T[]) => NonNullable<T>[];
14
+ export {};
@@ -3,13 +3,13 @@ Object.defineProperty(Array.prototype, "promiseAll", {
3
3
  writable: true,
4
4
  value: function promiseAll() {
5
5
  return Promise.all(this);
6
- }
6
+ },
7
7
  });
8
8
  Object.defineProperty(Array.prototype, "objectFromEntries", {
9
9
  configurable: true,
10
10
  writable: true,
11
11
  value: function objectFromEntries() {
12
12
  return Object.fromEntries(this);
13
- }
13
+ },
14
14
  });
15
- export const filterNullable = (arr) => arr.filter((x) => x != null);
15
+ export {};
@@ -0,0 +1,14 @@
1
+ import { PluralizationCategories } from "../types/_I18n.js";
2
+ import { UI } from "../types/UI.js";
3
+ declare const pluralType: {
4
+ [K in keyof UI as UI[K] extends PluralizationCategories ? K : never]: Intl.PluralRuleType;
5
+ };
6
+ /**
7
+ * The keys of the UI strings that support pluralization categories.
8
+ */
9
+ export type KeySupportingPluralizationCategories = keyof typeof pluralType;
10
+ /**
11
+ * Returns the plural rule type for the given key.
12
+ */
13
+ export declare const getPluralRuleTypeForKey: (key: KeySupportingPluralizationCategories) => Intl.PluralRuleType;
14
+ export {};
@@ -0,0 +1,28 @@
1
+ const pluralType = {
2
+ "{0} Adventure Points": "cardinal",
3
+ "You are missing {0} Adventure Points to do this.": "cardinal",
4
+ "since the {0}. printing": "ordinal",
5
+ "removed in {0}. printing": "ordinal",
6
+ "{0} actions": "cardinal",
7
+ "{0} hours": "cardinal",
8
+ "{0} minutes": "cardinal",
9
+ "{0} rounds": "cardinal",
10
+ "{0} seduction actions": "cardinal",
11
+ ", {0} of which are permanent": "cardinal",
12
+ "{0} centuries": "cardinal",
13
+ "{0} combat rounds": "cardinal",
14
+ "{0} days": "cardinal",
15
+ "{0} months": "cardinal",
16
+ "{0} mos.": "cardinal",
17
+ "{0} seconds": "cardinal",
18
+ "{0} weeks": "cardinal",
19
+ "{0} wks.": "cardinal",
20
+ "{0} years": "cardinal",
21
+ "{0} yrs.": "cardinal",
22
+ "{0} miles": "cardinal",
23
+ "{0} yards": "cardinal",
24
+ };
25
+ /**
26
+ * Returns the plural rule type for the given key.
27
+ */
28
+ export const getPluralRuleTypeForKey = (key) => pluralType[key];
@@ -6,6 +6,7 @@ import { DurationUnit } from "./_ActivatableSkillDuration.js";
6
6
  import { FixedRange } from "./_ActivatableSkillRange.js";
7
7
  import { TargetCategory } from "./_ActivatableSkillTargetCategory.js";
8
8
  import { LocaleMap } from "./_LocaleMap.js";
9
+ import { ResponsiveText } from "./_ResponsiveText.js";
9
10
  import { Errata } from "./source/_Erratum.js";
10
11
  import { PublicationRefs } from "./source/_PublicationRef.js";
11
12
  /**
@@ -106,8 +107,7 @@ export type IndefiniteBlessingDuration = {
106
107
  export type IndefiniteDurationTranslation = {
107
108
  /**
108
109
  * A description of the duration.
109
- * @minLength 1
110
110
  */
111
- description: string;
111
+ description: ResponsiveText;
112
112
  };
113
113
  export declare const config: TypeConfig<Blessing, Blessing["id"], "Blessing">;
package/lib/types/UI.d.ts CHANGED
@@ -872,8 +872,8 @@ export type UI = {
872
872
  "Parry": NonEmptyString;
873
873
  "Close Combat": NonEmptyString;
874
874
  "Ranged Combat": NonEmptyString;
875
- "inlinewiki.special": NonEmptyString;
876
- "inlinewiki.primaryattribute": NonEmptyString;
875
+ "Special": NonEmptyString;
876
+ "Primary Attribute": NonEmptyString;
877
877
  "Cantrips": NonEmptyString;
878
878
  "Rituals": NonEmptyString;
879
879
  "Curses": NonEmptyString;
@@ -889,6 +889,128 @@ export type UI = {
889
889
  "Check Modifier": NonEmptyString;
890
890
  "spells.traditions.general": NonEmptyString;
891
891
  "magicalactions.animistforces.tribes.general": NonEmptyString;
892
+ " (modified by {0})": NonEmptyString;
893
+ " (− {0})": NonEmptyString;
894
+ "{0} or {1}, depending on which value is higher": NonEmptyString;
895
+ "Invocation Difficulty": NonEmptyString;
896
+ "ID": NonEmptyString;
897
+ "Creation Difficulty": NonEmptyString;
898
+ "CD": NonEmptyString;
899
+ "Effect": NonEmptyString;
900
+ "Casting Time": NonEmptyString;
901
+ "Ritual Time": NonEmptyString;
902
+ "Liturgical Time": NonEmptyString;
903
+ "Ceremonial Time": NonEmptyString;
904
+ "AE Cost": NonEmptyString;
905
+ "KP Cost": NonEmptyString;
906
+ "Range": NonEmptyString;
907
+ "Duration": NonEmptyString;
908
+ "Target Category": NonEmptyString;
909
+ "Traditions": NonEmptyString;
910
+ " (you cannot use a modification on this spell’s casting time)": NonEmptyString;
911
+ " (you cannot use a modification on this spell’s cost)": NonEmptyString;
912
+ " (you cannot use a modification on this spell’s range)": NonEmptyString;
913
+ " (you cannot use a modification on this ritual’s ritual time)": NonEmptyString;
914
+ " (you cannot use a modification on this ritual’s cost)": NonEmptyString;
915
+ " (you cannot use a modification on this ritual’s range)": NonEmptyString;
916
+ " (you cannot use a modification on this chant’s liturgical time)": NonEmptyString;
917
+ " (you cannot use a modification on this chant’s cost)": NonEmptyString;
918
+ " (you cannot use a modification on this chant’s range)": NonEmptyString;
919
+ " (you cannot use a modification on this ceremony’s ceremonial time)": NonEmptyString;
920
+ " (you cannot use a modification on this ceremony’s cost)": NonEmptyString;
921
+ " (you cannot use a modification on this ceremony’s range)": NonEmptyString;
922
+ " (cannot modify)": NonEmptyString;
923
+ "{0} act": NonEmptyString;
924
+ "act": NonEmptyString;
925
+ "{0} actions": PluralizationCategories;
926
+ "actions": NonEmptyString;
927
+ "{0} s": NonEmptyString;
928
+ "s": NonEmptyString;
929
+ "{0} seconds": PluralizationCategories;
930
+ "seconds": NonEmptyString;
931
+ "{0} min": NonEmptyString;
932
+ "min": NonEmptyString;
933
+ "{0} minutes": PluralizationCategories;
934
+ "minutes": NonEmptyString;
935
+ "{0} h": NonEmptyString;
936
+ "h": NonEmptyString;
937
+ "{0} hours": PluralizationCategories;
938
+ "hours": NonEmptyString;
939
+ "{0} d": NonEmptyString;
940
+ "d": NonEmptyString;
941
+ "{0} days": PluralizationCategories;
942
+ "days": NonEmptyString;
943
+ "{0} wks.": PluralizationCategories;
944
+ "wks.": NonEmptyString;
945
+ "{0} weeks": PluralizationCategories;
946
+ "weeks": NonEmptyString;
947
+ "{0} mos.": PluralizationCategories;
948
+ "mos.": NonEmptyString;
949
+ "{0} months": PluralizationCategories;
950
+ "months": NonEmptyString;
951
+ "{0} yrs.": PluralizationCategories;
952
+ "yrs.": NonEmptyString;
953
+ "{0} years": PluralizationCategories;
954
+ "years": NonEmptyString;
955
+ "{0} cent.": NonEmptyString;
956
+ "cent.": NonEmptyString;
957
+ "{0} centuries": PluralizationCategories;
958
+ "centuries": NonEmptyString;
959
+ "{0} SA": NonEmptyString;
960
+ "{0} seduction actions": PluralizationCategories;
961
+ "{0} rnds": NonEmptyString;
962
+ "{0} rounds": PluralizationCategories;
963
+ "{0} CR": NonEmptyString;
964
+ "CR": NonEmptyString;
965
+ "{0} combat rounds": PluralizationCategories;
966
+ "combat rounds": NonEmptyString;
967
+ "{0} AE": NonEmptyString;
968
+ "{0} KP": NonEmptyString;
969
+ "min. ": NonEmptyString;
970
+ "at least ": NonEmptyString;
971
+ "min. {0}": NonEmptyString;
972
+ "at least {0}": NonEmptyString;
973
+ "/{0}": NonEmptyString;
974
+ " per {0}": NonEmptyString;
975
+ ", minimum of {0}": NonEmptyString;
976
+ " ({0} perm.)": NonEmptyString;
977
+ ", {0} of which are permanent": PluralizationCategories;
978
+ "half of the activation cost": NonEmptyString;
979
+ " and ": NonEmptyString;
980
+ " + ": NonEmptyString;
981
+ " or ": NonEmptyString;
982
+ " / ": NonEmptyString;
983
+ " for ": NonEmptyString;
984
+ " (no more than {0})": NonEmptyString;
985
+ " (max. {0})": NonEmptyString;
986
+ "no more than {0}": NonEmptyString;
987
+ "max. {0}": NonEmptyString;
988
+ "Immediate": NonEmptyString;
989
+ "Permanent": NonEmptyString;
990
+ "no more than ": NonEmptyString;
991
+ "max. ": NonEmptyString;
992
+ "Quality Levels": NonEmptyString;
993
+ "QL": NonEmptyString;
994
+ "QL {0}": NonEmptyString;
995
+ "Skill Points": NonEmptyString;
996
+ "SP": NonEmptyString;
997
+ "Sustained": NonEmptyString;
998
+ "(S)": NonEmptyString;
999
+ "{0} yards": PluralizationCategories;
1000
+ "{0} yd": NonEmptyString;
1001
+ "{0} miles": PluralizationCategories;
1002
+ "{0} mi.": NonEmptyString;
1003
+ "Sight": NonEmptyString;
1004
+ "Self": NonEmptyString;
1005
+ "Global": NonEmptyString;
1006
+ "Touch": NonEmptyString;
1007
+ "Radius": NonEmptyString;
1008
+ " (casting)": NonEmptyString;
1009
+ "Zone": NonEmptyString;
1010
+ "Liturgical Chants and Ceremonies": NonEmptyString;
1011
+ "General": NonEmptyString;
1012
+ "Note": NonEmptyString;
1013
+ "all": NonEmptyString;
892
1014
  "inlinewiki.castingtime": NonEmptyString;
893
1015
  "inlinewiki.ritualtime": NonEmptyString;
894
1016
  "inlinewiki.aecost": NonEmptyString;
@@ -1,9 +1,9 @@
1
+ import { assertExhaustive } from "@optolith/helpers/typeSafety";
1
2
  import addFormatsModule from "ajv-formats";
2
3
  import Ajv2019Module from "ajv/dist/2019.js";
3
4
  import Ajv2020Module from "ajv/dist/2020.js";
4
5
  import "../helpers/array.js";
5
6
  import { isHiddenFileName, readDirectoryRec, readJsonFile } from "../helpers/io.js";
6
- import { assertExhaustive } from "../helpers/typeSafety.js";
7
7
  const Ajv2019 = Ajv2019Module.default;
8
8
  const Ajv2020 = Ajv2020Module.default;
9
9
  const addFormats = addFormatsModule.default;
@@ -15,7 +15,7 @@ const createSchemaValidator = (jsonSchemaSpec, validatorOptions = {}) => {
15
15
  case "Draft_2020_12":
16
16
  return new Ajv2020(validatorOptions);
17
17
  default:
18
- assertExhaustive(jsonSchemaSpec);
18
+ return assertExhaustive(jsonSchemaSpec);
19
19
  }
20
20
  };
21
21
  const registerAllJsonSchemaDocuments = async (jsonSchemaDir, validator) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "optolith-database-schema",
3
- "version": "0.16.8",
3
+ "version": "0.17.2",
4
4
  "description": "Definitions and utilities for the flat-file database of Optolith, a character creation tool for the Pen and Paper RPG “The Dark Eye 5”, and its external integrations into other software.",
5
5
  "keywords": [
6
6
  "tde",
@@ -14,6 +14,7 @@
14
14
  "./errors": "./lib/errors.js",
15
15
  "./cache/*": "./lib/cache/*.js",
16
16
  "./config/*": "./lib/config/*.js",
17
+ "./rendering/*": "./lib/rendering/*.js",
17
18
  "./types/*": "./lib/types/*.js"
18
19
  },
19
20
  "scripts": {
@@ -28,6 +29,7 @@
28
29
  "author": "Lukas Obermann",
29
30
  "license": "MPL-2.0",
30
31
  "dependencies": {
32
+ "@optolith/helpers": "^0.2.1",
31
33
  "ajv": "^8.12.0",
32
34
  "ajv-formats": "^2.1.1",
33
35
  "yaml": "^2.3.3"
@@ -253,8 +253,7 @@
253
253
  "properties": {
254
254
  "description": {
255
255
  "description": "A description of the duration.",
256
- "type": "string",
257
- "minLength": 1
256
+ "$ref": "./_ResponsiveText.schema.json#/$defs/ResponsiveText"
258
257
  }
259
258
  },
260
259
  "required": [
@@ -2158,10 +2158,10 @@
2158
2158
  "Ranged Combat": {
2159
2159
  "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2160
2160
  },
2161
- "inlinewiki.special": {
2161
+ "Special": {
2162
2162
  "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2163
2163
  },
2164
- "inlinewiki.primaryattribute": {
2164
+ "Primary Attribute": {
2165
2165
  "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2166
2166
  },
2167
2167
  "Cantrips": {
@@ -2209,6 +2209,372 @@
2209
2209
  "magicalactions.animistforces.tribes.general": {
2210
2210
  "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2211
2211
  },
2212
+ " (modified by {0})": {
2213
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2214
+ },
2215
+ " (− {0})": {
2216
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2217
+ },
2218
+ "{0} or {1}, depending on which value is higher": {
2219
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2220
+ },
2221
+ "Invocation Difficulty": {
2222
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2223
+ },
2224
+ "ID": {
2225
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2226
+ },
2227
+ "Creation Difficulty": {
2228
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2229
+ },
2230
+ "CD": {
2231
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2232
+ },
2233
+ "Effect": {
2234
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2235
+ },
2236
+ "Casting Time": {
2237
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2238
+ },
2239
+ "Ritual Time": {
2240
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2241
+ },
2242
+ "Liturgical Time": {
2243
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2244
+ },
2245
+ "Ceremonial Time": {
2246
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2247
+ },
2248
+ "AE Cost": {
2249
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2250
+ },
2251
+ "KP Cost": {
2252
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2253
+ },
2254
+ "Range": {
2255
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2256
+ },
2257
+ "Duration": {
2258
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2259
+ },
2260
+ "Target Category": {
2261
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2262
+ },
2263
+ "Traditions": {
2264
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2265
+ },
2266
+ " (you cannot use a modification on this spell’s casting time)": {
2267
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2268
+ },
2269
+ " (you cannot use a modification on this spell’s cost)": {
2270
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2271
+ },
2272
+ " (you cannot use a modification on this spell’s range)": {
2273
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2274
+ },
2275
+ " (you cannot use a modification on this ritual’s ritual time)": {
2276
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2277
+ },
2278
+ " (you cannot use a modification on this ritual’s cost)": {
2279
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2280
+ },
2281
+ " (you cannot use a modification on this ritual’s range)": {
2282
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2283
+ },
2284
+ " (you cannot use a modification on this chant’s liturgical time)": {
2285
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2286
+ },
2287
+ " (you cannot use a modification on this chant’s cost)": {
2288
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2289
+ },
2290
+ " (you cannot use a modification on this chant’s range)": {
2291
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2292
+ },
2293
+ " (you cannot use a modification on this ceremony’s ceremonial time)": {
2294
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2295
+ },
2296
+ " (you cannot use a modification on this ceremony’s cost)": {
2297
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2298
+ },
2299
+ " (you cannot use a modification on this ceremony’s range)": {
2300
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2301
+ },
2302
+ " (cannot modify)": {
2303
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2304
+ },
2305
+ "{0} act": {
2306
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2307
+ },
2308
+ "act": {
2309
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2310
+ },
2311
+ "{0} actions": {
2312
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2313
+ },
2314
+ "actions": {
2315
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2316
+ },
2317
+ "{0} s": {
2318
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2319
+ },
2320
+ "s": {
2321
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2322
+ },
2323
+ "{0} seconds": {
2324
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2325
+ },
2326
+ "seconds": {
2327
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2328
+ },
2329
+ "{0} min": {
2330
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2331
+ },
2332
+ "min": {
2333
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2334
+ },
2335
+ "{0} minutes": {
2336
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2337
+ },
2338
+ "minutes": {
2339
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2340
+ },
2341
+ "{0} h": {
2342
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2343
+ },
2344
+ "h": {
2345
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2346
+ },
2347
+ "{0} hours": {
2348
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2349
+ },
2350
+ "hours": {
2351
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2352
+ },
2353
+ "{0} d": {
2354
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2355
+ },
2356
+ "d": {
2357
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2358
+ },
2359
+ "{0} days": {
2360
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2361
+ },
2362
+ "days": {
2363
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2364
+ },
2365
+ "{0} wks.": {
2366
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2367
+ },
2368
+ "wks.": {
2369
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2370
+ },
2371
+ "{0} weeks": {
2372
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2373
+ },
2374
+ "weeks": {
2375
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2376
+ },
2377
+ "{0} mos.": {
2378
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2379
+ },
2380
+ "mos.": {
2381
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2382
+ },
2383
+ "{0} months": {
2384
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2385
+ },
2386
+ "months": {
2387
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2388
+ },
2389
+ "{0} yrs.": {
2390
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2391
+ },
2392
+ "yrs.": {
2393
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2394
+ },
2395
+ "{0} years": {
2396
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2397
+ },
2398
+ "years": {
2399
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2400
+ },
2401
+ "{0} cent.": {
2402
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2403
+ },
2404
+ "cent.": {
2405
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2406
+ },
2407
+ "{0} centuries": {
2408
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2409
+ },
2410
+ "centuries": {
2411
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2412
+ },
2413
+ "{0} SA": {
2414
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2415
+ },
2416
+ "{0} seduction actions": {
2417
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2418
+ },
2419
+ "{0} rnds": {
2420
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2421
+ },
2422
+ "{0} rounds": {
2423
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2424
+ },
2425
+ "{0} CR": {
2426
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2427
+ },
2428
+ "CR": {
2429
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2430
+ },
2431
+ "{0} combat rounds": {
2432
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2433
+ },
2434
+ "combat rounds": {
2435
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2436
+ },
2437
+ "{0} AE": {
2438
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2439
+ },
2440
+ "{0} KP": {
2441
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2442
+ },
2443
+ "min. ": {
2444
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2445
+ },
2446
+ "at least ": {
2447
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2448
+ },
2449
+ "min. {0}": {
2450
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2451
+ },
2452
+ "at least {0}": {
2453
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2454
+ },
2455
+ "/{0}": {
2456
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2457
+ },
2458
+ " per {0}": {
2459
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2460
+ },
2461
+ ", minimum of {0}": {
2462
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2463
+ },
2464
+ " ({0} perm.)": {
2465
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2466
+ },
2467
+ ", {0} of which are permanent": {
2468
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2469
+ },
2470
+ "half of the activation cost": {
2471
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2472
+ },
2473
+ " and ": {
2474
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2475
+ },
2476
+ " + ": {
2477
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2478
+ },
2479
+ " or ": {
2480
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2481
+ },
2482
+ " / ": {
2483
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2484
+ },
2485
+ " for ": {
2486
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2487
+ },
2488
+ " (no more than {0})": {
2489
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2490
+ },
2491
+ " (max. {0})": {
2492
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2493
+ },
2494
+ "no more than {0}": {
2495
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2496
+ },
2497
+ "max. {0}": {
2498
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2499
+ },
2500
+ "Immediate": {
2501
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2502
+ },
2503
+ "Permanent": {
2504
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2505
+ },
2506
+ "no more than ": {
2507
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2508
+ },
2509
+ "max. ": {
2510
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2511
+ },
2512
+ "Quality Levels": {
2513
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2514
+ },
2515
+ "QL": {
2516
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2517
+ },
2518
+ "QL {0}": {
2519
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2520
+ },
2521
+ "Skill Points": {
2522
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2523
+ },
2524
+ "SP": {
2525
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2526
+ },
2527
+ "Sustained": {
2528
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2529
+ },
2530
+ "(S)": {
2531
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2532
+ },
2533
+ "{0} yards": {
2534
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2535
+ },
2536
+ "{0} yd": {
2537
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2538
+ },
2539
+ "{0} miles": {
2540
+ "$ref": "./_I18n.schema.json#/$defs/PluralizationCategories"
2541
+ },
2542
+ "{0} mi.": {
2543
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2544
+ },
2545
+ "Sight": {
2546
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2547
+ },
2548
+ "Self": {
2549
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2550
+ },
2551
+ "Global": {
2552
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2553
+ },
2554
+ "Touch": {
2555
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2556
+ },
2557
+ "Radius": {
2558
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2559
+ },
2560
+ " (casting)": {
2561
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2562
+ },
2563
+ "Zone": {
2564
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2565
+ },
2566
+ "Liturgical Chants and Ceremonies": {
2567
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2568
+ },
2569
+ "General": {
2570
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2571
+ },
2572
+ "Note": {
2573
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2574
+ },
2575
+ "all": {
2576
+ "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2577
+ },
2212
2578
  "inlinewiki.castingtime": {
2213
2579
  "$ref": "./_NonEmptyString.schema.json#/$defs/NonEmptyString"
2214
2580
  },
@@ -3471,8 +3837,8 @@
3471
3837
  "Parry",
3472
3838
  "Close Combat",
3473
3839
  "Ranged Combat",
3474
- "inlinewiki.special",
3475
- "inlinewiki.primaryattribute",
3840
+ "Special",
3841
+ "Primary Attribute",
3476
3842
  "Cantrips",
3477
3843
  "Rituals",
3478
3844
  "Curses",
@@ -3488,6 +3854,128 @@
3488
3854
  "Check Modifier",
3489
3855
  "spells.traditions.general",
3490
3856
  "magicalactions.animistforces.tribes.general",
3857
+ " (modified by {0})",
3858
+ " (− {0})",
3859
+ "{0} or {1}, depending on which value is higher",
3860
+ "Invocation Difficulty",
3861
+ "ID",
3862
+ "Creation Difficulty",
3863
+ "CD",
3864
+ "Effect",
3865
+ "Casting Time",
3866
+ "Ritual Time",
3867
+ "Liturgical Time",
3868
+ "Ceremonial Time",
3869
+ "AE Cost",
3870
+ "KP Cost",
3871
+ "Range",
3872
+ "Duration",
3873
+ "Target Category",
3874
+ "Traditions",
3875
+ " (you cannot use a modification on this spell’s casting time)",
3876
+ " (you cannot use a modification on this spell’s cost)",
3877
+ " (you cannot use a modification on this spell’s range)",
3878
+ " (you cannot use a modification on this ritual’s ritual time)",
3879
+ " (you cannot use a modification on this ritual’s cost)",
3880
+ " (you cannot use a modification on this ritual’s range)",
3881
+ " (you cannot use a modification on this chant’s liturgical time)",
3882
+ " (you cannot use a modification on this chant’s cost)",
3883
+ " (you cannot use a modification on this chant’s range)",
3884
+ " (you cannot use a modification on this ceremony’s ceremonial time)",
3885
+ " (you cannot use a modification on this ceremony’s cost)",
3886
+ " (you cannot use a modification on this ceremony’s range)",
3887
+ " (cannot modify)",
3888
+ "{0} act",
3889
+ "act",
3890
+ "{0} actions",
3891
+ "actions",
3892
+ "{0} s",
3893
+ "s",
3894
+ "{0} seconds",
3895
+ "seconds",
3896
+ "{0} min",
3897
+ "min",
3898
+ "{0} minutes",
3899
+ "minutes",
3900
+ "{0} h",
3901
+ "h",
3902
+ "{0} hours",
3903
+ "hours",
3904
+ "{0} d",
3905
+ "d",
3906
+ "{0} days",
3907
+ "days",
3908
+ "{0} wks.",
3909
+ "wks.",
3910
+ "{0} weeks",
3911
+ "weeks",
3912
+ "{0} mos.",
3913
+ "mos.",
3914
+ "{0} months",
3915
+ "months",
3916
+ "{0} yrs.",
3917
+ "yrs.",
3918
+ "{0} years",
3919
+ "years",
3920
+ "{0} cent.",
3921
+ "cent.",
3922
+ "{0} centuries",
3923
+ "centuries",
3924
+ "{0} SA",
3925
+ "{0} seduction actions",
3926
+ "{0} rnds",
3927
+ "{0} rounds",
3928
+ "{0} CR",
3929
+ "CR",
3930
+ "{0} combat rounds",
3931
+ "combat rounds",
3932
+ "{0} AE",
3933
+ "{0} KP",
3934
+ "min. ",
3935
+ "at least ",
3936
+ "min. {0}",
3937
+ "at least {0}",
3938
+ "/{0}",
3939
+ " per {0}",
3940
+ ", minimum of {0}",
3941
+ " ({0} perm.)",
3942
+ ", {0} of which are permanent",
3943
+ "half of the activation cost",
3944
+ " and ",
3945
+ " + ",
3946
+ " or ",
3947
+ " / ",
3948
+ " for ",
3949
+ " (no more than {0})",
3950
+ " (max. {0})",
3951
+ "no more than {0}",
3952
+ "max. {0}",
3953
+ "Immediate",
3954
+ "Permanent",
3955
+ "no more than ",
3956
+ "max. ",
3957
+ "Quality Levels",
3958
+ "QL",
3959
+ "QL {0}",
3960
+ "Skill Points",
3961
+ "SP",
3962
+ "Sustained",
3963
+ "(S)",
3964
+ "{0} yards",
3965
+ "{0} yd",
3966
+ "{0} miles",
3967
+ "{0} mi.",
3968
+ "Sight",
3969
+ "Self",
3970
+ "Global",
3971
+ "Touch",
3972
+ "Radius",
3973
+ " (casting)",
3974
+ "Zone",
3975
+ "Liturgical Chants and Ceremonies",
3976
+ "General",
3977
+ "Note",
3978
+ "all",
3491
3979
  "inlinewiki.castingtime",
3492
3980
  "inlinewiki.ritualtime",
3493
3981
  "inlinewiki.aecost",
@@ -1,35 +0,0 @@
1
- /**
2
- * Extracts `null` and `undefined` from a type.
3
- */
4
- export type Nullish<T = null | undefined> = T extends null | undefined ? T : never;
5
- /**
6
- * Checks if a value is `null` or `undefined`.
7
- */
8
- export declare const isNullish: <T>(value: T) => value is Exclude<T, NonNullable<T>>;
9
- /**
10
- * Checks if a value is not `null` or `undefined`.
11
- */
12
- export declare const isNotNullish: <T>(value: T) => value is NonNullable<T>;
13
- /**
14
- * Maps a value to another value if it is not `null` or `undefined`.
15
- */
16
- export declare const mapNullable: <T, U>(value: T, map: (value: NonNullable<T>) => U) => U | Nullish<T>;
17
- /**
18
- * Maps a value to another value if it is not `null` or `undefined`, otherwise
19
- * returns a default value.
20
- */
21
- export declare const mapNullableDefault: <T, U>(value: T, map: (value: NonNullable<T>) => U, defaultValue: U) => U;
22
- /**
23
- * Returns an array, containing the value if it is not `null` or `undefined`.
24
- *
25
- * This can be useful in combination with the spread operator or
26
- * `Array.prototype.flatMap`.
27
- * @example
28
- * nullableToArray(2) // [2]
29
- * nullableToArray(undefined) // []
30
- *
31
- * [...nullableToArray(2)] // [2]
32
- * [1, ...nullableToArray(2)] // [1, 2]
33
- * [1, ...nullableToArray(undefined)] // [1]
34
- */
35
- export declare const nullableToArray: <T>(value: T) => NonNullable<T>[];
@@ -1,31 +0,0 @@
1
- /**
2
- * Checks if a value is `null` or `undefined`.
3
- */
4
- export const isNullish = (value) => value === null || value === undefined;
5
- /**
6
- * Checks if a value is not `null` or `undefined`.
7
- */
8
- export const isNotNullish = (value) => !isNullish(value);
9
- /**
10
- * Maps a value to another value if it is not `null` or `undefined`.
11
- */
12
- export const mapNullable = (value, map) => isNotNullish(value) ? map(value) : value;
13
- /**
14
- * Maps a value to another value if it is not `null` or `undefined`, otherwise
15
- * returns a default value.
16
- */
17
- export const mapNullableDefault = (value, map, defaultValue) => (isNotNullish(value) ? map(value) : defaultValue);
18
- /**
19
- * Returns an array, containing the value if it is not `null` or `undefined`.
20
- *
21
- * This can be useful in combination with the spread operator or
22
- * `Array.prototype.flatMap`.
23
- * @example
24
- * nullableToArray(2) // [2]
25
- * nullableToArray(undefined) // []
26
- *
27
- * [...nullableToArray(2)] // [2]
28
- * [1, ...nullableToArray(2)] // [1, 2]
29
- * [1, ...nullableToArray(undefined)] // [1]
30
- */
31
- export const nullableToArray = (value) => isNotNullish(value) ? [value] : [];
@@ -1 +0,0 @@
1
- export {};
@@ -1,46 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { describe, it } from "node:test";
3
- import { isNotNullish, isNullish, mapNullable, mapNullableDefault, nullableToArray, } from "./nullable.js";
4
- describe("isNullish", () => {
5
- it("returns if a value is nullish", () => {
6
- assert.equal(isNullish(null), true);
7
- assert.equal(isNullish(undefined), true);
8
- assert.equal(isNullish(false), false);
9
- assert.equal(isNullish(0), false);
10
- assert.equal(isNullish(""), false);
11
- });
12
- });
13
- describe("isNotNullish", () => {
14
- it("returns if a value is not nullish", () => {
15
- assert.equal(isNotNullish(null), false);
16
- assert.equal(isNotNullish(undefined), false);
17
- assert.equal(isNotNullish(false), true);
18
- assert.equal(isNotNullish(0), true);
19
- assert.equal(isNotNullish(""), true);
20
- });
21
- });
22
- describe("mapNullable", () => {
23
- it("maps a value if it is not nullish", () => {
24
- assert.equal(mapNullable(2, x => x * 2), 4);
25
- });
26
- it("returns the original value if it is nullish", () => {
27
- assert.equal(mapNullable(undefined, x => x * 2), undefined);
28
- });
29
- });
30
- describe("mapNullableDefault", () => {
31
- it("maps a value if it is not nullish", () => {
32
- assert.equal(mapNullableDefault(2, x => x * 2, 0), 4);
33
- });
34
- it("returns a default if the value is nullish", () => {
35
- assert.equal(mapNullableDefault(undefined, x => x * 2, 0), 0);
36
- });
37
- });
38
- describe("nullableToArray", () => {
39
- it("wraps a non-nullish value into an array", () => {
40
- assert.deepEqual(nullableToArray(2), [2]);
41
- });
42
- it("returns an empty array if the value is null or undefined", () => {
43
- assert.deepEqual(nullableToArray(undefined), []);
44
- assert.deepEqual(nullableToArray(null), []);
45
- });
46
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * Maps all own properties of an object to a new object. Returning `undefined`
3
- * from the mapping function will omit the property from the result.
4
- */
5
- export declare const mapObject: <T extends object, U>(object: T, map: (value: T[keyof T], key: keyof T) => U | undefined) => { [key in keyof T]: Exclude<U, undefined>; };
@@ -1,16 +0,0 @@
1
- /**
2
- * Maps all own properties of an object to a new object. Returning `undefined`
3
- * from the mapping function will omit the property from the result.
4
- */
5
- export const mapObject = (object, map) => {
6
- const result = {};
7
- for (const key in object) {
8
- if (Object.hasOwn(object, key)) {
9
- const newValue = map(object[key], key);
10
- if (newValue !== undefined) {
11
- result[key] = newValue;
12
- }
13
- }
14
- }
15
- return result;
16
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,15 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { describe, it } from "node:test";
3
- import { mapObject } from "./object.js";
4
- describe("mapObject", () => {
5
- it("maps all own properties of an object to a new object", () => {
6
- const object = { a: 1, b: 2, c: 3 };
7
- const result = mapObject(object, (value, key) => value + key);
8
- assert.deepEqual(result, { a: "1a", b: "2b", c: "3c" });
9
- });
10
- it("omits properties for which the mapping function returns undefined", () => {
11
- const object = { a: 1, b: 2, c: 3 };
12
- const result = mapObject(object, (value, key) => (key === "b" ? undefined : value + key));
13
- assert.deepEqual(result, { a: "1a", c: "3c" });
14
- });
15
- });
@@ -1,14 +0,0 @@
1
- /**
2
- * This function is used to make sure that the `switch` is exhaustive. Place it
3
- * in the `default` case of the `switch`.
4
- * @param _x - The value that is used in the `switch`.
5
- * @example
6
- * const aorb = (x: "a" | "b") => {
7
- * switch (x) {
8
- * case "a": return 1
9
- * case "b": return 2
10
- * default: return assertExhaustive(x)
11
- * }
12
- * }
13
- */
14
- export declare function assertExhaustive(_x: never): never;
@@ -1,16 +0,0 @@
1
- /**
2
- * This function is used to make sure that the `switch` is exhaustive. Place it
3
- * in the `default` case of the `switch`.
4
- * @param _x - The value that is used in the `switch`.
5
- * @example
6
- * const aorb = (x: "a" | "b") => {
7
- * switch (x) {
8
- * case "a": return 1
9
- * case "b": return 2
10
- * default: return assertExhaustive(x)
11
- * }
12
- * }
13
- */
14
- export function assertExhaustive(_x) {
15
- throw new Error("The switch is not exhaustive.");
16
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { describe, it } from "node:test";
3
- import { assertExhaustive } from "./typeSafety.js";
4
- describe("assertExhaustive", () => {
5
- it("should throw an error with the message 'The switch is not exhaustive.'", () => {
6
- assert.throws(
7
- // @ts-expect-error The function should never receive a value.
8
- () => assertExhaustive(""), err => err instanceof Error && err.message === "The switch is not exhaustive.");
9
- });
10
- });