Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!variant.dataType) {
throw new Error("Variant must provide a valid dataType" + variant.toString());
}
}
// if (variant.hasOwnProperty("value")) {
// if (variant.dataType === DataType.UInt32) {
// if (!_.isFinite(variant.value)) {
// throw new Error("Expecting an number");
// }
// }
// }
variant = Variant.coerce(variant);
const now = coerceClock(sourceTimestamp, 0);
const dataValue = new DataValue({
sourceTimestamp: now.timestamp,
sourcePicoseconds: now.picoseconds,
serverTimestamp: now.timestamp,
serverPicoseconds: now.picoseconds,
statusCode: statusCode || StatusCodes.Good
});
dataValue.value = variant;
self._internal_set_dataValue(dataValue, null);
};
if (variant.dataType === null || variant.dataType === undefined) {
throw new Error("Variant must provide a valid dataType" + variant.toString());
}
}
// if (variant.hasOwnProperty("value")) {
// if (variant.dataType === DataType.UInt32) {
// if (!_.isFinite(variant.value)) {
// throw new Error("Expecting an number");
// }
// }
// }
variant = Variant.coerce(variant);
const now = coerceClock(sourceTimestamp, 0);
const dataValue = new DataValue({
serverPicoseconds: now.picoseconds,
serverTimestamp: now.timestamp,
sourcePicoseconds: now.picoseconds,
sourceTimestamp: now.timestamp,
statusCode: statusCode || StatusCodes.Good
});
dataValue.value = variant as Variant;
this._internal_set_dataValue(dataValue);
}