Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function isValidScalarVariant(dataType, value) {
assert(value === null || DataType.Int64 === dataType || DataType.ByteString === dataType || DataType.UInt64 === dataType || !(value instanceof Array));
assert(value === null || !(value instanceof Int32Array));
assert(value === null || !(value instanceof Uint32Array));
switch (dataType) {
case DataType.NodeId:
return ec.isValidNodeId(value);
case DataType.String:
return typeof value === "string" || utils.isNullOrUndefined(value);
case DataType.Int64:
return ec.isValidInt64(value);
case DataType.UInt64:
return ec.isValidUInt64(value);
case DataType.UInt32:
return ec.isValidUInt32(value);
case DataType.Int32:
return ec.isValidInt32(value);
case DataType.UInt16:
return ec.isValidUInt16(value);
case DataType.Int16:
return ec.isValidInt16(value);
case DataType.Byte:
return ec.isValidUInt8(value);
case DataType.SByte:
return ec.isValidInt8(value);
case DataType.Boolean:
return ec.isValidBoolean(value);
function isValidScalarVariant(dataType: DataType, value: any): boolean {
assert(value === null
|| DataType.Int64 === dataType
|| DataType.ByteString === dataType
|| DataType.UInt64 === dataType
|| !(value instanceof Array));
assert(value === null || !(value instanceof Int32Array));
assert(value === null || !(value instanceof Uint32Array));
switch (dataType) {
case DataType.NodeId:
return isValidNodeId(value);
case DataType.String:
return typeof value === "string" || utils.isNullOrUndefined(value);
case DataType.Int64:
return isValidInt64(value);
case DataType.UInt64:
return isValidUInt64(value);
case DataType.UInt32:
return isValidUInt32(value);
case DataType.Int32:
return isValidInt32(value);
case DataType.UInt16:
return isValidUInt16(value);
case DataType.Int16:
return isValidInt16(value);
case DataType.Byte:
return isValidUInt8(value);
case DataType.SByte:
return isValidInt8(value);
case DataType.Boolean:
return isValidBoolean(value);