From 8bc3365ef49781b7d34d6228fe29a39266ff4d95 Mon Sep 17 00:00:00 2001 From: WEBER Logan Date: Sun, 29 Jul 2018 13:15:47 +0200 Subject: [PATCH] style(frame): encodeBytes/decodeBytes function names are flipped --- src/frame.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/frame.ts b/src/frame.ts index 315851c..97a3ca8 100644 --- a/src/frame.ts +++ b/src/frame.ts @@ -31,11 +31,11 @@ const removeDuplicate = (_: any, idx: number, frame: number[][]): boolean => { return first !== 0x2 } -const encodeBytes = (bytesPair: [number, number]): number => { +const decodeBytes = (bytesPair: [number, number]): number => { return bytesPair[0] === 0x2 ? bytesPair[1] ^ 0x10 : bytesPair[0] } -// const decodeByte = (byte: number): number[] => { +// const encodeByte = (byte: number): number[] => { // return byte >= 0x10 ? [byte] : [0x2, byte ^ 0x10] // } @@ -55,7 +55,7 @@ const decodeFrame = (frame: Buffer): Buffer => { const arrFrame = Array.from(frame) .map(combineBytes) .filter(removeDuplicate) - .map(encodeBytes) + .map(decodeBytes) return Buffer.from(arrFrame) } @@ -63,7 +63,7 @@ const decodeFrame = (frame: Buffer): Buffer => { // const encodeFrame = (frame: Buffer): Buffer => { // const arrFrame = Array // .from(frame) -// .flatMap(decodeByte) +// .flatMap(encodeByte) // // return Buffer.from(arrFrame); // }