File tree 1 file changed +20
-16
lines changed
1 file changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -18,31 +18,35 @@ global.tap = function (val, callback) {
18
18
* @param {* } val
19
19
* @param {Function } callback
20
20
*/
21
- Object . defineProperty ( Array . prototype , 'tap' , {
22
- value : function ( callback ) {
23
- if ( this . length ) {
24
- callback ( this ) ;
25
- }
21
+ if ( ! Array . prototype . hasOwnProperty ( 'tap' ) ) {
22
+ Object . defineProperty ( Array . prototype , 'tap' , {
23
+ value : function ( callback ) {
24
+ if ( this . length ) {
25
+ callback ( this ) ;
26
+ }
26
27
27
- return this ;
28
- }
29
- } ) ;
28
+ return this ;
29
+ }
30
+ } ) ;
31
+ }
30
32
31
33
/**
32
34
* Add wrap to arrays.
33
35
*
34
36
* @param {* } val
35
37
* @param {Function } callback
36
38
*/
37
- Object . defineProperty ( Array , 'wrap' , {
38
- value ( value ) {
39
- if ( Array . isArray ( value ) ) {
40
- return value ;
41
- }
39
+ if ( ! Array . hasOwnProperty ( 'wrap' ) ) {
40
+ Object . defineProperty ( Array , 'wrap' , {
41
+ value ( value ) {
42
+ if ( Array . isArray ( value ) ) {
43
+ return value ;
44
+ }
42
45
43
- return [ value ] ;
44
- }
45
- } ) ;
46
+ return [ value ] ;
47
+ }
48
+ } ) ;
49
+ }
46
50
47
51
/**
48
52
* Flatten the given array.
You can’t perform that action at this time.
0 commit comments