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.
Installations
npm install static-extend
Developer
jonschlinkert
Developer Guide
Module System
CommonJS
Min. Node Version
>=0.10.0
Typescript Support
No
Node Version
6.2.0
NPM Version
3.8.9
Statistics
10 Stars
10 Commits
3 Forks
3 Watching
1 Branches
2 Contributors
Updated on 21 May 2020
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
4,227,528,026
Last day
-9.5%
2,590,003
Compared to previous day
Last week
2.8%
16,302,724
Compared to previous week
Last month
34%
60,640,623
Compared to previous month
Last year
-21.8%
615,240,769
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Dev Dependencies
2
static-extend
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:
1$ npm install static-extend --save
Usage
1var 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 ctorextendFn
{Function}: Optional extend function for handling any necessary custom merging. Useful when updating methods that require a specific prototype.Child
{Function}: Child ctorproto
{Object}: Optionally pass additional prototype properties to inherit.returns
{Object}
Example
1var extend = require('static-extend');
2Parent.extend = extend(Parent);
3
4// optionally pass a custom merge function as the second arg
5Parent.extend = extend(Parent, function(Child) {
6 Child.prototype.mixin = function(key, val) {
7 Child.prototype[key] = val;
8 };
9});
10
11// extend "child" constructors
12Parent.extend(Child);
13
14// optionally define prototype methods as the second arg
15Parent.extend(Child, {
16 foo: function() {},
17 bar: function() {}
18});
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:
1$ npm install -g verb verb-readme-generator && verb
Running tests
Install dev dependencies:
1$ 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.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
Found 0/10 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Score
3
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More