@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 CHANGED
@@ -1 +1 @@
1
- 通用数据格式验证模块,支持自动类型推理
1
+ 数据验证、格式化工具,支持自动类型推理
package/dist/array.js CHANGED
@@ -1,4 +1,4 @@
1
- import { success, failure } from '@stdex/utils/result.js';
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
@@ -1,4 +1,4 @@
1
- import { type Result } from '@stdex/utils/result.js';
1
+ import { type Result } from '@stdex/utils';
2
2
  /**
3
3
  * 支持传入进行验证的值类型
4
4
  */
package/dist/base.js CHANGED
@@ -1,4 +1,4 @@
1
- import { success, failure } from '@stdex/utils/result.js';
1
+ import { success, failure } from '@stdex/utils';
2
2
  // -----------------------------------
3
3
  /**
4
4
  * 返回支持指定格式的 options、并按照传入的逻辑进行验证的 validator 的生成器。
package/dist/boolean.js CHANGED
@@ -1,4 +1,4 @@
1
- import { success, failure } from '@stdex/utils/result.js';
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/result.js';
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/result.js';
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
@@ -1,4 +1,4 @@
1
- import { success, failure } from '@stdex/utils/result.js';
1
+ import { success, failure } from '@stdex/utils';
2
2
  import isPlainObject from 'lodash/isPlainObject.js';
3
3
  import { getValidatorGenerator, } from './base.js';
4
4
  export function getStructValidator(options) {
package/dist/one-of.js CHANGED
@@ -1,4 +1,4 @@
1
- import { failure } from '@stdex/utils/result.js';
1
+ import { failure } from '@stdex/utils';
2
2
  import { getValidatorGenerator, } from './base.js';
3
3
  export function getOneOfValidator(options = {}) {
4
4
  return getValidatorGenerator(function validate(field, value) {
package/dist/string.js CHANGED
@@ -1,4 +1,4 @@
1
- import { success, failure } from '@stdex/utils/result.js';
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.0.0",
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-validator/issues",
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-validator.git"
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": "^1.0.2",
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": "^1.0.2",
34
- "@stdex/presets-prettier": "^1.0.2",
35
- "@stdex/presets-typescript": "^1.0.2",
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
@@ -1,4 +1,4 @@
1
- import { success, failure } from '@stdex/utils/result.js'
1
+ import { success, failure } from '@stdex/utils'
2
2
  import {
3
3
  getValidatorGenerator,
4
4
  type CommonOptions,
package/src/base.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { success, failure, type Result } from '@stdex/utils/result.js'
1
+ import { success, failure, type Result } from '@stdex/utils'
2
2
 
3
3
  /**
4
4
  * 支持传入进行验证的值类型
package/src/boolean.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { success, failure } from '@stdex/utils/result.js'
1
+ import { success, failure } from '@stdex/utils'
2
2
  import { getValidatorGenerator, type CommonOptions } from './base.js'
3
3
 
4
4
  export type BooleanOptions = CommonOptions<boolean>
package/src/datetime.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 验证日期时间类型的值,依赖 dayjs
3
3
  */
4
- import { success, failure } from '@stdex/utils/result.js'
4
+ import { success, failure } from '@stdex/utils'
5
5
  import dayjs, { type Dayjs } from 'dayjs'
6
6
  import { getValidatorGenerator, type CommonOptions } from './base.js'
7
7
 
package/src/number.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { success, failure } from '@stdex/utils/result.js'
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
@@ -1,4 +1,4 @@
1
- import { success, failure } from '@stdex/utils/result.js'
1
+ import { success, failure } from '@stdex/utils'
2
2
  import isPlainObject from 'lodash/isPlainObject.js'
3
3
  import {
4
4
  getValidatorGenerator,
package/src/one-of.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { failure, type Result } from '@stdex/utils/result.js'
1
+ import { failure, type Result } from '@stdex/utils'
2
2
  import {
3
3
  getValidatorGenerator,
4
4
  type CommonOptions,
package/src/string.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { success, failure } from '@stdex/utils/result.js'
1
+ import { success, failure } from '@stdex/utils'
2
2
  import { getValidatorGenerator, type CommonOptions } from './base.js'
3
3
 
4
4
  export interface StringOptions extends CommonOptions<string> {