ph-utils 0.16.4 → 0.16.5

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/lib/date.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 将日期格式化为指定形式的字符串
3
3
  * @param date 日期
4
- * @param pattern 格式化字符串 yyyy - 年, mm - 月, dd - 日, HH - 小时, MM - 分钟, ss - 秒, S - 毫秒, 默认: yyyy-mm-dd HH:MM:ss
4
+ * @param pattern 格式化字符串 yyyy - 年, mm - 月, dd - 日, HH - 小时(24时制), MM - 分钟, ss - 秒, S - 毫秒, 默认: yyyy-mm-dd HH:MM:ss
5
5
  */
6
6
  export declare function format(date?: Date | string | number | null, pattern?: string): string;
7
7
  /**
@@ -13,24 +13,24 @@ export declare function parse(date?: Date | string | number | null): Date;
13
13
  /**
14
14
  * 设置日期的开始或者结束的点
15
15
  * @param date 日期,能够被 parse 解析的日期
16
- * @param unit 单位,Date|date, 默认为 Date
16
+ * @param unit 单位,Date[D]、Minute[M], 默认为 Date
17
17
  * @param isEnd true则为 endOf
18
18
  */
19
- export declare function dateOf(date?: Date | string | number, unit?: string, isEnd?: boolean): Date;
19
+ export declare function dateOf(date?: Date | string | number | null, unit?: string, isEnd?: boolean): Date;
20
20
  /**
21
21
  * 设置日期的开始的点
22
22
  * @param date 日期,能够被 parse 解析的日期
23
- * @param unit 单位,Date|date, 默认为 Date
23
+ * @param unit 单位,Date[D]、Minute[M], 默认为 Date
24
24
  * @returns
25
25
  */
26
- export declare function startOf(date?: Date | string | number, unit?: string): Date;
26
+ export declare function startOf(date?: Date | string | number | null, unit?: string): Date;
27
27
  /**
28
28
  * 设置日期的结束点
29
29
  * @param date 日期,能够被 parse 解析的日期
30
- * @param unit 单位,Date|date, 默认为 Date
30
+ * @param unit 单位,Date[D]、Minute[M], 默认为 Date
31
31
  * @returns
32
32
  */
33
- export declare function endOf(date?: Date | string | number, unit?: string): Date;
33
+ export declare function endOf(date?: Date | string | number | null, unit?: string): Date;
34
34
  /**
35
35
  * 获取时间戳
36
36
  * @param ctime 时间
package/lib/date.js CHANGED
@@ -72,7 +72,7 @@ function getLastDayOfMonth(date, month) {
72
72
  /**
73
73
  * 将日期格式化为指定形式的字符串
74
74
  * @param date 日期
75
- * @param pattern 格式化字符串 yyyy - 年, mm - 月, dd - 日, HH - 小时, MM - 分钟, ss - 秒, S - 毫秒, 默认: yyyy-mm-dd HH:MM:ss
75
+ * @param pattern 格式化字符串 yyyy - 年, mm - 月, dd - 日, HH - 小时(24时制), MM - 分钟, ss - 秒, S - 毫秒, 默认: yyyy-mm-dd HH:MM:ss
76
76
  */
