This repository was archived by the owner on Jul 17, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ function giveVoice ( id, cb ) {
37
37
} ) ;
38
38
39
39
function finish ( ) {
40
- var args = [ ] . slice . call ( arguments ) ;
40
+ var args = Array . from ( arguments ) ;
41
41
args . unshift ( id ) ;
42
42
43
43
delete muted [ id ] ;
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ function substitute ( msg ) {
48
48
}
49
49
50
50
function get_matching_message ( re , onlyBefore ) {
51
- var messages = [ ] . slice . call (
51
+ var messages = Array . from (
52
52
document . getElementsByClassName ( 'content' ) ) . reverse ( ) ;
53
53
return messages . first ( matches ) ;
54
54
Original file line number Diff line number Diff line change @@ -26,11 +26,16 @@ Object.TruthMap = function ( props ) {
26
26
}
27
27
} ;
28
28
29
+ //turns a pseudo-array (like arguments) into a real array
30
+ Array . from = function ( arrayLike , start ) {
31
+ return [ ] . slice . call ( arrayLike , start ) ;
32
+ } ;
33
+
29
34
//SO chat uses an unfiltered for...in to iterate over an array somewhere, so
30
35
// that I have to use Object.defineProperty to make these non-enumerable
31
36
Object . defineProperty ( Array . prototype , 'invoke' , {
32
37
value : function ( funName ) {
33
- var args = [ ] . slice . call ( arguments , 1 ) ;
38
+ var args = Array . from ( arguments , 1 ) ;
34
39
35
40
return this . map ( invoke ) ;
36
41
@@ -151,7 +156,7 @@ Function.prototype.memoizeAsync = function ( hasher ) {
151
156
hasher = hasher || function ( x ) { return x ; } ;
152
157
153
158
return function memoized ( ) {
154
- var args = [ ] . slice . call ( arguments ) ,
159
+ var args = Array . from ( arguments ) ,
155
160
cb = args . pop ( ) , //HEAVY assumption that cb is always passed last
156
161
hash = hasher . apply ( null , arguments ) ;
157
162
You can’t perform that action at this time.
0 commit comments