0

I need some functionality that works like Ruby's method missing. I have searched and only found 2 ways:

  1. noSuchMethod: Only available to Mozilla Firefox, and I think it's deprecated or something.
  2. ES6 proxys: Not yet implemented in Chrome, which is a major browser, and partialy implemented in other major ones as per: https://kangax.github.io/compat-table/es6/.

I was thinking in proxies but is a major drawback if isn't supported by Chrome, and if it's not supported by chrome, probably not for NodeJS either.

Any idea how to implement this feature? maybe a library or plain JS prototyping?

NM Pennypacker
  • 6,704
  • 11
  • 36
  • 38

1 Answers1

1

This is not possible without a language level feature like proxies or noSuchMethod. The prototype chain suffers from the same problem that any other solution does in that there is no generic way of handling calls to missing methods/properties on an object.

Nick Tomlin
  • 28,402
  • 11
  • 61
  • 90