Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for new Function calls #36

Closed
wants to merge 1 commit into from
Closed

Fix for new Function calls #36

wants to merge 1 commit into from

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
2 participants