GithubHelp home page GithubHelp logo

taras / get-prototype-descriptors Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 3.39 MB

Returns descriptors from constructor's prototype chain

Home Page: https://runkit.com/taras/get-prototype-descriptors

License: MIT License

JavaScript 100.00%

get-prototype-descriptors's Introduction

get-prototype-descriptors

Build Status npm version Greenkeeper badge

Returns all descriptors of a prototype chain while respecting prototype inheritance.

Installation

npm install --save get-prototype-descriptors

Usage

class A {
  one() {}
  get getterOnA() {
    return 'A';
  }
}

class B extends A {
  two() {}
  get getterOnA() {
    return 'B';
  }
}

class C extends B {
  three() {}
  get getterOnC() {
    return 'C'
  }
}

import getPrototypeDescriptors from 'get-prototype-descriptors';

let descriptors = getPrototypeDescriptors(C);

The descriptors will be flattened and descriptors from child classes will overload those of the parent.

Compatibility

get-prototype-descriptors requires Object.getOwnPropertyDescriptors which is not available in IE and pre-Node 6. You may consider adding a polyfill if you need to support these environments.

License

MIT License

get-prototype-descriptors's People

Contributors

greenkeeper[bot] avatar taras avatar

Stargazers

berstend̡̲̫̹̠̖͚͓̔̄̓̐̄͛̀͘ avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.