@oliversalzburg/js-utils 0.0.17 → 0.0.18

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/lib/nil.d.ts CHANGED
@@ -43,3 +43,8 @@ export declare class UnexpectedNilError extends Error {
43
43
  * @throws {UnexpectedNilError} When the subject is nil.
44
44
  */
45
45
  export declare function mustExist<T>(subject: Maybe<T>, errorMessage?: string): T;
46
+ /**
47
+ * Ensure that the passed subject is not nil; throw otherwise.
48
+ * @param subject A subject that is possibly nil.
49
+ */
50
+ export declare function assertExists<T>(subject: Maybe<T>): asserts subject is T;
package/lib/nil.js CHANGED
@@ -44,4 +44,13 @@ export function mustExist(subject, errorMessage) {
44
44
  }
45
45
  return subject;
46
46
  }
47
+ /**
48
+ * Ensure that the passed subject is not nil; throw otherwise.
49
+ * @param subject A subject that is possibly nil.
50
+ */
51
+ export function assertExists(subject) {
52
+ if (isNil(subject)) {
53
+ throw new UnexpectedNilError();
54
+ }
55
+ }
47
56
  //# sourceMappingURL=nil.js.map
package/lib/nil.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"nil.js","sourceRoot":"","sources":["../source/nil.ts"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAI,OAAiB;IACxC,OAAO,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,CAAC;AACnD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,EAAE,CAAI,OAAiB,EAAE,YAA8B;IACrE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,OAAO,YAAY,YAAY,CAAC;AAC5D,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C;;;OAGG;IACH,YAAY,OAAO,GAAG,sBAAsB;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAI,OAAiB,EAAE,YAAqB;IACnE,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE;QAClB,MAAM,IAAI,kBAAkB,CAAC,YAAY,CAAC,CAAC;KAC5C;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"nil.js","sourceRoot":"","sources":["../source/nil.ts"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAI,OAAiB;IACxC,OAAO,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,CAAC;AACnD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,EAAE,CAAI,OAAiB,EAAE,YAA8B;IACrE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,OAAO,YAAY,YAAY,CAAC;AAC5D,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C;;;OAGG;IACH,YAAY,OAAO,GAAG,sBAAsB;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAI,OAAiB,EAAE,YAAqB;IACnE,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE;QAClB,MAAM,IAAI,kBAAkB,CAAC,YAAY,CAAC,CAAC;KAC5C;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAI,OAAiB;IAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;KAChC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@oliversalzburg/js-utils",
4
- "version": "0.0.17",
4
+ "version": "0.0.18",
5
5
  "license": "MIT",
6
6
  "author": "Oliver Salzburg <oliver.salzburg@gmail.com>",
7
7
  "type": "module",
@@ -17,9 +17,10 @@
17
17
  "build:tsc": "tsc",
18
18
  "build:tsc:watch": "tsc --watch",
19
19
  "docs:typedoc": "typedoc",
20
- "lint": "yarn run lint:eslint && yarn run lint:prettier && yarn run lint:tsc",
21
- "lint:eslint": "eslint source ./*js",
22
- "lint:prettier": "prettier --check source ./*js",
20
+ "lint": "yarn run lint:all",
21
+ "lint:all": "yarn run lint:eslint && yarn run lint:prettier && yarn run lint:tsc",
22
+ "lint:eslint": "eslint .",
23
+ "lint:prettier": "prettier --check .",
23
24
  "lint:tsc": "tsc --noEmit",
24
25
  "npm:publish": "npm publish",
25
26
  "npm:publish:major": "npm version major && npm publish",
@@ -56,5 +57,5 @@
56
57
  "typedoc-plugin-mdn-links": "3.1.0",
57
58
  "typescript": "5.2.2"
58
59
  },
59
- "packageManager": "yarn@4.0.1"
60
+ "packageManager": "yarn@4.0.2"
60
61
  }