0.1.2 • Published 6 years ago

static-extend v0.1.2

Weekly downloads
16,078,211
License
MIT
Repository
github
Last release
6 years ago

static-extend NPM version NPM downloads Build Status

Adds a static extend method to a class, to simplify inheritance. Extends the static properties, prototype properties, and descriptors from a Parent constructor onto Child constructors.

Install

Install with npm:

$ npm install static-extend --save

Usage

var extend = require('static-extend');

API

extend

Returns a function for extending the static properties, prototype properties, and descriptors from the Parent constructor onto Child constructors.

Params

  • Parent {Function}: Parent ctor
  • extendFn {Function}: Optional extend function for handling any necessary custom merging. Useful when updating methods that require a specific prototype.
  • Child {Function}: Child ctor
  • proto {Object}: Optionally pass additional prototype properties to inherit.
  • returns {Object}

Example

var extend = require('static-extend');
Parent.extend = extend(Parent);

// optionally pass a custom merge function as the second arg
Parent.extend = extend(Parent, function(Child) {
  Child.prototype.mixin = function(key, val) {
    Child.prototype[key] = val;
  };
});

// extend "child" constructors
Parent.extend(Child);

// optionally define prototype methods as the second arg
Parent.extend(Child, {
  foo: function() {},
  bar: function() {}
});

Contributing

This document was generated by verb-readme-generator (a verb generator), please don't edit directly. Any changes to the readme must be made in .verb.md. See Building Docs.

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. Or visit the verb-readme-generator project to submit bug reports or pull requests for the readme layout template.

Building docs

Generate readme and API documentation with verb:

$ npm install -g verb verb-readme-generator && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb, v0.9.0, on June 09, 2016.

class-utilsvuedragdropuploadimagespopsmart-common-authreact-native-bluetooth2killi8n-react-native-fast-imagern-send-smsspecify-importsbabel-specify-imports@icanpm/api-mastergew-nodejs-api-client@arisageha/react-lazyload@arisageha/react-lazyload-fix@cashremit/cr-streamline-iconsreact-native-template-rfbasecloud-archive-s3airscanairscan-examplebb-chatreact-native-esc-pos-sahaab@borisovart/atol-kkt-module@frxf/frxf@phil8795/pecuniarius-apideneme323112@texttree/demo-bsa-reference-rcl@fundefund/funde_ck@ntt_app/react-native-custom-notificationreact-native-custom-text-hwjamesreact-native-covid-sdkgql_din_mod@zebracompany/f_editora_react_reflux_demo@xswap/token-lists@xswap/v2-corebitgetbabyloniaiex-sdkjesusdemoka-flow.jsjs4cytoscapejs-utils-jll2l2forlernalq-server-climiguelcostero-ng2-toastynpmtest-05041npm-package-mentorchecknois-react-toastreact-native-plugpag-wrapperreact-native-pulsator-nativereact-native-kakao-mapsreact-native-twilio-voice-sdk-upgradereact-native-touch-id-namgyureact-native-thanh-toast-libraryreact-native-template-vifereact-native-test-module-hhhreact-native-template-nascam-templatereact-native-responsive-sizereact-native-sample-android-toast-version10react-native-modal-progress-barreact-native-brother-projectreact-misc-toolboxreact-native-android-advertising-idreact-native-biometric-authenticatereact-native-contact-listreact-native-flyyreact-native-dsphoto-modulereact-native-dm-playerreact-native-handcheque-enginereact-native-hlf-wrapperreact-native-is7react-native-version-managerregression-external-dtoresponsive-react-appreikamoon-string-library-aaprova-2-caroselloprova-cmpprova-cpm-2prova-cpm-3prova-cpm-4prompt-baseplaykit-js-hls-sondqplugin_test01qa_hddreact-angular-componentnative-kakao-loginnative-apple-loginnative-google-loginmncssminibaseng-search-dropdownsam-carouselsamc2samc3samc4samc5sdk-miniapp-vvrn-pdf-reader-offlinereact-native-ytximkitreact-redux-demo1react-picky-with-clearhexyun.helpers
0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago