Gathering detailed insights and metrics for auto-bind-inheritance
Gathering detailed insights and metrics for auto-bind-inheritance
Gathering detailed insights and metrics for auto-bind-inheritance
Gathering detailed insights and metrics for auto-bind-inheritance
Automatically bind methods to their class instance and works on parent methods.
npm install auto-bind-inheritance
Typescript
Module System
Node Version
NPM Version
89.1
Supply Chain
99.6
Quality
75.5
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
294,527
Last Day
122
Last Week
12,404
Last Month
62,389
Last Year
152,456
MIT License
4 Stars
8 Commits
1 Forks
2 Watchers
1 Branches
1 Contributors
Updated on Sep 07, 2018
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
205%
122
Compared to previous day
Last Week
-9.5%
12,404
Compared to previous week
Last Month
-2.1%
62,389
Compared to previous month
Last Year
917.9%
152,456
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
5 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-06-30
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