@leofcoin/codec-format-interface 1.6.14 → 1.6.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ export default class CodecHash extends BasicInterface {
7
7
  size: number;
8
8
  constructor(buffer: any, options?: {
9
9
  name: string;
10
- codecs: {};
10
+ codecs?: {};
11
11
  });
12
12
  init(uint8Array: any): Promise<this>;
13
13
  get prefix(): Uint8Array;
package/dist/index.js CHANGED
@@ -36,11 +36,11 @@ let BasicInterface$1 = class BasicInterface {
36
36
  // get Codec(): Codec {}
37
37
  protoEncode(data) {
38
38
  // check schema
39
- return proto.encode(this.proto, data);
39
+ return proto.encode(this.proto, data, false);
40
40
  }
41
41
  protoDecode(data) {
42
42
  // check schema
43
- return proto.decode(this.proto, data);
43
+ return proto.decode(this.proto, data, false);
44
44
  }
45
45
  isHex(string) {
46
46
  return isHex(string);
@@ -412,7 +412,7 @@ let FormatInterface$1 = class FormatInterface extends BasicInterface$1 {
412
412
  * @return {PeernetHash}
413
413
  */
414
414
  get peernetHash() {
415
- return new CodecHash$1(this.decoded, { name: this.name });
415
+ return new CodecHash$1(this.encoded, { name: this.name });
416
416
  }
417
417
  /**
418
418
  * @return {peernetHash}
@@ -437,14 +437,7 @@ let FormatInterface$1 = class FormatInterface extends BasicInterface$1 {
437
437
  const decoded = {};
438
438
  if (this.keys?.length > 0) {
439
439
  for (const key of this.keys) {
440
- Object.defineProperties(decoded, {
441
- [key]: {
442
- enumerable: true,
443
- configurable: true,
444
- set: (value) => data[key],
445
- get: () => data[key]
446
- }
447
- });
440
+ decoded[key] = data[key];
448
441
  }
449
442
  this.decoded = decoded;
450
443
  return this.encode(decoded);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/codec-format-interface",
3
- "version": "1.6.14",
3
+ "version": "1.6.16",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {