UNPKG

@petro-kushchak/homebridge-homepod-radio

Version:

Homebridge accessory for streaming radio to Homepod Mini and Apple TV

20 lines 601 B
export function callbackify(task) { return (...args) => { const onlyArgs = []; let callback; for (const arg of args) { if (typeof arg === 'function') { callback = arg; break; } onlyArgs.push(arg); } if (typeof callback === 'undefined') { throw new Error('Missing callback parameter!'); } task(...onlyArgs) .then((data) => callback(undefined, data)) .catch((err) => callback(err)); }; } //# sourceMappingURL=homebridgeCallbacks.js.map