expose cobie utilities for browser

This commit is contained in:
Kiyomichi Kosaka
2025-06-15 00:29:36 +02:00
parent fcb49b2f97
commit 76e9bab8e6
4 changed files with 35 additions and 281 deletions
+12 -2
View File
@@ -163,7 +163,7 @@ function formatCobieTimestamp(cobiets) {
return sign + rawDateHex + '.' + paddedTimeHex;
}
module.exports = {
const Cobie = {
COBIE_EPOCH,
COBIE_UNITS,
floorDiv,
@@ -171,5 +171,15 @@ module.exports = {
getTAIOffsetAt,
toCobiets,
fromCobiets,
formatCobieTimestamp
formatCobieTimestamp,
breakdownNonNeg
};
if (typeof module !== 'undefined' && module.exports) {
module.exports = Cobie;
}
// Expose globally when loaded in a browser environment
if (typeof window !== 'undefined') {
window.Cobie = Cobie;
}