File tree 1 file changed +21
-5
lines changed 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change 6
6
function isClass ( thing ) {
7
7
return typeof thing === 'function' && ! thing . hasOwnProperty ( 'arguments' )
8
8
}
9
+
10
+ function getOwnPropertyNames ( proto , stop ) {
11
+ let props = new Set ( ) ;
12
+ while ( proto && proto !== stop ) {
13
+ Object . getOwnPropertyNames ( proto ) . filter ( name => {
14
+ let c = Object . getOwnPropertyDescriptor ( proto , name ) ;
15
+ return ( c . get || c . set ) == undefined ;
16
+ } ) . forEach ( name => {
17
+ props . add ( name ) ;
18
+ } ) ;
19
+
20
+ let parentClass = Object . getPrototypeOf ( proto ) . constructor ;
21
+ if ( ! isClass ( parentClass ) || parentClass == Object ) {
22
+ break ;
23
+ }
24
+ proto = Object . getPrototypeOf ( proto ) ;
25
+ }
26
+ return [ ...props ] ;
27
+ }
28
+
9
29
module . exports = function ( ) {
10
30
let mod_patterns = {
11
31
bCtrl : / ^ c t r l $ / i,
153
173
}
154
174
155
175
let proxy = { }
156
- _ ( Object . getOwnPropertyNames ( template . prototype ) ) . filter ( ( name ) => {
157
- let c = Object . getOwnPropertyDescriptor ( template . prototype , name ) ;
158
- return ( c . get || c . set ) == undefined ;
159
- } )
160
- . forEach ( ( k ) => {
176
+ _ ( getOwnPropertyNames ( template . prototype ) ) . forEach ( ( k ) => {
161
177
if ( k == "properties" ) {
162
178
let func = String ( template . prototype [ k ] )
163
179
func = func . substr ( func . indexOf ( '{' ) + 1 )
You can’t perform that action at this time.
0 commit comments