Gathering detailed insights and metrics for babel-plugin-jsx-event-modifiers
Gathering detailed insights and metrics for babel-plugin-jsx-event-modifiers
Gathering detailed insights and metrics for babel-plugin-jsx-event-modifiers
Gathering detailed insights and metrics for babel-plugin-jsx-event-modifiers
Event modifiers syntactic sugar for JSX
npm install babel-plugin-jsx-event-modifiers
Typescript
Module System
Node Version
NPM Version
98.8
Supply Chain
99.6
Quality
75.3
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
38,153,272
Last Day
10,268
Last Week
66,070
Last Month
268,380
Last Year
3,363,458
MIT License
44 Stars
23 Commits
7 Forks
2 Watchers
2 Branches
2 Contributors
Updated on Aug 15, 2023
Minified
Minified + Gzipped
Latest Version
2.0.5
Package Id
babel-plugin-jsx-event-modifiers@2.0.5
Size
8.63 kB
NPM Version
5.3.0
Node Version
8.2.1
Published on
Aug 27, 2017
Cumulative downloads
Total Downloads
Last Day
4.9%
10,268
Compared to previous day
Last Week
2.8%
66,070
Compared to previous week
Last Month
-1.3%
268,380
Compared to previous month
Last Year
-22.6%
3,363,458
Compared to previous year
This babel plugin adds some syntactic sugar to JSX.
1npm i babel-plugin-jsx-event-modifiers -D
or
1yarn add babel-plugin-jsx-event-modifiers -D
Then add jsx-event-modifiers
to your .babelrc
file under plugins
example .babelrc:
1{ 2 "presets": ["es2015"], 3 "plugins": ["jsx-event-modifiers", "transform-vue-jsx"] 4}
Example:
1export default { 2 render () { 3 return ( 4 <input 5 onKeyup:up={this.methodForPressingUp} 6 onKeyup:down={this.methodForPressingDown} 7 onKeyup:bare-shift-enter={this.methodOnlyOnShiftEnter} 8 onKeyup:bare-alt-enter={this.methodOnlyOnAltEnter} 9 /> 10 ) 11 } 12}
will be transpiled into:
1export default { 2 render() { 3 return ( 4 <input 5 {...{ 6 on: { 7 keyup: [ 8 $event => { 9 if (!('button' in $event) && this._k($event.keyCode, 'up', 38)) return null 10 11 this.methodForPressingUp($event) 12 }, 13 $event => { 14 if (!('button' in $event) && this._k($event.keyCode, 'down', 40)) return null 15 16 this.methodForPressingDown($event) 17 }, 18 $event => { 19 if ( 20 ($event.ctrlKey && $event.altKey && $event.metaKey) || 21 !$event.shiftKey || 22 (!('button' in $event) && this._k($event.keyCode, 'enter', 13)) 23 ) 24 return null 25 26 this.methodOnlyOnShiftEnter($event) 27 }, 28 $event => { 29 if ( 30 ($event.ctrlKey && $event.shiftKey && $event.metaKey) || 31 !$event.altKey || 32 (!('button' in $event) && this._k($event.keyCode, 'enter', 13)) 33 ) 34 return null 35 36 this.methodOnlyOnAltEnter($event) 37 }, 38 ], 39 }, 40 }} 41 /> 42 ) 43 }, 44} 45 46
Vue template:
1<input 2 @keyup.up="methodForPressingUp" 3 @keyup.down="methodForPressingDown" 4 @keyup.bare.shift.enter="methodOnlyOnShiftEnter" 5 @keyup.bare.alt.enter="methodOnlyOnAltEnter" 6 @keyup.120="onPressKey120('some', 'arguments')" 7>
JSX:
1<input 2 onKeyup:up={this.methodForPressingUp} 3 onKeyup:down={this.methodForPressingDown} 4 onKeyup:bare-shift-enter={this.methodOnlyOnShiftEnter} 5 onKeyup:bare-alt-enter={this.methodOnlyOnAltEnter} 6 onKeyup:k120={() => this.onPressKey120('some', 'arguments')} 7/>
:
and separated by -
(in vue: prefixed by .
and separated by .
)k
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/23 approved changesets -- score normalized to 0
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
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
50 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-19
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