Skip to content

Commit

Permalink
style: run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
relu91 committed Dec 13, 2024
1 parent 48ae517 commit 6cb33d5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 22 deletions.
8 changes: 4 additions & 4 deletions packages/binding-modbus/src/modbus-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,17 @@ export default class ModbusClient implements ProtocolClient {
mode === "r"
? ModbusFunction.readCoil
: contentLength > 1
? ModbusFunction.writeMultipleCoils
: ModbusFunction.writeSingleCoil;
? ModbusFunction.writeMultipleCoils
: ModbusFunction.writeSingleCoil;
break;
case "HoldingRegister":
// the content length must be divided by 2 (holding registers are 16bit)
result["modv:function"] =
mode === "r"
? ModbusFunction.readHoldingRegisters
: contentLength / 2 > 1
? ModbusFunction.writeMultipleHoldingRegisters
: ModbusFunction.writeSingleHoldingRegister;
? ModbusFunction.writeMultipleHoldingRegisters
: ModbusFunction.writeSingleHoldingRegister;
break;
case "InputRegister":
result["modv:function"] = ModbusFunction.readInputRegister;
Expand Down
4 changes: 2 additions & 2 deletions packages/binding-opcua/src/opcua-protocol-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,8 @@ export class OPCUAProtocolClient implements ProtocolClient {
valueRank === -1
? VariantArrayType.Scalar
: valueRank === 1
? VariantArrayType.Array
: VariantArrayType.Matrix;
? VariantArrayType.Array
: VariantArrayType.Matrix;

const n = (a: unknown) => Buffer.from(JSON.stringify(a));
const v = await this._contentToVariant(content2.type, n(bodyInput[name ?? "null"]), basicDataType);
Expand Down
20 changes: 10 additions & 10 deletions packages/core/src/codecs/octetstream-codec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,26 +183,26 @@ export default class OctetstreamCodec implements ContentCodec {
? bytes.readInt16BE(0)
: bytes.readUInt16BE(0)
: signed
? bytes.readInt16LE(0)
: bytes.readUInt16LE(0);
? bytes.readInt16LE(0)
: bytes.readUInt16LE(0);

case 32:
return bigEndian
? signed
? bytes.readInt32BE(0)
: bytes.readUInt32BE(0)
: signed
? bytes.readInt32LE(0)
: bytes.readUInt32LE(0);
? bytes.readInt32LE(0)
: bytes.readUInt32LE(0);

default: {
const result = bigEndian
? signed
? bytes.readIntBE(0, dataLength / 8)
: bytes.readUIntBE(0, dataLength / 8)
: signed
? bytes.readIntLE(0, dataLength / 8)
: bytes.readUIntLE(0, dataLength / 8);
? bytes.readIntLE(0, dataLength / 8)
: bytes.readUIntLE(0, dataLength / 8);
// warn about numbers being too big to be represented as safe integers
if (!Number.isSafeInteger(result)) {
warn("Result is not a safe integer");
Expand Down Expand Up @@ -460,8 +460,8 @@ export default class OctetstreamCodec implements ContentCodec {
? buf.writeInt16BE(value, 0)
: buf.writeUInt16BE(value, 0)
: signed
? buf.writeInt16LE(value, 0)
: buf.writeUInt16LE(value, 0);
? buf.writeInt16LE(value, 0)
: buf.writeUInt16LE(value, 0);
break;

case 4:
Expand All @@ -470,8 +470,8 @@ export default class OctetstreamCodec implements ContentCodec {
? buf.writeInt32BE(value, 0)
: buf.writeUInt32BE(value, 0)
: signed
? buf.writeInt32LE(value, 0)
: buf.writeUInt32LE(value, 0);
? buf.writeInt32LE(value, 0)
: buf.writeUInt32LE(value, 0);
break;

default:
Expand Down
11 changes: 5 additions & 6 deletions packages/td-tools/src/td-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ export * from "./thing-description";
export * from "./td-parser";
export * from "./td-helpers";
export * from "./thing-model-helpers";
type DeepPartial<T> =
T extends Record<string, unknown>
? {
[P in keyof T]?: T[P] extends Array<infer I> ? Array<DeepPartial<I>> : DeepPartial<T[P]>;
}
: T;
type DeepPartial<T> = T extends Record<string, unknown>
? {
[P in keyof T]?: T[P] extends Array<infer I> ? Array<DeepPartial<I>> : DeepPartial<T[P]>;
}
: T;

/**
* @deprecated Will be removed in the future. Please use '@node-wot/core' package instead.
Expand Down

0 comments on commit 6cb33d5

Please sign in to comment.