@stdex/validator 1.0.0 → 1.2.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/README.md +1 -1
- package/dist/array.js +1 -1
- package/dist/base.d.ts +1 -1
- package/dist/base.js +1 -1
- package/dist/boolean.js +1 -1
- package/dist/datetime.js +1 -1
- package/dist/number.js +1 -2
- package/dist/object.js +1 -1
- package/dist/one-of.js +1 -1
- package/dist/string.js +1 -1
- package/package.json +9 -9
- package/src/array.ts +1 -1
- package/src/base.ts +1 -1
- package/src/boolean.ts +1 -1
- package/src/datetime.ts +1 -1
- package/src/number.ts +1 -2
- package/src/object.ts +1 -1
- package/src/one-of.ts +1 -1
- package/src/string.ts +1 -1
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
数据验证、格式化工具,支持自动类型推理
|
package/dist/array.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { success, failure } from '@stdex/utils
|
|
1
|
+
import { success, failure } from '@stdex/utils';
|
|
2
2
|
import { getValidatorGenerator, } from './base.js';
|
|
3
3
|
export function getArrayValidator(options) {
|
|
4
4
|
return getValidatorGenerator(function validate(field, value, options) {
|
package/dist/base.d.ts
CHANGED
package/dist/base.js
CHANGED
package/dist/boolean.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { success, failure } from '@stdex/utils
|
|
1
|
+
import { success, failure } from '@stdex/utils';
|
|
2
2
|
import { getValidatorGenerator } from './base.js';
|
|
3
3
|
export const getBooleanValidator = getValidatorGenerator(function validate(field, input) {
|
|
4
4
|
let value = null;
|
package/dist/datetime.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 验证日期时间类型的值,依赖 dayjs
|
|
3
3
|
*/
|
|
4
|
-
import { success, failure } from '@stdex/utils
|
|
4
|
+
import { success, failure } from '@stdex/utils';
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
6
|
import { getValidatorGenerator } from './base.js';
|
|
7
7
|
export function getDatetimeValidator(options = {}) {
|
package/dist/number.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { success, failure } from '@stdex/utils
|
|
2
|
-
import { truthy } from '@stdex/utils/types.js';
|
|
1
|
+
import { success, failure, truthy } from '@stdex/utils';
|
|
3
2
|
import { getValidatorGenerator } from './base.js';
|
|
4
3
|
export function getNumberValidator(options = {}) {
|
|
5
4
|
return getValidatorGenerator(function validate(field, value) {
|
package/dist/object.js
CHANGED
package/dist/one-of.js
CHANGED
package/dist/string.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { success, failure } from '@stdex/utils
|
|
1
|
+
import { success, failure } from '@stdex/utils';
|
|
2
2
|
import { getValidatorGenerator } from './base.js';
|
|
3
3
|
export function getStringValidator(options = {}) {
|
|
4
4
|
return getValidatorGenerator(function validate(field, value) {
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdex/validator",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
5
|
-
"homepage": "https://github.com/anjianshi/stdex-validator",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "数据验证、格式化工具,支持自动类型推理",
|
|
5
|
+
"homepage": "https://github.com/anjianshi/stdex-packages/validator",
|
|
6
6
|
"bugs": {
|
|
7
|
-
"url": "https://github.com/anjianshi/stdex-
|
|
7
|
+
"url": "https://github.com/anjianshi/stdex-packages/issues",
|
|
8
8
|
"email": "anjianshi@gmail.com"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"author": "anjianshi <anjianshi@gmail.com>",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/anjianshi/stdex-
|
|
14
|
+
"url": "git+https://github.com/anjianshi/stdex-packages.git"
|
|
15
15
|
},
|
|
16
16
|
"publishConfig": {
|
|
17
17
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"dist/"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@stdex/utils": "
|
|
28
|
+
"@stdex/utils": "1.2.0",
|
|
29
29
|
"dayjs": "^1.11.23",
|
|
30
30
|
"lodash": "^4.18.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@stdex/presets-eslint-typescript": "
|
|
34
|
-
"@stdex/presets-prettier": "
|
|
35
|
-
"@stdex/presets-typescript": "
|
|
33
|
+
"@stdex/presets-eslint-typescript": "1.2.0",
|
|
34
|
+
"@stdex/presets-prettier": "1.2.0",
|
|
35
|
+
"@stdex/presets-typescript": "1.2.0",
|
|
36
36
|
"@types/lodash": "^4.17.27",
|
|
37
37
|
"eslint": "^10.6.0",
|
|
38
38
|
"typescript": "^6.0.3"
|
package/src/array.ts
CHANGED
package/src/base.ts
CHANGED
package/src/boolean.ts
CHANGED
package/src/datetime.ts
CHANGED
package/src/number.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { success, failure } from '@stdex/utils
|
|
2
|
-
import { truthy } from '@stdex/utils/types.js'
|
|
1
|
+
import { success, failure, truthy } from '@stdex/utils'
|
|
3
2
|
import { getValidatorGenerator, type CommonOptions } from './base.js'
|
|
4
3
|
|
|
5
4
|
export interface NumberOptions extends CommonOptions<number> {
|
package/src/object.ts
CHANGED
package/src/one-of.ts
CHANGED
package/src/string.ts
CHANGED