@openclaw/google-meet 2026.7.2-beta.7 → 2026.8.1-beta.3
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/chrome-create-PKAyxCiL.js +325 -0
- package/dist/{cli-DCcRyaMf.js → cli-Bd63VJ5q.js} +191 -237
- package/dist/{config-BcaS1BDr.js → config-wBK8loBb.js} +97 -221
- package/dist/{create-af1MDlus.js → create-BEDHM6uL.js} +3 -14
- package/dist/google-meet-platform-adapter-C3J-iFRE.js +791 -0
- package/dist/google-meet-platform-constants-Bs5iAg3E.js +25 -0
- package/dist/index.js +185 -2639
- package/dist/meet-url-BP2Jlvjs.js +17 -0
- package/dist/node-host-BXtXbsMa.js +49 -0
- package/dist/node-invoke-policy-B0gOlLJR.js +24 -0
- package/dist/{oauth-DOfMKlGp.js → oauth-9sUJ68Mw.js} +3 -14
- package/dist/{chrome-create-DMKruRFW.js → plugin-helpers-C9-Y0Ago.js} +335 -355
- package/dist/plugin-registration-Csi-NdQU.js +131 -0
- package/dist/runtime-B8d1beHo.js +1308 -0
- package/openclaw.plugin.json +15 -47
- package/package.json +4 -6
- package/node_modules/pretty-ms/index.d.ts +0 -157
- package/node_modules/pretty-ms/index.js +0 -149
- package/node_modules/pretty-ms/license +0 -9
- package/node_modules/pretty-ms/node_modules/parse-ms/index.d.ts +0 -30
- package/node_modules/pretty-ms/node_modules/parse-ms/index.js +0 -45
- package/node_modules/pretty-ms/node_modules/parse-ms/license +0 -9
- package/node_modules/pretty-ms/node_modules/parse-ms/package.json +0 -47
- package/node_modules/pretty-ms/node_modules/parse-ms/readme.md +0 -46
- package/node_modules/pretty-ms/package.json +0 -55
- package/node_modules/pretty-ms/readme.md +0 -179
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "google-meet",
|
|
3
|
+
"doctorContract": {
|
|
4
|
+
"configRepair": true
|
|
5
|
+
},
|
|
3
6
|
"name": "Google Meet",
|
|
4
7
|
"description": "OpenClaw Google Meet participant plugin for joining calls through Chrome or Twilio transports.",
|
|
8
|
+
"cliCommands": [
|
|
9
|
+
{
|
|
10
|
+
"name": "googlemeet",
|
|
11
|
+
"description": "Join and manage Google Meet calls",
|
|
12
|
+
"hasSubcommands": true
|
|
13
|
+
}
|
|
14
|
+
],
|
|
5
15
|
"icon": "https://cdn.simpleicons.org/googlemeet",
|
|
6
16
|
"enabledByDefault": true,
|
|
7
17
|
"commandAliases": [{ "name": "googlemeet" }],
|
|
@@ -34,7 +44,7 @@
|
|
|
34
44
|
},
|
|
35
45
|
"chrome.audioBackend": {
|
|
36
46
|
"label": "Chrome Audio Backend",
|
|
37
|
-
"help": "BlackHole 2ch
|
|
47
|
+
"help": "Auto selects BlackHole 2ch on macOS or PipeWire-Pulse on Linux."
|
|
38
48
|
},
|
|
39
49
|
"chrome.launch": {
|
|
40
50
|
"label": "Launch Chrome"
|
|
@@ -97,7 +107,7 @@
|
|
|
97
107
|
},
|
|
98
108
|
"chrome.audioBufferBytes": {
|
|
99
109
|
"label": "Audio Buffer Bytes",
|
|
100
|
-
"help": "
|
|
110
|
+
"help": "Processing buffer for generated Chrome command-pair audio. Lower values reduce latency but may underrun on busy hosts.",
|
|
101
111
|
"advanced": true
|
|
102
112
|
},
|
|
103
113
|
"chrome.audioBridgeCommand": {
|
|
@@ -110,7 +120,7 @@
|
|
|
110
120
|
},
|
|
111
121
|
"chromeNode.node": {
|
|
112
122
|
"label": "Chrome Node",
|
|
113
|
-
"help": "Node id/name/IP that owns Chrome
|
|
123
|
+
"help": "Node id/name/IP that owns Chrome and the native virtual-audio backend for chrome-node transport.",
|
|
114
124
|
"advanced": true
|
|
115
125
|
},
|
|
116
126
|
"twilio.defaultDialInNumber": {
|
|
@@ -257,8 +267,8 @@
|
|
|
257
267
|
"properties": {
|
|
258
268
|
"audioBackend": {
|
|
259
269
|
"type": "string",
|
|
260
|
-
"enum": ["blackhole-2ch"],
|
|
261
|
-
"default": "
|
|
270
|
+
"enum": ["auto", "blackhole-2ch", "pipewire-pulse"],
|
|
271
|
+
"default": "auto"
|
|
262
272
|
},
|
|
263
273
|
"launch": {
|
|
264
274
|
"type": "boolean",
|
|
@@ -298,54 +308,12 @@
|
|
|
298
308
|
},
|
|
299
309
|
"audioInputCommand": {
|
|
300
310
|
"type": "array",
|
|
301
|
-
"default": [
|
|
302
|
-
"sox",
|
|
303
|
-
"-q",
|
|
304
|
-
"--buffer",
|
|
305
|
-
"4096",
|
|
306
|
-
"-t",
|
|
307
|
-
"coreaudio",
|
|
308
|
-
"BlackHole 2ch",
|
|
309
|
-
"-t",
|
|
310
|
-
"raw",
|
|
311
|
-
"-r",
|
|
312
|
-
"24000",
|
|
313
|
-
"-c",
|
|
314
|
-
"1",
|
|
315
|
-
"-e",
|
|
316
|
-
"signed-integer",
|
|
317
|
-
"-b",
|
|
318
|
-
"16",
|
|
319
|
-
"-L",
|
|
320
|
-
"-"
|
|
321
|
-
],
|
|
322
311
|
"items": {
|
|
323
312
|
"type": "string"
|
|
324
313
|
}
|
|
325
314
|
},
|
|
326
315
|
"audioOutputCommand": {
|
|
327
316
|
"type": "array",
|
|
328
|
-
"default": [
|
|
329
|
-
"sox",
|
|
330
|
-
"-q",
|
|
331
|
-
"--buffer",
|
|
332
|
-
"4096",
|
|
333
|
-
"-t",
|
|
334
|
-
"raw",
|
|
335
|
-
"-r",
|
|
336
|
-
"24000",
|
|
337
|
-
"-c",
|
|
338
|
-
"1",
|
|
339
|
-
"-e",
|
|
340
|
-
"signed-integer",
|
|
341
|
-
"-b",
|
|
342
|
-
"16",
|
|
343
|
-
"-L",
|
|
344
|
-
"-",
|
|
345
|
-
"-t",
|
|
346
|
-
"coreaudio",
|
|
347
|
-
"BlackHole 2ch"
|
|
348
|
-
],
|
|
349
317
|
"items": {
|
|
350
318
|
"type": "string"
|
|
351
319
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/google-meet",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.8.1-beta.3",
|
|
4
4
|
"description": "OpenClaw Google Meet participant plugin for joining calls through Chrome or Twilio transports.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,11 +9,10 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"jszip": "3.10.1",
|
|
12
|
-
"pretty-ms": "9.3.0",
|
|
13
12
|
"typebox": "1.3.6"
|
|
14
13
|
},
|
|
15
14
|
"peerDependencies": {
|
|
16
|
-
"openclaw": ">=2026.
|
|
15
|
+
"openclaw": ">=2026.8.1-beta.3"
|
|
17
16
|
},
|
|
18
17
|
"peerDependenciesMeta": {
|
|
19
18
|
"openclaw": {
|
|
@@ -30,10 +29,10 @@
|
|
|
30
29
|
"minHostVersion": ">=2026.4.20"
|
|
31
30
|
},
|
|
32
31
|
"compat": {
|
|
33
|
-
"pluginApi": ">=2026.
|
|
32
|
+
"pluginApi": ">=2026.8.1-beta.3"
|
|
34
33
|
},
|
|
35
34
|
"build": {
|
|
36
|
-
"openclawVersion": "2026.
|
|
35
|
+
"openclawVersion": "2026.8.1-beta.3"
|
|
37
36
|
},
|
|
38
37
|
"release": {
|
|
39
38
|
"publishToClawHub": true,
|
|
@@ -50,7 +49,6 @@
|
|
|
50
49
|
],
|
|
51
50
|
"bundledDependencies": [
|
|
52
51
|
"jszip",
|
|
53
|
-
"pretty-ms",
|
|
54
52
|
"typebox"
|
|
55
53
|
]
|
|
56
54
|
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
export type Options = {
|
|
2
|
-
/**
|
|
3
|
-
Number of digits to appear after the seconds decimal point.
|
|
4
|
-
|
|
5
|
-
@default 1
|
|
6
|
-
*/
|
|
7
|
-
readonly secondsDecimalDigits?: number;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
Number of digits to appear after the milliseconds decimal point.
|
|
11
|
-
|
|
12
|
-
Useful in combination with [`process.hrtime()`](https://nodejs.org/api/process.html#process_process_hrtime).
|
|
13
|
-
|
|
14
|
-
@default 0
|
|
15
|
-
*/
|
|
16
|
-
readonly millisecondsDecimalDigits?: number;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
Keep milliseconds on whole seconds: `13s` → `13.0s`.
|
|
20
|
-
|
|
21
|
-
Useful when you are showing a number of seconds spent on an operation and don't want the width of the output to change when hitting a whole number.
|
|
22
|
-
|
|
23
|
-
@default false
|
|
24
|
-
*/
|
|
25
|
-
readonly keepDecimalsOnWholeSeconds?: boolean;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
Only show the first unit: `1h 10m` → `1h`.
|
|
29
|
-
|
|
30
|
-
Also ensures that `millisecondsDecimalDigits` and `secondsDecimalDigits` are both set to `0`.
|
|
31
|
-
|
|
32
|
-
@default false
|
|
33
|
-
*/
|
|
34
|
-
readonly compact?: boolean;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
Number of units to show. Setting `compact` to `true` overrides this option.
|
|
38
|
-
|
|
39
|
-
@default Infinity
|
|
40
|
-
*/
|
|
41
|
-
readonly unitCount?: number;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
Use full-length units: `5h 1m 45s` → `5 hours 1 minute 45 seconds`.
|
|
45
|
-
|
|
46
|
-
@default false
|
|
47
|
-
*/
|
|
48
|
-
readonly verbose?: boolean;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
Show milliseconds separately. This means they won't be included in the decimal part of the seconds.
|
|
52
|
-
|
|
53
|
-
@default false
|
|
54
|
-
*/
|
|
55
|
-
readonly separateMilliseconds?: boolean;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
Show microseconds and nanoseconds.
|
|
59
|
-
|
|
60
|
-
@default false
|
|
61
|
-
*/
|
|
62
|
-
readonly formatSubMilliseconds?: boolean;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
Display time using colon notation: `5h 1m 45s` → `5:01:45`. Always shows time in at least minutes: `1s` → `0:01`
|
|
66
|
-
|
|
67
|
-
Useful when you want to display time without the time units, similar to a digital watch.
|
|
68
|
-
|
|
69
|
-
Setting `colonNotation` to `true` overrides the following options to `false`:
|
|
70
|
-
- `compact`
|
|
71
|
-
- `formatSubMilliseconds`
|
|
72
|
-
- `separateMilliseconds`
|
|
73
|
-
- `verbose`
|
|
74
|
-
|
|
75
|
-
@default false
|
|
76
|
-
*/
|
|
77
|
-
readonly colonNotation?: boolean;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
Hides the year and shows the hidden year additionally as days (365 per year): `1y 3d 5h 1m 45s` → `368d 5h 1m 45s`.
|
|
81
|
-
|
|
82
|
-
@default false
|
|
83
|
-
*/
|
|
84
|
-
readonly hideYear?: boolean;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
Hides the year and days and shows the hidden values additionally as hours: `1y 3d 5h 1m 45s` → `8837h 1m 45s`.
|
|
88
|
-
|
|
89
|
-
@default false
|
|
90
|
-
*/
|
|
91
|
-
readonly hideYearAndDays?: boolean;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
Hides the seconds: `1y 3d 5h 1m 45s` → `1y 3d 5h 1m`.
|
|
95
|
-
|
|
96
|
-
@default false
|
|
97
|
-
*/
|
|
98
|
-
readonly hideSeconds?: boolean;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
Show sub-second values as decimal seconds: `900ms` → `0.9s`.
|
|
102
|
-
|
|
103
|
-
Useful for progress indicators where you want consistent unit format to prevent flickering.
|
|
104
|
-
|
|
105
|
-
@default false
|
|
106
|
-
*/
|
|
107
|
-
readonly subSecondsAsDecimals?: boolean;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
Convert milliseconds to a human readable string: `1337000000` → `15d 11h 23m 20s`.
|
|
112
|
-
|
|
113
|
-
@param milliseconds - Milliseconds to humanize.
|
|
114
|
-
|
|
115
|
-
@example
|
|
116
|
-
```
|
|
117
|
-
import prettyMilliseconds from 'pretty-ms';
|
|
118
|
-
|
|
119
|
-
prettyMilliseconds(1337000000);
|
|
120
|
-
//=> '15d 11h 23m 20s'
|
|
121
|
-
|
|
122
|
-
prettyMilliseconds(1337);
|
|
123
|
-
//=> '1.3s'
|
|
124
|
-
|
|
125
|
-
prettyMilliseconds(133);
|
|
126
|
-
//=> '133ms'
|
|
127
|
-
|
|
128
|
-
// `compact` option
|
|
129
|
-
prettyMilliseconds(1337, {compact: true});
|
|
130
|
-
//=> '1s'
|
|
131
|
-
|
|
132
|
-
// `verbose` option
|
|
133
|
-
prettyMilliseconds(1335669000, {verbose: true});
|
|
134
|
-
//=> '15 days 11 hours 1 minute 9 seconds'
|
|
135
|
-
|
|
136
|
-
// `colonNotation` option
|
|
137
|
-
prettyMilliseconds(95500, {colonNotation: true});
|
|
138
|
-
//=> '1:35.5'
|
|
139
|
-
|
|
140
|
-
// `formatSubMilliseconds` option
|
|
141
|
-
prettyMilliseconds(100.400080, {formatSubMilliseconds: true})
|
|
142
|
-
//=> '100ms 400µs 80ns'
|
|
143
|
-
|
|
144
|
-
// `subSecondsAsDecimals` option
|
|
145
|
-
prettyMilliseconds(900, {subSecondsAsDecimals: true});
|
|
146
|
-
//=> '0.9s'
|
|
147
|
-
|
|
148
|
-
// Can be useful for time durations
|
|
149
|
-
prettyMilliseconds(new Date(2014, 0, 1, 10, 40) - new Date(2014, 0, 1, 10, 5))
|
|
150
|
-
//=> '35m'
|
|
151
|
-
```
|
|
152
|
-
*/
|
|
153
|
-
export default function prettyMilliseconds(
|
|
154
|
-
milliseconds: number | bigint,
|
|
155
|
-
options?: Options
|
|
156
|
-
): string;
|
|
157
|
-
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import parseMilliseconds from 'parse-ms';
|
|
2
|
-
|
|
3
|
-
const isZero = value => value === 0 || value === 0n;
|
|
4
|
-
const pluralize = (word, count) => (count === 1 || count === 1n) ? word : `${word}s`;
|
|
5
|
-
|
|
6
|
-
const SECOND_ROUNDING_EPSILON = 0.000_000_1;
|
|
7
|
-
const ONE_DAY_IN_MILLISECONDS = 24n * 60n * 60n * 1000n;
|
|
8
|
-
|
|
9
|
-
export default function prettyMilliseconds(milliseconds, options) {
|
|
10
|
-
const isBigInt = typeof milliseconds === 'bigint';
|
|
11
|
-
if (!isBigInt && !Number.isFinite(milliseconds)) {
|
|
12
|
-
throw new TypeError('Expected a finite number or bigint');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
options = {...options};
|
|
16
|
-
|
|
17
|
-
const sign = milliseconds < 0 ? '-' : '';
|
|
18
|
-
milliseconds = milliseconds < 0 ? -milliseconds : milliseconds; // Cannot use `Math.abs()` because of BigInt support.
|
|
19
|
-
|
|
20
|
-
if (options.colonNotation) {
|
|
21
|
-
options.compact = false;
|
|
22
|
-
options.formatSubMilliseconds = false;
|
|
23
|
-
options.separateMilliseconds = false;
|
|
24
|
-
options.verbose = false;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (options.compact) {
|
|
28
|
-
options.unitCount = 1;
|
|
29
|
-
options.secondsDecimalDigits = 0;
|
|
30
|
-
options.millisecondsDecimalDigits = 0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let result = [];
|
|
34
|
-
|
|
35
|
-
const floorDecimals = (value, decimalDigits) => {
|
|
36
|
-
const flooredInterimValue = Math.floor((value * (10 ** decimalDigits)) + SECOND_ROUNDING_EPSILON);
|
|
37
|
-
const flooredValue = Math.round(flooredInterimValue) / (10 ** decimalDigits);
|
|
38
|
-
return flooredValue.toFixed(decimalDigits);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const add = (value, long, short, valueString) => {
|
|
42
|
-
if (
|
|
43
|
-
(result.length === 0 || !options.colonNotation)
|
|
44
|
-
&& isZero(value)
|
|
45
|
-
&& !(options.colonNotation && short === 'm')) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
valueString ??= String(value);
|
|
50
|
-
if (options.colonNotation) {
|
|
51
|
-
const wholeDigits = valueString.includes('.') ? valueString.split('.')[0].length : valueString.length;
|
|
52
|
-
const minLength = result.length > 0 ? 2 : 1;
|
|
53
|
-
valueString = '0'.repeat(Math.max(0, minLength - wholeDigits)) + valueString;
|
|
54
|
-
} else {
|
|
55
|
-
valueString += options.verbose ? ' ' + pluralize(long, value) : short;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
result.push(valueString);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const parsed = parseMilliseconds(milliseconds);
|
|
62
|
-
const days = BigInt(parsed.days);
|
|
63
|
-
|
|
64
|
-
if (options.hideYearAndDays) {
|
|
65
|
-
add((BigInt(days) * 24n) + BigInt(parsed.hours), 'hour', 'h');
|
|
66
|
-
} else {
|
|
67
|
-
if (options.hideYear) {
|
|
68
|
-
add(days, 'day', 'd');
|
|
69
|
-
} else {
|
|
70
|
-
add(days / 365n, 'year', 'y');
|
|
71
|
-
add(days % 365n, 'day', 'd');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
add(Number(parsed.hours), 'hour', 'h');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
add(Number(parsed.minutes), 'minute', 'm');
|
|
78
|
-
|
|
79
|
-
if (!options.hideSeconds) {
|
|
80
|
-
if (
|
|
81
|
-
options.separateMilliseconds
|
|
82
|
-
|| options.formatSubMilliseconds
|
|
83
|
-
|| (!options.colonNotation && milliseconds < 1000 && !options.subSecondsAsDecimals)
|
|
84
|
-
) {
|
|
85
|
-
const seconds = Number(parsed.seconds);
|
|
86
|
-
const milliseconds = Number(parsed.milliseconds);
|
|
87
|
-
const microseconds = Number(parsed.microseconds);
|
|
88
|
-
const nanoseconds = Number(parsed.nanoseconds);
|
|
89
|
-
|
|
90
|
-
add(seconds, 'second', 's');
|
|
91
|
-
|
|
92
|
-
if (options.formatSubMilliseconds) {
|
|
93
|
-
add(milliseconds, 'millisecond', 'ms');
|
|
94
|
-
add(microseconds, 'microsecond', 'µs');
|
|
95
|
-
add(nanoseconds, 'nanosecond', 'ns');
|
|
96
|
-
} else {
|
|
97
|
-
const millisecondsAndBelow
|
|
98
|
-
= milliseconds
|
|
99
|
-
+ (microseconds / 1000)
|
|
100
|
-
+ (nanoseconds / 1e6);
|
|
101
|
-
|
|
102
|
-
const millisecondsDecimalDigits
|
|
103
|
-
= typeof options.millisecondsDecimalDigits === 'number'
|
|
104
|
-
? options.millisecondsDecimalDigits
|
|
105
|
-
: 0;
|
|
106
|
-
|
|
107
|
-
const roundedMilliseconds = millisecondsAndBelow >= 1
|
|
108
|
-
? Math.round(millisecondsAndBelow)
|
|
109
|
-
: Math.ceil(millisecondsAndBelow);
|
|
110
|
-
|
|
111
|
-
const millisecondsString = millisecondsDecimalDigits
|
|
112
|
-
? millisecondsAndBelow.toFixed(millisecondsDecimalDigits)
|
|
113
|
-
: roundedMilliseconds;
|
|
114
|
-
|
|
115
|
-
add(
|
|
116
|
-
Number.parseFloat(millisecondsString),
|
|
117
|
-
'millisecond',
|
|
118
|
-
'ms',
|
|
119
|
-
millisecondsString,
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
} else {
|
|
123
|
-
const seconds = (
|
|
124
|
-
(isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds)
|
|
125
|
-
/ 1000
|
|
126
|
-
) % 60;
|
|
127
|
-
const secondsDecimalDigits
|
|
128
|
-
= typeof options.secondsDecimalDigits === 'number'
|
|
129
|
-
? options.secondsDecimalDigits
|
|
130
|
-
: 1;
|
|
131
|
-
const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
|
|
132
|
-
const secondsString = options.keepDecimalsOnWholeSeconds
|
|
133
|
-
? secondsFixed
|
|
134
|
-
: secondsFixed.replace(/\.0+$/, '');
|
|
135
|
-
add(Number.parseFloat(secondsString), 'second', 's', secondsString);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (result.length === 0) {
|
|
140
|
-
return sign + '0' + (options.verbose ? ' milliseconds' : 'ms');
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const separator = options.colonNotation ? ':' : ' ';
|
|
144
|
-
if (typeof options.unitCount === 'number') {
|
|
145
|
-
result = result.slice(0, Math.max(options.unitCount, 1));
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return sign + result.join(separator);
|
|
149
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export type TimeComponents<T extends (number | bigint) = number> = {
|
|
2
|
-
days: T;
|
|
3
|
-
hours: T;
|
|
4
|
-
minutes: T;
|
|
5
|
-
seconds: T;
|
|
6
|
-
milliseconds: T;
|
|
7
|
-
microseconds: T;
|
|
8
|
-
nanoseconds: T;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
Parse milliseconds into an object.
|
|
13
|
-
|
|
14
|
-
@example
|
|
15
|
-
```
|
|
16
|
-
import parseMilliseconds from 'parse-ms';
|
|
17
|
-
|
|
18
|
-
parseMilliseconds(1337000001);
|
|
19
|
-
// {
|
|
20
|
-
// days: 15,
|
|
21
|
-
// hours: 11,
|
|
22
|
-
// minutes: 23,
|
|
23
|
-
// seconds: 20,
|
|
24
|
-
// milliseconds: 1,
|
|
25
|
-
// microseconds: 0,
|
|
26
|
-
// nanoseconds: 0
|
|
27
|
-
// }
|
|
28
|
-
```
|
|
29
|
-
*/
|
|
30
|
-
export default function parseMilliseconds<T extends number | bigint>(milliseconds: T): TimeComponents<T>;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const toZeroIfInfinity = value => Number.isFinite(value) ? value : 0;
|
|
2
|
-
|
|
3
|
-
function parseNumber(milliseconds) {
|
|
4
|
-
return {
|
|
5
|
-
days: Math.trunc(milliseconds / 86_400_000),
|
|
6
|
-
hours: Math.trunc(milliseconds / 3_600_000 % 24),
|
|
7
|
-
minutes: Math.trunc(milliseconds / 60_000 % 60),
|
|
8
|
-
seconds: Math.trunc(milliseconds / 1000 % 60),
|
|
9
|
-
milliseconds: Math.trunc(milliseconds % 1000),
|
|
10
|
-
microseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1000) % 1000),
|
|
11
|
-
nanoseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1e6) % 1000),
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function parseBigint(milliseconds) {
|
|
16
|
-
return {
|
|
17
|
-
days: milliseconds / 86_400_000n,
|
|
18
|
-
hours: milliseconds / 3_600_000n % 24n,
|
|
19
|
-
minutes: milliseconds / 60_000n % 60n,
|
|
20
|
-
seconds: milliseconds / 1000n % 60n,
|
|
21
|
-
milliseconds: milliseconds % 1000n,
|
|
22
|
-
microseconds: 0n,
|
|
23
|
-
nanoseconds: 0n,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default function parseMilliseconds(milliseconds) {
|
|
28
|
-
switch (typeof milliseconds) {
|
|
29
|
-
case 'number': {
|
|
30
|
-
if (Number.isFinite(milliseconds)) {
|
|
31
|
-
return parseNumber(milliseconds);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
case 'bigint': {
|
|
38
|
-
return parseBigint(milliseconds);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// No default
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
throw new TypeError('Expected a finite number or bigint');
|
|
45
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "parse-ms",
|
|
3
|
-
"version": "4.0.0",
|
|
4
|
-
"description": "Parse milliseconds into an object",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": "sindresorhus/parse-ms",
|
|
7
|
-
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
|
-
"author": {
|
|
9
|
-
"name": "Sindre Sorhus",
|
|
10
|
-
"email": "sindresorhus@gmail.com",
|
|
11
|
-
"url": "https://sindresorhus.com"
|
|
12
|
-
},
|
|
13
|
-
"type": "module",
|
|
14
|
-
"exports": {
|
|
15
|
-
"types": "./index.d.ts",
|
|
16
|
-
"default": "./index.js"
|
|
17
|
-
},
|
|
18
|
-
"sideEffects": false,
|
|
19
|
-
"engines": {
|
|
20
|
-
"node": ">=18"
|
|
21
|
-
},
|
|
22
|
-
"scripts": {
|
|
23
|
-
"test": "xo && ava && tsd"
|
|
24
|
-
},
|
|
25
|
-
"files": [
|
|
26
|
-
"index.js",
|
|
27
|
-
"index.d.ts"
|
|
28
|
-
],
|
|
29
|
-
"keywords": [
|
|
30
|
-
"browser",
|
|
31
|
-
"parse",
|
|
32
|
-
"time",
|
|
33
|
-
"ms",
|
|
34
|
-
"milliseconds",
|
|
35
|
-
"microseconds",
|
|
36
|
-
"nanoseconds",
|
|
37
|
-
"duration",
|
|
38
|
-
"period",
|
|
39
|
-
"range",
|
|
40
|
-
"interval"
|
|
41
|
-
],
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"ava": "^6.0.1",
|
|
44
|
-
"tsd": "^0.30.3",
|
|
45
|
-
"xo": "^0.56.0"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# parse-ms
|
|
2
|
-
|
|
3
|
-
> Parse milliseconds into an object
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
npm install parse-ms
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
import parseMilliseconds from 'parse-ms';
|
|
15
|
-
|
|
16
|
-
parseMilliseconds(1337000001);
|
|
17
|
-
/*
|
|
18
|
-
{
|
|
19
|
-
days: 15,
|
|
20
|
-
hours: 11,
|
|
21
|
-
minutes: 23,
|
|
22
|
-
seconds: 20,
|
|
23
|
-
milliseconds: 1,
|
|
24
|
-
microseconds: 0,
|
|
25
|
-
nanoseconds: 0
|
|
26
|
-
}
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
parseMilliseconds(1337000001n);
|
|
30
|
-
/*
|
|
31
|
-
{
|
|
32
|
-
days: 15n,
|
|
33
|
-
hours: 11n,
|
|
34
|
-
minutes: 23n,
|
|
35
|
-
seconds: 20n,
|
|
36
|
-
milliseconds: 1n,
|
|
37
|
-
microseconds: 0n,
|
|
38
|
-
nanoseconds: 0n
|
|
39
|
-
}
|
|
40
|
-
*/
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Related
|
|
44
|
-
|
|
45
|
-
- [to-milliseconds](https://github.com/sindresorhus/to-milliseconds) - The inverse of this module
|
|
46
|
-
- [pretty-ms](https://github.com/sindresorhus/pretty-ms) - Convert milliseconds to a human readable string
|