@formily-design/shared 1.0.0 → 1.0.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.
package/src/types.ts DELETED
@@ -1,27 +0,0 @@
1
- const isType =
2
- <T>(type: string | string[]) =>
3
- (obj: unknown): obj is T =>
4
- obj != null &&
5
- (Array.isArray(type) ? type : [type]).some(
6
- (t) => getType(obj) === `[object ${t}]`
7
- )
8
- export const getType = (obj: any) => Object.prototype.toString.call(obj)
9
- export const isFn = isType<(...args: any[]) => any>([
10
- 'Function',
11
- 'AsyncFunction',
12
- 'GeneratorFunction',
13
- ])
14
- export const isWindow = isType<Window>('Window')
15
- export const isHTMLElement = (obj: any): obj is HTMLElement => {
16
- return obj?.['nodeName'] || obj?.['tagName']
17
- }
18
- export const isArr = Array.isArray
19
- export const isPlainObj = isType<object>('Object')
20
- export const isStr = isType<string>('String')
21
- export const isBool = isType<boolean>('Boolean')
22
- export const isNum = isType<number>('Number')
23
- export const isObj = (val: unknown): val is object => typeof val === 'object'
24
- export const isRegExp = isType<RegExp>('RegExp')
25
- export const isValid = (val: any) => val !== null && val !== undefined
26
- export const isValidNumber = (val: any): val is number =>
27
- !isNaN(val) && isNum(val)
package/src/uid.ts DELETED
@@ -1,10 +0,0 @@
1
- let IDX = 36,
2
- HEX = ''
3
- while (IDX--) HEX += IDX.toString(36)
4
-
5
- export function uid(len?: number) {
6
- let str = '',
7
- num = len || 11
8
- while (num--) str += HEX[(Math.random() * 36) | 0]
9
- return str
10
- }
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./lib",
5
- "paths": {
6
- "@formily-design/*": ["../*"]
7
- },
8
- "declaration": true
9
- }
10
- }
package/tsconfig.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "include": ["./src/**/*.ts", "./src/**/*.tsx"],
4
- "exclude": ["./src/__tests__/*", "./esm/*", "./lib/*"]
5
- }