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

Use Proxy for CasedObject getters #12

Open
replygirl opened this issue Sep 5, 2020 · 0 comments
Open

Use Proxy for CasedObject getters #12

replygirl opened this issue Sep 5, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@replygirl
Copy link
Owner

Return a Proxy from each getter with something like:

class CasedObject {

  // ...

  public get options() { return this.proxied('_options') }

  // ...

  public get value() { return this.proxied('_value') }

  // ...

  private proxied(p: string) {
    return new Proxy([this[p], {
      get: (_x, k) => this[p][k],
      set: (_x, k, v) => this[p] = { ...this[p], [k]: v }
    }])
  }

  // ...

}
@replygirl replygirl added the enhancement New feature or request label Sep 5, 2020
@replygirl replygirl changed the title Use Proxy Use Proxy for CasedObject getters Sep 5, 2020
@replygirl replygirl changed the title Use Proxy for CasedObject getters Use Proxy for CasedObject getters Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant