@homebridge-plugins/homebridge-tado
Version:
Homebridge plugin for controlling tado° devices.
2 lines • 1.98 kB
JavaScript
/* eslint-disable */
!function (e, r) { 'function' == typeof define && define.amd ? define([], r) : 'object' == typeof exports ? module.exports = r() : e.compareVersions = r(); }(this, function () { var r = /^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i; function s(e) { var r, t, n = e.replace(/^v/, '').replace(/\+.*$/, ''), i = (t = '-', -1 === (r = n).indexOf(t) ? r.length : r.indexOf(t)), o = n.substring(0, i).split('.'); return o.push(n.substring(i + 1)), o; } function c(e) { return isNaN(Number(e)) ? e : Number(e); } function l(e) { if ('string' != typeof e) throw new TypeError('Invalid argument expected string'); if (!r.test(e)) throw new Error('Invalid argument not valid semver (\'' + e + '\' received)'); } function i(e, r) { [e, r].forEach(l); for (var t = s(e), n = s(r), i = 0; i < Math.max(t.length - 1, n.length - 1); i++) { var o = parseInt(t[i] || 0, 10), f = parseInt(n[i] || 0, 10); if (f < o) return 1; if (o < f) return -1; } var a = t[t.length - 1], u = n[n.length - 1]; if (a && u) for (var p = a.split('.').map(c), d = u.split('.').map(c), i = 0; i < Math.max(p.length, d.length); i++) { if (void 0 === p[i] || 'string' == typeof d[i] && 'number' == typeof p[i]) return -1; if (void 0 === d[i] || 'string' == typeof p[i] && 'number' == typeof d[i]) return 1; if (p[i] > d[i]) return 1; if (d[i] > p[i]) return -1; } else if (a || u) return a ? -1 : 1; return 0; } var o = ['>', '>=', '=', '<', '<='], f = { '>': [1], '>=': [0, 1], '=': [0], '<=': [-1, 0], '<': [-1] }; return i.validate = function (e) { return 'string' == typeof e && r.test(e); }, i.compare = function (e, r, t) { !function (e) { if ('string' != typeof e) throw new TypeError('Invalid operator type, expected string but got ' + typeof e); if (-1 === o.indexOf(e)) throw new TypeError('Invalid operator, expected one of ' + o.join('|')); }(t); var n = i(e, r); return -1 < f[t].indexOf(n); }, i; });