Compare commits
4 Commits
fee4ca327a
...
v1.0.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cfb45a03a2 | ||
|
|
49bb137388 | ||
|
|
10501bc0a9 | ||
|
|
f016d7a01c |
1
dist/index.d.ts
vendored
1
dist/index.d.ts
vendored
@@ -1,5 +1,6 @@
|
||||
export * from "./homeassistant";
|
||||
export * as Logger from "./logger";
|
||||
export * from "./tidal";
|
||||
export * as TimeSpan from "./timespan";
|
||||
export * as Utility from "./utility";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
2
dist/index.d.ts.map
vendored
2
dist/index.d.ts.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC"}
|
||||
3
dist/index.js
vendored
3
dist/index.js
vendored
@@ -36,8 +36,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Utility = exports.Logger = void 0;
|
||||
exports.Utility = exports.TimeSpan = exports.Logger = void 0;
|
||||
__exportStar(require("./homeassistant"), exports);
|
||||
exports.Logger = __importStar(require("./logger"));
|
||||
__exportStar(require("./tidal"), exports);
|
||||
exports.TimeSpan = __importStar(require("./timespan"));
|
||||
exports.Utility = __importStar(require("./utility"));
|
||||
|
||||
8
dist/timespan.d.ts
vendored
Normal file
8
dist/timespan.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export declare class TimeSpan {
|
||||
private start;
|
||||
private end;
|
||||
constructor(timeSpanStr: string);
|
||||
private parseTime;
|
||||
contains(timestamp?: number): boolean;
|
||||
}
|
||||
//# sourceMappingURL=timespan.d.ts.map
|
||||
1
dist/timespan.d.ts.map
vendored
Normal file
1
dist/timespan.d.ts.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"timespan.d.ts","sourceRoot":"","sources":["../src/timespan.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;IACnB,OAAO,CAAC,KAAK,CAAqC;IAClD,OAAO,CAAC,GAAG,CAAqC;gBAEpC,WAAW,EAAE,MAAM;IAM/B,OAAO,CAAC,SAAS;IAKjB,QAAQ,CAAC,SAAS,GAAE,MAAmB,GAAG,OAAO;CAgBlD"}
|
||||
29
dist/timespan.js
vendored
Normal file
29
dist/timespan.js
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TimeSpan = void 0;
|
||||
class TimeSpan {
|
||||
constructor(timeSpanStr) {
|
||||
const [startStr, endStr] = timeSpanStr.split("-");
|
||||
this.start = this.parseTime(startStr);
|
||||
this.end = this.parseTime(endStr);
|
||||
}
|
||||
parseTime(timeStr) {
|
||||
const [hours, minutes] = timeStr.split(":").map(Number);
|
||||
return { hours, minutes };
|
||||
}
|
||||
contains(timestamp = Date.now()) {
|
||||
const date = new Date(timestamp);
|
||||
const hours = date.getHours();
|
||||
const minutes = date.getMinutes();
|
||||
const currentMinutes = hours * 60 + minutes;
|
||||
const startMinutes = this.start.hours * 60 + this.start.minutes;
|
||||
const endMinutes = this.end.hours * 60 + this.end.minutes;
|
||||
if (startMinutes > endMinutes) {
|
||||
return currentMinutes >= startMinutes || currentMinutes < endMinutes;
|
||||
}
|
||||
else {
|
||||
return currentMinutes >= startMinutes && currentMinutes < endMinutes;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.TimeSpan = TimeSpan;
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@dpu/shared",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@dpu/shared",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.5",
|
||||
"dependencies": {
|
||||
"axios": "^1.7.9",
|
||||
"chalk": "^5.6.2"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@dpu/shared",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.5",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from "./homeassistant";
|
||||
export * as Logger from "./logger";
|
||||
export * from "./tidal";
|
||||
export * as TimeSpan from "./timespan";
|
||||
export * as Utility from "./utility";
|
||||
|
||||
Reference in New Issue
Block a user