1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = _default;
|
7 |
|
8 | function _default(action, {
|
9 | checkPath = true,
|
10 | checkAbortOnFail = true
|
11 | } = {}) {
|
12 |
|
13 | if (typeof action !== 'object') {
|
14 | return `Invalid action object: ${JSON.stringify(action)}`;
|
15 | }
|
16 |
|
17 | const {
|
18 | path,
|
19 | abortOnFail
|
20 | } = action;
|
21 |
|
22 | if (checkPath && (typeof path !== 'string' || path.length === 0)) {
|
23 | return `Invalid path "${path}"`;
|
24 | }
|
25 |
|
26 |
|
27 | if (checkAbortOnFail && abortOnFail !== undefined && typeof abortOnFail !== 'boolean') {
|
28 | return `Invalid value for abortOnFail (${abortOnFail} is not a Boolean)`;
|
29 | }
|
30 |
|
31 | return true;
|
32 | } |
\ | No newline at end of file |