medikoo / medikoo/dbjs

Ensure 'super' in methods and getters

Open
#71 0 comments 0 reactions 1 assignee View on GitHub

@medikoo is already working on this.

Since Jul 21, 2016.

Dominant language
JavaScript
Stars
27
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Not sure if we can rely on native super, it's likely it can't be the case, then I imagine it as:

this.super('methodName')();

Where internal implementation could be similar to:

Base.prototype.super = function (propName) {
  var currentObject = this, superObject, superValue;
  while (!currentObject.hasOwnProperty(propName)) {
    currentObject = Object.getPrototypeOf(currentObject);
    if (!currentObject) return;
  }
  superObject = Object.getPrototypeOf(currentObject);
  if (!superObject) return;
  superValue = superObject[propName]; // TODO: Take into account getter case
  if (typeof superValue === 'function') superValue = Function.prototype.bind.call(superValue, this);
  return superValue;
};

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.