@modern-js/utils 1.3.2 → 1.3.5
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 +21 -0
- package/dist/js/modern/constants.js +28 -1
- package/dist/js/modern/emptyDir.js +6 -0
- package/dist/js/modern/index.js +2 -1
- package/dist/js/modern/is/type.js +4 -5
- package/dist/js/modern/printBuildError.js +0 -1
- package/dist/js/node/constants.js +28 -1
- package/dist/js/node/emptyDir.js +18 -0
- package/dist/js/node/index.js +14 -0
- package/dist/js/node/is/type.js +4 -5
- package/dist/js/node/printBuildError.js +0 -2
- package/dist/js/treeshaking/constants.js +28 -1
- package/dist/js/treeshaking/emptyDir.js +37 -0
- package/dist/js/treeshaking/index.js +2 -1
- package/dist/js/treeshaking/is/type.js +4 -5
- package/dist/js/treeshaking/printBuildError.js +0 -1
- package/dist/types/constants.d.ts +25 -2
- package/dist/types/emptyDir.d.ts +1 -0
- package/dist/types/format.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/is/type.d.ts +3 -3
- package/jest.config.js +4 -0
- package/package.json +2 -2
- package/tests/index.test.ts +2 -0
- package/tests/isType.test.ts +85 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# @modern-js/utils
|
2
2
|
|
3
|
+
## 1.3.5
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 5bf5868d: fix: isObject should return false when input is null
|
8
|
+
|
9
|
+
## 1.3.4
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- db43dce6: expose plugin-unbundle configs
|
14
|
+
|
15
|
+
## 1.3.3
|
16
|
+
|
17
|
+
### Patch Changes
|
18
|
+
|
19
|
+
- 4c792f68: feat(plugin-garfish): Sub-applications automatically increment basename
|
20
|
+
feat(plugin-garfish): export common generate code function
|
21
|
+
fix(plugin-garfish): modify plugin-garfish schema config
|
22
|
+
- a7f42f48: new user config for plugin-unbundle
|
23
|
+
|
3
24
|
## 1.3.2
|
4
25
|
|
5
26
|
### Patch Changes
|
@@ -242,6 +242,28 @@ export const PLUGIN_SCHEMAS = {
|
|
242
242
|
schema: {
|
243
243
|
type: 'boolean'
|
244
244
|
}
|
245
|
+
}, {
|
246
|
+
target: 'dev.unbundle',
|
247
|
+
schema: {
|
248
|
+
type: 'object',
|
249
|
+
properties: {
|
250
|
+
ignore: {
|
251
|
+
type: ['string', 'array'],
|
252
|
+
items: {
|
253
|
+
type: 'string'
|
254
|
+
}
|
255
|
+
},
|
256
|
+
ignoreModuleCache: {
|
257
|
+
type: 'boolean'
|
258
|
+
},
|
259
|
+
clearPdnCache: {
|
260
|
+
type: 'boolean'
|
261
|
+
},
|
262
|
+
pdnHost: {
|
263
|
+
type: 'string'
|
264
|
+
}
|
265
|
+
}
|
266
|
+
}
|
245
267
|
}],
|
246
268
|
'@modern-js/plugin-ssg': [{
|
247
269
|
target: 'output.ssg',
|
@@ -299,13 +321,18 @@ export const PLUGIN_SCHEMAS = {
|
|
299
321
|
'@modern-js/plugin-garfish': [{
|
300
322
|
target: 'runtime.masterApp',
|
301
323
|
schema: {
|
302
|
-
type: ['object']
|
324
|
+
type: ['boolean', 'object']
|
303
325
|
}
|
304
326
|
}, {
|
305
327
|
target: 'dev.withMasterApp',
|
306
328
|
schema: {
|
307
329
|
type: ['object']
|
308
330
|
}
|
331
|
+
}, {
|
332
|
+
target: 'deploy.microFrontend',
|
333
|
+
schema: {
|
334
|
+
type: ['boolean', 'object']
|
335
|
+
}
|
309
336
|
}],
|
310
337
|
'@modern-js/plugin-nocode': []
|
311
338
|
};
|
package/dist/js/modern/index.js
CHANGED
@@ -5,18 +5,17 @@ export function isUndefined(obj) {
|
|
5
5
|
return typeof obj === 'undefined';
|
6
6
|
}
|
7
7
|
export function isArray(obj) {
|
8
|
-
return
|
8
|
+
return Array.isArray(obj);
|
9
9
|
} // eslint-disable-next-line @typescript-eslint/ban-types
|
10
10
|
|
11
11
|
export function isFunction(func) {
|
12
12
|
return typeof func === 'function';
|
13
|
-
}
|
14
|
-
|
13
|
+
}
|
15
14
|
export function isObject(obj) {
|
16
|
-
return typeof obj === 'object';
|
15
|
+
return obj !== null && typeof obj === 'object';
|
17
16
|
}
|
18
17
|
export function isPlainObject(obj) {
|
19
|
-
return obj &&
|
18
|
+
return isObject(obj) && Object.prototype.toString.call(obj) === '[object Object]';
|
20
19
|
}
|
21
20
|
export function isPromise(obj) {
|
22
21
|
/* eslint-disable promise/prefer-await-to-then */
|
@@ -261,6 +261,28 @@ const PLUGIN_SCHEMAS = {
|
|
261
261
|
schema: {
|
262
262
|
type: 'boolean'
|
263
263
|
}
|
264
|
+
}, {
|
265
|
+
target: 'dev.unbundle',
|
266
|
+
schema: {
|
267
|
+
type: 'object',
|
268
|
+
properties: {
|
269
|
+
ignore: {
|
270
|
+
type: ['string', 'array'],
|
271
|
+
items: {
|
272
|
+
type: 'string'
|
273
|
+
}
|
274
|
+
},
|
275
|
+
ignoreModuleCache: {
|
276
|
+
type: 'boolean'
|
277
|
+
},
|
278
|
+
clearPdnCache: {
|
279
|
+
type: 'boolean'
|
280
|
+
},
|
281
|
+
pdnHost: {
|
282
|
+
type: 'string'
|
283
|
+
}
|
284
|
+
}
|
285
|
+
}
|
264
286
|
}],
|
265
287
|
'@modern-js/plugin-ssg': [{
|
266
288
|
target: 'output.ssg',
|
@@ -318,13 +340,18 @@ const PLUGIN_SCHEMAS = {
|
|
318
340
|
'@modern-js/plugin-garfish': [{
|
319
341
|
target: 'runtime.masterApp',
|
320
342
|
schema: {
|
321
|
-
type: ['object']
|
343
|
+
type: ['boolean', 'object']
|
322
344
|
}
|
323
345
|
}, {
|
324
346
|
target: 'dev.withMasterApp',
|
325
347
|
schema: {
|
326
348
|
type: ['object']
|
327
349
|
}
|
350
|
+
}, {
|
351
|
+
target: 'deploy.microFrontend',
|
352
|
+
schema: {
|
353
|
+
type: ['boolean', 'object']
|
354
|
+
}
|
328
355
|
}],
|
329
356
|
'@modern-js/plugin-nocode': []
|
330
357
|
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.emptyDir = void 0;
|
7
|
+
|
8
|
+
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
9
|
+
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
|
12
|
+
const emptyDir = async dir => {
|
13
|
+
if (await _fsExtra.default.pathExists(dir)) {
|
14
|
+
await _fsExtra.default.emptyDir(dir);
|
15
|
+
}
|
16
|
+
};
|
17
|
+
|
18
|
+
exports.emptyDir = emptyDir;
|
package/dist/js/node/index.js
CHANGED
@@ -446,6 +446,20 @@ Object.keys(_wait).forEach(function (key) {
|
|
446
446
|
});
|
447
447
|
});
|
448
448
|
|
449
|
+
var _emptyDir = require("./emptyDir");
|
450
|
+
|
451
|
+
Object.keys(_emptyDir).forEach(function (key) {
|
452
|
+
if (key === "default" || key === "__esModule") return;
|
453
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
454
|
+
if (key in exports && exports[key] === _emptyDir[key]) return;
|
455
|
+
Object.defineProperty(exports, key, {
|
456
|
+
enumerable: true,
|
457
|
+
get: function () {
|
458
|
+
return _emptyDir[key];
|
459
|
+
}
|
460
|
+
});
|
461
|
+
});
|
462
|
+
|
449
463
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
450
464
|
|
451
465
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
package/dist/js/node/is/type.js
CHANGED
@@ -21,21 +21,20 @@ function isUndefined(obj) {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
function isArray(obj) {
|
24
|
-
return
|
24
|
+
return Array.isArray(obj);
|
25
25
|
} // eslint-disable-next-line @typescript-eslint/ban-types
|
26
26
|
|
27
27
|
|
28
28
|
function isFunction(func) {
|
29
29
|
return typeof func === 'function';
|
30
|
-
}
|
31
|
-
|
30
|
+
}
|
32
31
|
|
33
32
|
function isObject(obj) {
|
34
|
-
return typeof obj === 'object';
|
33
|
+
return obj !== null && typeof obj === 'object';
|
35
34
|
}
|
36
35
|
|
37
36
|
function isPlainObject(obj) {
|
38
|
-
return obj &&
|
37
|
+
return isObject(obj) && Object.prototype.toString.call(obj) === '[object Object]';
|
39
38
|
}
|
40
39
|
|
41
40
|
function isPromise(obj) {
|
@@ -242,6 +242,28 @@ export var PLUGIN_SCHEMAS = {
|
|
242
242
|
schema: {
|
243
243
|
type: 'boolean'
|
244
244
|
}
|
245
|
+
}, {
|
246
|
+
target: 'dev.unbundle',
|
247
|
+
schema: {
|
248
|
+
type: 'object',
|
249
|
+
properties: {
|
250
|
+
ignore: {
|
251
|
+
type: ['string', 'array'],
|
252
|
+
items: {
|
253
|
+
type: 'string'
|
254
|
+
}
|
255
|
+
},
|
256
|
+
ignoreModuleCache: {
|
257
|
+
type: 'boolean'
|
258
|
+
},
|
259
|
+
clearPdnCache: {
|
260
|
+
type: 'boolean'
|
261
|
+
},
|
262
|
+
pdnHost: {
|
263
|
+
type: 'string'
|
264
|
+
}
|
265
|
+
}
|
266
|
+
}
|
245
267
|
}],
|
246
268
|
'@modern-js/plugin-ssg': [{
|
247
269
|
target: 'output.ssg',
|
@@ -299,13 +321,18 @@ export var PLUGIN_SCHEMAS = {
|
|
299
321
|
'@modern-js/plugin-garfish': [{
|
300
322
|
target: 'runtime.masterApp',
|
301
323
|
schema: {
|
302
|
-
type: ['object']
|
324
|
+
type: ['boolean', 'object']
|
303
325
|
}
|
304
326
|
}, {
|
305
327
|
target: 'dev.withMasterApp',
|
306
328
|
schema: {
|
307
329
|
type: ['object']
|
308
330
|
}
|
331
|
+
}, {
|
332
|
+
target: 'deploy.microFrontend',
|
333
|
+
schema: {
|
334
|
+
type: ['boolean', 'object']
|
335
|
+
}
|
309
336
|
}],
|
310
337
|
'@modern-js/plugin-nocode': []
|
311
338
|
};
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
2
|
+
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
4
|
+
|
5
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
6
|
+
|
7
|
+
import fs from 'fs-extra';
|
8
|
+
export var emptyDir = /*#__PURE__*/function () {
|
9
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(dir) {
|
10
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
11
|
+
while (1) {
|
12
|
+
switch (_context.prev = _context.next) {
|
13
|
+
case 0:
|
14
|
+
_context.next = 2;
|
15
|
+
return fs.pathExists(dir);
|
16
|
+
|
17
|
+
case 2:
|
18
|
+
if (!_context.sent) {
|
19
|
+
_context.next = 5;
|
20
|
+
break;
|
21
|
+
}
|
22
|
+
|
23
|
+
_context.next = 5;
|
24
|
+
return fs.emptyDir(dir);
|
25
|
+
|
26
|
+
case 5:
|
27
|
+
case "end":
|
28
|
+
return _context.stop();
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}, _callee);
|
32
|
+
}));
|
33
|
+
|
34
|
+
return function emptyDir(_x) {
|
35
|
+
return _ref.apply(this, arguments);
|
36
|
+
};
|
37
|
+
}();
|
@@ -7,18 +7,17 @@ export function isUndefined(obj) {
|
|
7
7
|
return typeof obj === 'undefined';
|
8
8
|
}
|
9
9
|
export function isArray(obj) {
|
10
|
-
return
|
10
|
+
return Array.isArray(obj);
|
11
11
|
} // eslint-disable-next-line @typescript-eslint/ban-types
|
12
12
|
|
13
13
|
export function isFunction(func) {
|
14
14
|
return typeof func === 'function';
|
15
|
-
}
|
16
|
-
|
15
|
+
}
|
17
16
|
export function isObject(obj) {
|
18
|
-
return _typeof(obj) === 'object';
|
17
|
+
return obj !== null && _typeof(obj) === 'object';
|
19
18
|
}
|
20
19
|
export function isPlainObject(obj) {
|
21
|
-
return
|
20
|
+
return isObject(obj) && Object.prototype.toString.call(obj) === '[object Object]';
|
22
21
|
}
|
23
22
|
export function isPromise(obj) {
|
24
23
|
/* eslint-disable promise/prefer-await-to-then */
|
@@ -131,12 +131,35 @@ export declare const PLUGIN_SCHEMAS: {
|
|
131
131
|
typeof: string[];
|
132
132
|
};
|
133
133
|
}[];
|
134
|
-
'@modern-js/plugin-unbundle': {
|
134
|
+
'@modern-js/plugin-unbundle': ({
|
135
135
|
target: string;
|
136
136
|
schema: {
|
137
137
|
type: string;
|
138
|
+
properties?: undefined;
|
138
139
|
};
|
139
|
-
}
|
140
|
+
} | {
|
141
|
+
target: string;
|
142
|
+
schema: {
|
143
|
+
type: string;
|
144
|
+
properties: {
|
145
|
+
ignore: {
|
146
|
+
type: string[];
|
147
|
+
items: {
|
148
|
+
type: string;
|
149
|
+
};
|
150
|
+
};
|
151
|
+
ignoreModuleCache: {
|
152
|
+
type: string;
|
153
|
+
};
|
154
|
+
clearPdnCache: {
|
155
|
+
type: string;
|
156
|
+
};
|
157
|
+
pdnHost: {
|
158
|
+
type: string;
|
159
|
+
};
|
160
|
+
};
|
161
|
+
};
|
162
|
+
})[];
|
140
163
|
'@modern-js/plugin-ssg': {
|
141
164
|
target: string;
|
142
165
|
schema: {
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const emptyDir: (dir: string) => Promise<void>;
|
package/dist/types/format.d.ts
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* https://github.com/facebook/create-react-app/blob/master/LICENSE
|
7
7
|
*/
|
8
8
|
import { StatsCompilation } from 'webpack';
|
9
|
-
import { ProxyDetail, ProxyOptions } from '@modern-js/types';
|
9
|
+
import type { ProxyDetail, ProxyOptions } from '@modern-js/types';
|
10
10
|
declare function formatWebpackMessages(json: StatsCompilation): {
|
11
11
|
errors: string[];
|
12
12
|
warnings: string[];
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/is/type.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
export declare function isString(str: any): str is string;
|
2
2
|
export declare function isUndefined(obj: any): obj is undefined;
|
3
|
-
export declare function isArray(obj:
|
3
|
+
export declare function isArray(obj: unknown): obj is any[];
|
4
4
|
export declare function isFunction(func: any): func is Function;
|
5
|
-
export declare function isObject(obj:
|
6
|
-
export declare function isPlainObject(obj:
|
5
|
+
export declare function isObject(obj: unknown): obj is Record<string, any>;
|
6
|
+
export declare function isPlainObject(obj: unknown): obj is Record<string, any>;
|
7
7
|
export declare function isPromise(obj: any): obj is Promise<any>;
|
8
8
|
export declare function isRegExp(obj: any): obj is RegExp;
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "1.3.
|
14
|
+
"version": "1.3.5",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -76,7 +76,7 @@
|
|
76
76
|
"@scripts/build": "0.0.0",
|
77
77
|
"jest": "^27",
|
78
78
|
"@scripts/jest-config": "0.0.0",
|
79
|
-
"@modern-js/types": "^1.3.
|
79
|
+
"@modern-js/types": "^1.3.5"
|
80
80
|
},
|
81
81
|
"sideEffects": false,
|
82
82
|
"publishConfig": {
|
package/tests/index.test.ts
CHANGED
@@ -0,0 +1,85 @@
|
|
1
|
+
import {
|
2
|
+
isArray,
|
3
|
+
isObject,
|
4
|
+
isString,
|
5
|
+
isRegExp,
|
6
|
+
isPromise,
|
7
|
+
isUndefined,
|
8
|
+
isPlainObject,
|
9
|
+
} from '../src/is/type';
|
10
|
+
|
11
|
+
describe('validate type', () => {
|
12
|
+
it('should validate string correctly', () => {
|
13
|
+
expect(isString('')).toBeTruthy();
|
14
|
+
expect(isString('foo')).toBeTruthy();
|
15
|
+
expect(isString(null)).toBeFalsy();
|
16
|
+
expect(isString(123)).toBeFalsy();
|
17
|
+
});
|
18
|
+
|
19
|
+
it('should validate undefined correctly', () => {
|
20
|
+
expect(isUndefined(undefined)).toBeTruthy();
|
21
|
+
expect(isUndefined(null)).toBeFalsy();
|
22
|
+
expect(isUndefined('')).toBeFalsy();
|
23
|
+
expect(isUndefined(123)).toBeFalsy();
|
24
|
+
});
|
25
|
+
|
26
|
+
it('should validate array correctly', () => {
|
27
|
+
expect(isArray(undefined)).toBeFalsy();
|
28
|
+
expect(isArray(null)).toBeFalsy();
|
29
|
+
expect(isArray('')).toBeFalsy();
|
30
|
+
expect(isArray(123)).toBeFalsy();
|
31
|
+
expect(isArray({})).toBeFalsy();
|
32
|
+
expect(isArray([])).toBeTruthy();
|
33
|
+
});
|
34
|
+
|
35
|
+
it('should validate object correctly', () => {
|
36
|
+
expect(isObject(1)).toBeFalsy();
|
37
|
+
expect(isObject('1')).toBeFalsy();
|
38
|
+
expect(isObject(undefined)).toBeFalsy();
|
39
|
+
expect(isObject(null)).toBeFalsy();
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
41
|
+
expect(isObject(() => {})).toBeFalsy();
|
42
|
+
expect(isObject({})).toBeTruthy();
|
43
|
+
expect(isObject([])).toBeTruthy();
|
44
|
+
expect(isObject(/foo/)).toBeTruthy();
|
45
|
+
});
|
46
|
+
|
47
|
+
it('should validate plain object correctly', () => {
|
48
|
+
expect(isPlainObject(1)).toBeFalsy();
|
49
|
+
expect(isPlainObject('1')).toBeFalsy();
|
50
|
+
expect(isPlainObject(undefined)).toBeFalsy();
|
51
|
+
expect(isPlainObject(null)).toBeFalsy();
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
53
|
+
expect(isPlainObject(() => {})).toBeFalsy();
|
54
|
+
expect(isPlainObject({})).toBeTruthy();
|
55
|
+
expect(isPlainObject([])).toBeFalsy();
|
56
|
+
expect(isPlainObject(/foo/)).toBeFalsy();
|
57
|
+
});
|
58
|
+
|
59
|
+
it('should validate RegExp correctly', () => {
|
60
|
+
expect(isRegExp(1)).toBeFalsy();
|
61
|
+
expect(isRegExp('1')).toBeFalsy();
|
62
|
+
expect(isRegExp(undefined)).toBeFalsy();
|
63
|
+
expect(isRegExp(null)).toBeFalsy();
|
64
|
+
expect(isRegExp({})).toBeFalsy();
|
65
|
+
expect(isRegExp([])).toBeFalsy();
|
66
|
+
expect(isRegExp(/foo/)).toBeTruthy();
|
67
|
+
});
|
68
|
+
|
69
|
+
it('should validate Promise correctly', () => {
|
70
|
+
expect(isPromise(1)).toBeFalsy();
|
71
|
+
expect(isPromise('1')).toBeFalsy();
|
72
|
+
expect(isPromise(undefined)).toBeFalsy();
|
73
|
+
expect(isPromise(null)).toBeFalsy();
|
74
|
+
expect(isPromise({})).toBeFalsy();
|
75
|
+
expect(isPromise([])).toBeFalsy();
|
76
|
+
expect(isPromise(/foo/)).toBeFalsy();
|
77
|
+
expect(
|
78
|
+
isPromise(
|
79
|
+
new Promise<void>(resolve => {
|
80
|
+
resolve();
|
81
|
+
}),
|
82
|
+
),
|
83
|
+
).toBeTruthy();
|
84
|
+
});
|
85
|
+
});
|