use-mask-input 3.10.0 → 3.10.2
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 +17 -1
- package/dist/antd.cjs +1 -65
- package/dist/antd.cjs.map +1 -1
- package/dist/antd.d.cts +12 -10
- package/dist/{antd.d.ts → antd.d.mts} +12 -10
- package/dist/antd.mjs +2 -0
- package/dist/antd.mjs.map +1 -0
- package/dist/index-BmKzoe0X.d.cts +836 -0
- package/dist/index-BmKzoe0X.d.mts +836 -0
- package/dist/index.cjs +1 -173
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -15
- package/dist/{index.d.ts → index.d.mts} +18 -15
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/withMask-VWeBqi_u.cjs +2 -0
- package/dist/withMask-VWeBqi_u.cjs.map +1 -0
- package/dist/withMask-jrErtLYS.mjs +2 -0
- package/dist/withMask-jrErtLYS.mjs.map +1 -0
- package/package.json +42 -22
- package/src/api/withMask.ts +1 -1
- package/src/core/inputmask.ts +10 -0
- package/src/core/maskEngine.ts +2 -2
- package/src/utils/maskHelpers.ts +5 -3
- package/dist/antd.js +0 -63
- package/dist/antd.js.map +0 -1
- package/dist/chunk-DTC7JTZP.cjs +0 -3925
- package/dist/chunk-DTC7JTZP.cjs.map +0 -1
- package/dist/chunk-TVCNC3TP.js +0 -3915
- package/dist/chunk-TVCNC3TP.js.map +0 -1
- package/dist/index-D8KkaDbQ.d.cts +0 -596
- package/dist/index-D8KkaDbQ.d.ts +0 -596
- package/dist/index.js +0 -165
- package/dist/index.js.map +0 -1
- package/src/antd/useHookFormMaskAntd.spec.ts +0 -181
- package/src/antd/useMaskInputAntd-server.spec.tsx +0 -37
- package/src/antd/useMaskInputAntd.spec.tsx +0 -131
- package/src/api/useHookFormMask.spec.ts +0 -259
- package/src/api/useMaskInput-server.spec.tsx +0 -30
- package/src/api/useMaskInput.spec.tsx +0 -238
- package/src/api/withHookFormMask.spec.ts +0 -179
- package/src/api/withMask.spec.ts +0 -137
- package/src/api/withTanStackFormMask.spec.ts +0 -76
- package/src/core/elementResolver.spec.ts +0 -175
- package/src/core/maskConfig.spec.ts +0 -208
- package/src/core/maskEngine.spec.ts +0 -114
- package/src/utils/flow.spec.ts +0 -57
- package/src/utils/isServer.spec.ts +0 -15
- package/src/utils/moduleInterop.spec.ts +0 -37
package/src/utils/flow.spec.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe, expect, it,
|
|
3
|
-
} from 'vitest';
|
|
4
|
-
|
|
5
|
-
import flow from './flow';
|
|
6
|
-
|
|
7
|
-
describe('flow', () => {
|
|
8
|
-
it('returns a function', () => {
|
|
9
|
-
const result = flow();
|
|
10
|
-
expect(typeof result).toBe('function');
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('returns undefined value if no return function provided', () => {
|
|
14
|
-
const result = flow(() => { });
|
|
15
|
-
expect(result(42)).toBe(undefined);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('throws an error if any argument is not a function', () => {
|
|
19
|
-
// @ts-expect-error - null is not a function
|
|
20
|
-
expect(() => flow(null)).toThrow(TypeError);
|
|
21
|
-
// @ts-expect-error - null is not a function
|
|
22
|
-
expect(() => flow(() => { }, null)).toThrow(TypeError);
|
|
23
|
-
expect(() => {
|
|
24
|
-
flow(1 as unknown as () => void, () => { });
|
|
25
|
-
}).toThrow(TypeError);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('returns the original value if no functions are provided', () => {
|
|
29
|
-
const result = flow();
|
|
30
|
-
expect(result(42)).toBe(42);
|
|
31
|
-
expect(result('test')).toBe('test');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('composes functions correctly', () => {
|
|
35
|
-
const addOne = (x: number) => x + 1;
|
|
36
|
-
const multiplyByTwo = (x: number) => x * 2;
|
|
37
|
-
const subtractThree = (x: number) => x - 3;
|
|
38
|
-
|
|
39
|
-
const composed = flow(addOne, multiplyByTwo, subtractThree);
|
|
40
|
-
expect(composed(5)).toBe(9); // (5 + 1) * 2 - 3 = 9
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('works with single function', () => {
|
|
44
|
-
const double = (x: number) => x * 2;
|
|
45
|
-
const fn = flow(double);
|
|
46
|
-
expect(fn(5)).toBe(10);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('works with multiple functions', () => {
|
|
50
|
-
const fn1 = (n: number) => n + 1;
|
|
51
|
-
const fn2 = (n: number) => n * 2;
|
|
52
|
-
const fn3 = (n: number) => n - 1;
|
|
53
|
-
|
|
54
|
-
const composed = flow(fn1, fn2, fn3);
|
|
55
|
-
expect(composed(5)).toBe(11); // ((5 + 1) * 2) - 1 = 11
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
|
|
3
|
-
describe('isServer', () => {
|
|
4
|
-
it('returns boolean value', async () => {
|
|
5
|
-
const { default: isServer } = await import('./isServer');
|
|
6
|
-
expect(typeof isServer).toBe('boolean');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it('returns false in browser environment', async () => {
|
|
10
|
-
// in jsdom environment, window and document exist
|
|
11
|
-
const { default: isServer } = await import('./isServer');
|
|
12
|
-
// in test environment with jsdom, it should be false
|
|
13
|
-
expect(isServer).toBe(false);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import interopDefaultSync from './moduleInterop';
|
|
4
|
-
|
|
5
|
-
describe('interopDefaultSync', () => {
|
|
6
|
-
it('returns module with default export', () => {
|
|
7
|
-
const module = { default: 'test' };
|
|
8
|
-
expect(interopDefaultSync(module)).toBe('test');
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('returns module without default export', () => {
|
|
12
|
-
const module = { foo: 'bar' };
|
|
13
|
-
expect(interopDefaultSync(module)).toBe(module);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('returns non-object values as-is', () => {
|
|
17
|
-
expect(interopDefaultSync('string')).toBe('string');
|
|
18
|
-
expect(interopDefaultSync(123)).toBe(123);
|
|
19
|
-
expect(interopDefaultSync(null)).toBe(null);
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
21
|
-
expect(interopDefaultSync(undefined)).toBe(undefined);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('handles null module', () => {
|
|
25
|
-
expect(interopDefaultSync(null)).toBe(null);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('handles module with null default', () => {
|
|
29
|
-
const module = { default: null };
|
|
30
|
-
expect(interopDefaultSync(module)).toBe(null);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('handles module with undefined default', () => {
|
|
34
|
-
const module = { default: undefined };
|
|
35
|
-
expect(interopDefaultSync(module)).toBe(undefined);
|
|
36
|
-
});
|
|
37
|
-
});
|