Gathering detailed insights and metrics for auto-bind-inheritance
Gathering detailed insights and metrics for auto-bind-inheritance
npm install auto-bind-inheritance
Typescript
Module System
Node Version
NPM Version
72.1
Supply Chain
98.9
Quality
75.5
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
162,083
Last Day
152
Last Week
588
Last Month
2,595
Last Year
26,761
4 Stars
8 Commits
1 Forks
2 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.6
Package Id
auto-bind-inheritance@1.0.6
Size
3.13 kB
NPM Version
5.5.1
Node Version
8.5.0
Cumulative downloads
Total Downloads
Last day
27.7%
152
Compared to previous day
Last week
-18.1%
588
Compared to previous week
Last month
20.1%
2,595
Compared to previous month
Last year
125.5%
26,761
Compared to previous year
Automatically bind methods to their class instance and works on parent methods.
This package was created directly as a result of failing on extended classes in the auto-bind package.
There are issues with getters which are initialized in the constructor:
$ npm install --save auto-bind-inheritance
1// const autoBind = require('auto-bind'); // drop-in replacement 2const autoBindI = require('auto-bind-inheritance'); 3 4class A { 5 constructor() { 6 this.val = 'A'; 7 autoBindI(this); 8 } 9 method2() { console.log('A.method2 ', this.val); } 10} 11 12class B extends A { 13 constructor() { 14 super(); 15 this.val = 'B'; 16 } 17 method1() { console.log('B.method1 ', this.val); } 18} 19 20 21let a = new A(); 22let b = new B(); 23 24 25b.method1(); 26b.method2(); 27let mb1 = b.method1; 28let mb2 = b.method2; 29console.log(mb1.name); 30console.log(mb2.name); 31mb1(); 32mb2(); 33 34 35// With `autoBind(this)`, the above could have resulted in: 36//=> 'B.method1 B' 37//=> 'A.method2 B' 38//=> 'bound bound method1' 39//=> 'method2' 40//=> 'B.method1 B' 41//=> 'exception "Cannot read property 'val' of undefined"' 42 43// With `autoBindI(this)`, the above now correctly results in bound and callable methods: 44//=> 'B.method1 B' 45//=> 'A.method2 B' 46//=> 'bound method1' 47//=> 'bound method2' 48//=> 'B.method1 B' 49//=> 'A.method2 B' 50 51 52
Bind methods in self
to their class instance. Returns the self
object. Can be placed in the parent and will be call on all child classes because the prototype chain has already been created.
Type: Object
Object with methods to bind.
MIT © Chad Wingrave
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
4 existing vulnerabilities detected
Details
Reason
Found 0/8 approved changesets -- score normalized to 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
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-01-27
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