@amekusa/util.js 1.2.0 → 1.2.1
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/import/bundle.js +4 -2
- package/dist/require/bundle.cjs +4 -2
- package/package.json +2 -2
package/dist/import/bundle.js
CHANGED
|
@@ -173,16 +173,17 @@ function ymd(d, format = null) {
|
|
|
173
173
|
(d.getMonth() + 1).toString().padStart(2, '0'),
|
|
174
174
|
d.getDate().toString().padStart(2, '0'),
|
|
175
175
|
];
|
|
176
|
-
if (!format) return r;
|
|
177
176
|
switch (typeof format) {
|
|
178
177
|
case 'string':
|
|
179
178
|
return r.join(format);
|
|
180
179
|
case 'object':
|
|
180
|
+
if (!format) return r;
|
|
181
181
|
format.Y = r[0];
|
|
182
182
|
format.M = r[1];
|
|
183
183
|
format.D = r[2];
|
|
184
184
|
return format;
|
|
185
185
|
default:
|
|
186
|
+
if (!format) return r;
|
|
186
187
|
throw `invalid type`;
|
|
187
188
|
}
|
|
188
189
|
}
|
|
@@ -202,16 +203,17 @@ function hms(d, format = null) {
|
|
|
202
203
|
d.getMinutes().toString().padStart(2, '0'),
|
|
203
204
|
d.getSeconds().toString().padStart(2, '0'),
|
|
204
205
|
];
|
|
205
|
-
if (!format) return r;
|
|
206
206
|
switch (typeof format) {
|
|
207
207
|
case 'string':
|
|
208
208
|
return r.join(format);
|
|
209
209
|
case 'object':
|
|
210
|
+
if (!format) return r;
|
|
210
211
|
format.h = r[0];
|
|
211
212
|
format.m = r[1];
|
|
212
213
|
format.s = r[2];
|
|
213
214
|
return format;
|
|
214
215
|
default:
|
|
216
|
+
if (!format) return r;
|
|
215
217
|
throw `invalid type`;
|
|
216
218
|
}
|
|
217
219
|
}
|
package/dist/require/bundle.cjs
CHANGED
|
@@ -177,16 +177,17 @@ function ymd(d, format = null) {
|
|
|
177
177
|
(d.getMonth() + 1).toString().padStart(2, '0'),
|
|
178
178
|
d.getDate().toString().padStart(2, '0'),
|
|
179
179
|
];
|
|
180
|
-
if (!format) return r;
|
|
181
180
|
switch (typeof format) {
|
|
182
181
|
case 'string':
|
|
183
182
|
return r.join(format);
|
|
184
183
|
case 'object':
|
|
184
|
+
if (!format) return r;
|
|
185
185
|
format.Y = r[0];
|
|
186
186
|
format.M = r[1];
|
|
187
187
|
format.D = r[2];
|
|
188
188
|
return format;
|
|
189
189
|
default:
|
|
190
|
+
if (!format) return r;
|
|
190
191
|
throw `invalid type`;
|
|
191
192
|
}
|
|
192
193
|
}
|
|
@@ -206,16 +207,17 @@ function hms(d, format = null) {
|
|
|
206
207
|
d.getMinutes().toString().padStart(2, '0'),
|
|
207
208
|
d.getSeconds().toString().padStart(2, '0'),
|
|
208
209
|
];
|
|
209
|
-
if (!format) return r;
|
|
210
210
|
switch (typeof format) {
|
|
211
211
|
case 'string':
|
|
212
212
|
return r.join(format);
|
|
213
213
|
case 'object':
|
|
214
|
+
if (!format) return r;
|
|
214
215
|
format.h = r[0];
|
|
215
216
|
format.m = r[1];
|
|
216
217
|
format.s = r[2];
|
|
217
218
|
return format;
|
|
218
219
|
default:
|
|
220
|
+
if (!format) return r;
|
|
219
221
|
throw `invalid type`;
|
|
220
222
|
}
|
|
221
223
|
}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.2.
|
|
8
|
+
"version": "1.2.1",
|
|
9
9
|
"description": "General purpose utility for JS",
|
|
10
10
|
"type": "module",
|
|
11
11
|
"files": [
|
|
@@ -59,6 +59,6 @@
|
|
|
59
59
|
"author": "Satoshi Soma (https://amekusa.com)",
|
|
60
60
|
"license": "MIT",
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@amekusa/nodeutil": "^3.
|
|
62
|
+
"@amekusa/nodeutil": "^3.4.0"
|
|
63
63
|
}
|
|
64
64
|
}
|