xyvcard-wechat-auth 0.0.3 → 0.0.4

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/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { config } from "./utils/config";
3
3
  export { auth } from "./utils/auth";
4
4
  export { db } from "./utils/db";
5
5
  export type { BaseConfig } from "./utils/config";
6
- export { validateRequired } from "./utils/common";
6
+ export { validateRequired, validateRules, formatDateTime, kbToMb, convertToISOString, getHeight } from "./utils/common";
7
7
  export type { RequestData, ResponseData, RequestHeader } from "./api/types";
8
8
  export { Dict } from "./api/index";
9
9
  export { EntryDict, EnumDict } from "./api/dicts";
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { clearEmpty, request, sendRequest } from "./utils/request.js";
2
2
  import { config } from "./utils/config.js";
3
3
  import { auth } from "./utils/auth.js";
4
4
  import { db } from "./utils/db.js";
5
- import { validateRequired } from "./utils/common.js";
5
+ import { convertToISOString, formatDateTime, getHeight, kbToMb, validateRequired, validateRules } from "./utils/common.js";
6
6
  import { Dict } from "./api/index.js";
7
7
  import { EntryDict, EnumDict } from "./api/dicts.js";
8
8
  import { authApi } from "./api/auth/index.js";
@@ -16,10 +16,15 @@ export {
16
16
  authApi,
17
17
  clearEmpty,
18
18
  config,
19
+ convertToISOString,
19
20
  db,
20
21
  dictApi,
21
22
  fileApi,
23
+ formatDateTime,
24
+ getHeight,
25
+ kbToMb,
22
26
  request,
23
27
  sendRequest,
24
- validateRequired
28
+ validateRequired,
29
+ validateRules
25
30
  };
@@ -4,26 +4,26 @@
4
4
  * @param {string} message 错误提示信息
5
5
  * @param {string} rules 正则校验规则
6
6
  */
7
- export declare function validateRules(value: string, message: string, rules: any): boolean;
7
+ export declare const validateRules: (value: string, message: string, rules: any) => boolean;
8
8
  /**
9
9
  * 校验必填项
10
10
  * @param {string} value 需要校验的值
11
11
  * @param {string} message 错误提示信息
12
12
  */
13
- export declare function validateRequired(value: string, message: string): boolean;
13
+ export declare const validateRequired: (value: string, message: string) => boolean;
14
14
  /**
15
15
  * 格式化日期时间字符串
16
16
  * @param dateTimeString 日期时间字符串
17
17
  * @returns 格式化后的日期时间字符串
18
18
  */
19
19
  export declare const formatDateTime: (dateTimeString: string, format?: any) => string;
20
- export declare function kbToMb(kb: number, decimalPlaces?: number): number;
20
+ export declare const kbToMb: (kb: number, decimalPlaces?: number) => number;
21
21
  /**
22
22
  * 将日期字符串转换为标准 ISO 8601 格式字符串
23
23
  * @param dateString - 可被 Date 构造函数解析的日期字符串
24
24
  * @returns 返回 ISO 格式字符串 (如 "2023-01-01T00:00:00.000Z")
25
25
  */
26
- export declare function convertToISOString(dateString: string): string;
26
+ export declare const convertToISOString: (dateString: string) => string;
27
27
  export declare const getHeight: () => {
28
28
  navigationPaddingHeight: number;
29
29
  topHeight: number;
@@ -1,4 +1,4 @@
1
- function validateRules(value, message, rules) {
1
+ const validateRules = (value, message, rules) => {
2
2
  if (value && !rules.test(value)) {
3
3
  wx.showToast({
4
4
  title: message,
@@ -8,8 +8,8 @@ function validateRules(value, message, rules) {
8
8
  return false;
9
9
  }
10
10
  return true;
11
- }
12
- function validateRequired(value, message) {
11
+ };
12
+ const validateRequired = (value, message) => {
13
13
  console.log(value, message);
14
14
  if (!value || value.trim() == "") {
15
15
  wx.showToast({
@@ -20,7 +20,7 @@ function validateRequired(value, message) {
20
20
  return false;
21
21
  }
22
22
  return true;
23
- }
23
+ };
24
24
  const formatDateTime = (dateTimeString, format) => {
25
25
  var date = new Date(dateTimeString);
26
26
  if (isNaN(date.getTime())) {
@@ -43,13 +43,13 @@ const formatDateTime = (dateTimeString, format) => {
43
43
  }
44
44
  return "";
45
45
  };
46
- function kbToMb(kb, decimalPlaces = 2) {
46
+ const kbToMb = (kb, decimalPlaces = 2) => {
47
47
  return parseFloat((kb / 1024 / 1024).toFixed(decimalPlaces));
48
- }
49
- function convertToISOString(dateString) {
48
+ };
49
+ const convertToISOString = (dateString) => {
50
50
  const date = new Date(dateString);
51
51
  return date.toISOString();
52
- }
52
+ };
53
53
  const getHeight = () => {
54
54
  let navigationPaddingHeight = 0;
55
55
  let topHeight = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xyvcard-wechat-auth",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",