@sprucelabs/schema 27.0.9 → 27.1.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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const assertOptions: <Options extends Record<string, any
|
|
1
|
+
declare const assertOptions: <Options extends Record<string, any>, Keys extends keyof Options = keyof Options>(options: Options, toCheck: Keys[], friendlyMessage?: string | undefined) => Options & Required<Pick<Options, Keys>>;
|
|
2
2
|
export default assertOptions;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import SpruceError from '../errors/SpruceError.js';
|
|
2
|
-
const assertOptions = function (options, toCheck) {
|
|
2
|
+
const assertOptions = function (options, toCheck, friendlyMessage) {
|
|
3
3
|
const missing = [];
|
|
4
4
|
for (const check of toCheck) {
|
|
5
5
|
const value = options === null || options === void 0 ? void 0 : options[check];
|
|
@@ -12,6 +12,7 @@ const assertOptions = function (options, toCheck) {
|
|
|
12
12
|
throw new SpruceError({
|
|
13
13
|
code: 'MISSING_PARAMETERS',
|
|
14
14
|
parameters: missing,
|
|
15
|
+
friendlyMessage,
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
18
|
return options;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const assertOptions: <Options extends Record<string, any
|
|
1
|
+
declare const assertOptions: <Options extends Record<string, any>, Keys extends keyof Options = keyof Options>(options: Options, toCheck: Keys[], friendlyMessage?: string | undefined) => Options & Required<Pick<Options, Keys>>;
|
|
2
2
|
export default assertOptions;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const SpruceError_1 = __importDefault(require("../errors/SpruceError"));
|
|
7
|
-
const assertOptions = function (options, toCheck) {
|
|
7
|
+
const assertOptions = function (options, toCheck, friendlyMessage) {
|
|
8
8
|
const missing = [];
|
|
9
9
|
for (const check of toCheck) {
|
|
10
10
|
const value = options === null || options === void 0 ? void 0 : options[check];
|
|
@@ -17,6 +17,7 @@ const assertOptions = function (options, toCheck) {
|
|
|
17
17
|
throw new SpruceError_1.default({
|
|
18
18
|
code: 'MISSING_PARAMETERS',
|
|
19
19
|
parameters: missing,
|
|
20
|
+
friendlyMessage,
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
23
|
return options;
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"!build/__tests__",
|
|
9
9
|
"esm"
|
|
10
10
|
],
|
|
11
|
-
"version": "27.
|
|
11
|
+
"version": "27.1.1",
|
|
12
12
|
"main": "./build/index.js",
|
|
13
13
|
"types": "./build/index.d.ts",
|
|
14
14
|
"module": "./build/esm/index.js",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@sprucelabs/jest-sheets-reporter": "^1.3.18",
|
|
76
76
|
"@sprucelabs/resolve-path-aliases": "^1.1.4",
|
|
77
77
|
"@sprucelabs/semantic-release": "^4.0.8",
|
|
78
|
-
"@sprucelabs/test-utils": "^3.0.
|
|
78
|
+
"@sprucelabs/test-utils": "^3.0.485",
|
|
79
79
|
"@types/lodash": "^4.14.179",
|
|
80
80
|
"@types/mime-db": "^1.43.1",
|
|
81
81
|
"chokidar-cli": "^3.0.0",
|