Skip to content

Conversation

@liborm85
Copy link
Contributor

Fixes #28

@blikblum
Copy link
Member

Hi i take a look at the code and it can be simplified a bit:

constructor(type, versions = {}) {
    super();
    this.type = type;    
    this.versions = versions;
  }

  decode(stream, parent, length = 0) {    
    const res = this._setup(stream, parent, length);

    if (typeof this.type === 'string') {
      res.version = parent[this.type];
    } else {
      res.version = this.type.decode(stream);
    }

Instead of calling versionGetter method, do the operation inline. versionSetter is not used at all.

Did not test because internet connection is far from great where i am.

Feel free to use it

@liborm85
Copy link
Contributor Author

New PR #37
Tests passed. Thanks.

@liborm85 liborm85 closed this Apr 18, 2020
@liborm85 liborm85 deleted the csp-fix branch April 18, 2020 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unusable with CSP directives

3 participants