dbus-sdk
Version:
A Node.js SDK for interacting with DBus, enabling seamless service calling and exposure with TypeScript support
25 lines (24 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DBusArray = void 0;
const DBusTypeClass_1 = require("../DBusTypeClass");
const DBusVariant_1 = require("./DBusVariant");
const Errors_1 = require("../Errors");
class DBusArray extends DBusTypeClass_1.DBusTypeClass {
static { this.type = 'a'; }
constructor(items, typeClass = (DBusVariant_1.DBusVariant)) {
super(DBusArray.type, items);
if (items.length) {
const arraySignature = items[0].$signature;
this.$arrayItemSignature = arraySignature;
for (const item of items) {
if (item.$signature !== arraySignature)
throw new Errors_1.SignatureError(`The array element type should be consistent with the first element type of the array. The first element type is '${arraySignature}', and there is an element type '${item.$signature}' in the array`);
}
}
else {
this.$arrayItemSignature = typeClass.type;
}
}
}
exports.DBusArray = DBusArray;