@amazon/vinyl-mpd-parser 3.2.2 → 3.2.3-next.20261001143710
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.cjs +12 -10
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +12 -10
- package/dist/index.js.map +2 -2
- package/dist/test/benchmark.es5.js +6 -5
- package/dist/test/benchmark.js +34 -29
- package/dist/test/benchmark.js.map +3 -3
- package/dist/types/current/duration/duration.d.ts.map +1 -1
- package/dist/types/current/duration/duration.js +16 -11
- package/dist/types/current/manifest/dashParser.d.ts +3128 -0
- package/dist/types/current/manifest/dashParser.d.ts.map +1 -1
- package/dist/types/current/manifest/dashParser.js +1 -1
- package/dist/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ts3.7/manifest/dashParser.d.ts +3716 -0
- package/dist/types/ts4.1/manifest/dashParser.d.ts +3716 -0
- package/dist/types/ts4.7/manifest/dashParser.d.ts +3716 -0
- package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../../../src/duration/duration.ts"],"names":[],"mappings":"AAoBA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAA;AAQ7B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAkBrD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../../../src/duration/duration.ts"],"names":[],"mappings":"AAoBA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAA;AAQ7B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAkBrD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAyBzD"}
|
|
@@ -60,24 +60,29 @@ export function stringifyDuration(value) {
|
|
|
60
60
|
let abs = Math.abs(value);
|
|
61
61
|
const years = Math.floor(abs / Y);
|
|
62
62
|
abs -= years * Y;
|
|
63
|
-
const months = Math.floor(
|
|
63
|
+
const months = Math.floor(abs / M);
|
|
64
64
|
const days = Math.floor((abs % M) / D);
|
|
65
65
|
const hours = Math.floor((abs % D) / H);
|
|
66
66
|
const minutes = Math.floor((abs % H) / I);
|
|
67
67
|
const seconds = abs % I;
|
|
68
|
-
let
|
|
68
|
+
let date = '';
|
|
69
69
|
if (years > 0)
|
|
70
|
-
|
|
70
|
+
date += `${years}Y`;
|
|
71
71
|
if (months > 0)
|
|
72
|
-
|
|
72
|
+
date += `${months}M`;
|
|
73
73
|
if (days > 0)
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
date += `${days}D`;
|
|
75
|
+
let time = '';
|
|
76
76
|
if (hours > 0)
|
|
77
|
-
|
|
77
|
+
time += `${hours}H`;
|
|
78
78
|
if (minutes > 0)
|
|
79
|
-
|
|
80
|
-
if (seconds > 0
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
time += `${minutes}M`;
|
|
80
|
+
if (seconds > 0)
|
|
81
|
+
time += `${roundToNearest(seconds, 0.001)}S`;
|
|
82
|
+
// A duration must carry at least one component, so a zero duration is
|
|
83
|
+
// written as `PT0S`. The time designator is only written when a time
|
|
84
|
+
// component follows it; a trailing `T` is not a valid duration.
|
|
85
|
+
if (!date && !time)
|
|
86
|
+
time = '0S';
|
|
87
|
+
return `${sign}P${date}${time && `T${time}`}`;
|
|
83
88
|
}
|