a-js-tools 0.5.2 → 0.5.4-beta.0
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/cjs/src/isNode.cjs +1 -3
- package/mjs/src/isNode.mjs +1 -3
- package/package.json +1 -1
- package/types/index.d.ts +1 -0
- package/types/src/createConstructor.d.ts +6 -2
package/cjs/src/isNode.cjs
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var aTypeOfJs = require('a-type-of-js');
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
*
|
|
7
5
|
* 判断当前环境是否为 node 环境
|
|
8
6
|
*
|
|
9
7
|
*/
|
|
10
8
|
function isNode() {
|
|
11
|
-
return
|
|
9
|
+
return (typeof window === 'undefined' || typeof window.document === 'undefined');
|
|
12
10
|
}
|
|
13
11
|
/**
|
|
14
12
|
*
|
package/mjs/src/isNode.mjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { isUndefined } from 'a-type-of-js';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
*
|
|
5
3
|
* 判断当前环境是否为 node 环境
|
|
6
4
|
*
|
|
7
5
|
*/
|
|
8
6
|
function isNode() {
|
|
9
|
-
return
|
|
7
|
+
return (typeof window === 'undefined' || typeof window.document === 'undefined');
|
|
10
8
|
}
|
|
11
9
|
/**
|
|
12
10
|
*
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export type { DebounceAndThrottleReturnType } from './src/performance';
|
|
|
4
4
|
export { escapeRegExp, autoEscapedRegExp } from './src/regexp';
|
|
5
5
|
export { isBrowser, isNode } from './src/isNode';
|
|
6
6
|
export { createConstructor } from './src/createConstructor';
|
|
7
|
+
export type { CreateConstructor } from './src/createConstructor';
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* 构建构建的构建函数
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export interface CreateConstructor<T, Args extends unknown[] = unknown[]> {
|
|
2
7
|
new (...args: Args): T;
|
|
3
8
|
}
|
|
4
9
|
/**
|
|
@@ -7,4 +12,3 @@ interface CreateConstructor<T, Args extends unknown[] = unknown[]> {
|
|
|
7
12
|
*
|
|
8
13
|
*/
|
|
9
14
|
export declare function createConstructor<T, Args extends unknown[] = unknown[]>(constructor: (...argumentList: Args) => T): CreateConstructor<T, Args>;
|
|
10
|
-
export {};
|