77
77
  export function format(date, pattern = "yyyy-mm-dd HH:MM:ss") {
78
78
  // eslint-disable-next-line
@@ -130,7 +130,7 @@ export function parse(date) {
130
130
  /**
131
131
  * 设置日期的开始或者结束的点
132
132
  * @param date 日期,能够被 parse 解析的日期
133
- * @param unit 单位,Date|date, 默认为 Date
133
+ * @param unit 单位,Date[D]、Minute[M], 默认为 Date
134
134
  * @param isEnd true则为 endOf
135
135
  */
136
136
  export function dateOf(date, unit, isEnd = false) {
@@ -163,7 +163,7 @@ export function dateOf(date, unit, isEnd = false) {
163
163
  /**
164
164
  * 设置日期的开始的点
165
165
  * @param date 日期,能够被 parse 解析的日期
166
- * @param unit 单位,Date|date, 默认为 Date
166
+ * @param unit 单位,Date[D]、Minute[M], 默认为 Date
167
167
  * @returns
168
168
  */
169
169
  export function startOf(date, unit) {
@@ -172,7 +172,7 @@ export function startOf(date, unit) {
172
172
  /**
173
173
  * 设置日期的结束点
174
174
  * @param date 日期,能够被 parse 解析的日期
175
- * @param unit 单位,Date|date, 默认为 Date
175
+ * @param unit 单位,Date[D]、Minute[M], 默认为 Date
176
176
  * @returns
177
177
  */
178
178
  export function endOf(date, unit) {
package/lib/theme.js CHANGED
@@ -19,10 +19,10 @@ export async function initTheme() {
19
19
  if ($themeStyle == null) {
20
20
  $themeStyle = document.createElement("style");
21
21
  $themeStyle.id = "theme-style";
22
- $themeStyle.innerHTML = `
23
- :root{color-scheme:light dark;}
24
- html.light{color-scheme: light;}
25
- html.dark {color-scheme: dark;}
22
+ $themeStyle.innerHTML = `
23
+ :root{color-scheme:light dark;}
24
+ html.light{color-scheme: light;}
25
+ html.dark {color-scheme: dark;}
26
26
  `;
27
27
  document.head.appendChild($themeStyle);
28
28
  }
package/package.json CHANGED
@@ -1,99 +1,99 @@
1
- {
2
- "name": "ph-utils",
3
- "description": "js 开发工具集,前后端都可以使用(commonjs和es module)",
4
- "main": "lib/index.js",
5
- "module": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "browser": "lib/index.js",
8
- "exports": {
9
- ".": {
10
- "types": "./lib/index.d.ts",
11
- "import": "./lib/index.js"
12
- },
13
- "./file": {
14
- "types": "./lib/file.d.ts",
15
- "import": "./lib/file.js"
16
- },
17
- "./date": {
18
- "types": "./lib/date.d.ts",
19
- "import": "./lib/date.js"
20
- },
21
- "./server": {
22
- "types": "./lib/server.d.ts",
23
- "import": "./lib/server.js"
24
- },
25
- "./validator": {
26
- "types": "./lib/validator.d.ts",
27
- "import": "./lib/validator.js"
28
- },
29
- "./crypto": {
30
- "types": "./lib/crypto.d.ts",
31
- "import": "./lib/crypto.js"
32
- },
33
- "./crypto_node": {
34
- "types": "./lib/crypto_node.d.ts",
35
- "import": "./lib/crypto_node.js"
36
- },
37
- "./web": {
38
- "types": "./lib/web.d.ts",
39
- "import": "./lib/web.js"
40
- },
41
- "./dom": {
42
- "types": "./lib/dom.d.ts",
43
- "import": "./lib/dom.js"
44
- },
45
- "./copy": {
46
- "types": "./lib/copy.d.ts",
47
- "import": "./lib/copy.js"
48
- },
49
- "./storage": {
50
- "types": "./lib/storage.d.ts",
51
- "import": "./lib/storage.js"
52
- },
53
- "./color": {
54
- "types": "./lib/color.d.ts",
55
- "import": "./lib/color.js"
56
- },
57
- "./logger": {
58
- "types": "./lib/logger.d.ts",
59
- "import": "./lib/logger.js"
60
- },
61
- "./array": {
62
- "types": "./lib/array.d.ts",
63
- "import": "./lib/array.js"
64
- },
65
- "./theme": {
66
- "types": "./lib/theme.d.ts",
67
- "import": "./lib/theme.js"
68
- },
69
- "./*": "./lib/*"
70
- },
71
- "version": "0.16.4",
72
- "type": "module",
73
- "repository": {
74
- "type": "git",
75
- "url": "git+https//gitee.com/towardly/ph.git",
76
- "directory": "packages/utils"
77
- },
78
- "license": "MIT",
79
- "author": "Tenny <tenny.shu@foxmail.com>",
80
- "bugs": {
81
- "url": "https://gitee.com/towardly/ph/issues"
82
- },
83
- "homepage": "https://gitee.com/towardly/ph/tree/master/packages/utils",
84
- "devDependencies": {
85
- "@types/node": "^22.8.2",
86
- "typescript": "^5.6.3"
87
- },
88
- "files": [
89
- "lib"
90
- ],
91
- "keywords": [
92
- "node",
93
- "utils",
94
- "javascript",
95
- "date",
96
- "dom",
97
- "file"
98
- ]
99
- }
1
+ {
2
+ "name": "ph-utils",
3
+ "description": "js 开发工具集,前后端都可以使用(commonjs和es module)",
4
+ "main": "lib/index.js",
5
+ "module": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "browser": "lib/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./lib/index.d.ts",
11
+ "import": "./lib/index.js"
12
+ },
13
+ "./file": {
14
+ "types": "./lib/file.d.ts",
15
+ "import": "./lib/file.js"
16
+ },
17
+ "./date": {
18
+ "types": "./lib/date.d.ts",
19
+ "import": "./lib/date.js"
20
+ },
21
+ "./server": {
22
+ "types": "./lib/server.d.ts",
23
+ "import": "./lib/server.js"
24
+ },
25
+ "./validator": {
26
+ "types": "./lib/validator.d.ts",
27
+ "import": "./lib/validator.js"
28
+ },
29
+ "./crypto": {
30
+ "types": "./lib/crypto.d.ts",
31
+ "import": "./lib/crypto.js"
32
+ },
33
+ "./crypto_node": {
34
+ "types": "./lib/crypto_node.d.ts",
35
+ "import": "./lib/crypto_node.js"
36
+ },
37
+ "./web": {
38
+ "types": "./lib/web.d.ts",
39
+ "import": "./lib/web.js"
40
+ },
41
+ "./dom": {
42
+ "types": "./lib/dom.d.ts",
43
+ "import": "./lib/dom.js"
44
+ },
45
+ "./copy": {
46
+ "types": "./lib/copy.d.ts",
47
+ "import": "./lib/copy.js"
48
+ },
49
+ "./storage": {
50
+ "types": "./lib/storage.d.ts",
51
+ "import": "./lib/storage.js"
52
+ },
53
+ "./color": {
54
+ "types": "./lib/color.d.ts",
55
+ "import": "./lib/color.js"
56
+ },
57
+ "./logger": {
58
+ "types": "./lib/logger.d.ts",
59
+ "import": "./lib/logger.js"
60
+ },
61
+ "./array": {
62
+ "types": "./lib/array.d.ts",
63
+ "import": "./lib/array.js"
64
+ },
65
+ "./theme": {
66
+ "types": "./lib/theme.d.ts",
67
+ "import": "./lib/theme.js"
68
+ },
69
+ "./*": "./lib/*"
70
+ },
71
+ "version": "0.16.5",
72
+ "type": "module",
73
+ "repository": {
74
+ "type": "git",
75
+ "url": "git+https//gitee.com/towardly/ph.git",
76
+ "directory": "packages/utils"
77
+ },
78
+ "license": "MIT",
79
+ "author": "Tenny <tenny.shu@foxmail.com>",
80
+ "bugs": {
81
+ "url": "https://gitee.com/towardly/ph/issues"
82
+ },
83
+ "homepage": "https://gitee.com/towardly/ph/tree/master/packages/utils",
84
+ "devDependencies": {
85
+ "@types/node": "^22.8.2",
86
+ "typescript": "^5.6.3"
87
+ },
88
+ "files": [
89
+ "lib"
90
+ ],
91
+ "keywords": [
92
+ "node",
93
+ "utils",
94
+ "javascript",
95
+ "date",
96
+ "dom",
97
+ "file"
98
+ ]
99
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 Tenny
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.