@@ -21,7 +21,7 @@ const _ = module.exports = {
21
21
isFinite : int => isFinite ( int ) && ! isNaN ( parseFloat ( int ) ) ,
22
22
23
23
// Parse string to number. Returns NaN if string can't be parsed to number..
24
- toNumber : ( num , precision ) => {
24
+ toNumber ( num , precision ) {
25
25
if ( num === null ) {
26
26
return 0 ;
27
27
}
@@ -45,13 +45,13 @@ const _ = module.exports = {
45
45
isJustinfan : username => justinFanRegex . test ( username ) ,
46
46
47
47
// Return a valid channel name..
48
- channel : str => {
48
+ channel ( str ) {
49
49
const channel = ( str ? str : '' ) . toLowerCase ( ) ;
50
50
return channel [ 0 ] === '#' ? channel : '#' + channel ;
51
51
} ,
52
52
53
53
// Return a valid username..
54
- username : str => {
54
+ username ( str ) {
55
55
const username = ( str ? str : '' ) . toLowerCase ( ) ;
56
56
return username [ 0 ] === '#' ? username . slice ( 1 ) : username ;
57
57
} ,
@@ -60,15 +60,15 @@ const _ = module.exports = {
60
60
token : str => str ? str . toLowerCase ( ) . replace ( 'oauth:' , '' ) : '' ,
61
61
62
62
// Return a valid password..
63
- password : str => {
63
+ password ( str ) {
64
64
const token = _ . token ( str ) ;
65
65
return token ? `oauth:${ token } ` : '' ;
66
66
} ,
67
67
68
68
actionMessage : msg => msg . match ( actionMessageRegex ) ,
69
69
70
70
// Replace all occurences of a string using an object..
71
- replaceAll : ( str , obj ) => {
71
+ replaceAll ( str , obj ) {
72
72
if ( str === null || typeof str === 'undefined' ) {
73
73
return null ;
74
74
}
@@ -87,7 +87,7 @@ const _ = module.exports = {
87
87
88
88
// Escaping values:
89
89
// http://ircv3.net/specs/core/message-tags-3.2.html#escaping-values
90
- unescapeIRC : msg => {
90
+ unescapeIRC ( msg ) {
91
91
if ( ! msg || typeof msg !== 'string' || ! msg . includes ( '\\' ) ) {
92
92
return msg ;
93
93
}
@@ -97,7 +97,7 @@ const _ = module.exports = {
97
97
) ;
98
98
} ,
99
99
100
- escapeIRC : msg => {
100
+ escapeIRC ( msg ) {
101
101
if ( ! msg || typeof msg !== 'string' ) {
102
102
return msg ;
103
103
}
@@ -111,7 +111,7 @@ const _ = module.exports = {
111
111
addWord : ( line , word ) => line . length ? line + ' ' + word : line + word ,
112
112
113
113
// Split a line but try not to cut a word in half..
114
- splitLine : ( input , length ) => {
114
+ splitLine ( input , length ) {
115
115
let lastSpace = input . substring ( 0 , length ) . lastIndexOf ( ' ' ) ;
116
116
// No spaces found, split at the very end to avoid a loop..
117
117
if ( lastSpace === - 1 ) {
@@ -121,7 +121,7 @@ const _ = module.exports = {
121
121
} ,
122
122
123
123
// Extract a number from a string..
124
- extractNumber : str => {
124
+ extractNumber ( str ) {
125
125
const parts = str . split ( ' ' ) ;
126
126
for ( let i = 0 ; i < parts . length ; i ++ ) {
127
127
if ( _ . isInteger ( parts [ i ] ) ) {
@@ -132,7 +132,7 @@ const _ = module.exports = {
132
132
} ,
133
133
134
134
// Format the date..
135
- formatDate : date => {
135
+ formatDate ( date ) {
136
136
let hours = date . getHours ( ) ;
137
137
let mins = date . getMinutes ( ) ;
138
138
@@ -142,7 +142,7 @@ const _ = module.exports = {
142
142
} ,
143
143
144
144
// Inherit the prototype methods from one constructor into another..
145
- inherits : ( ctor , superCtor ) => {
145
+ inherits ( ctor , superCtor ) {
146
146
ctor . super_ = superCtor ;
147
147
const TempCtor = function ( ) { } ;
148
148
TempCtor . prototype = superCtor . prototype ;
@@ -151,7 +151,7 @@ const _ = module.exports = {
151
151
} ,
152
152
153
153
// Return whether inside a Node application or not..
154
- isNode : ( ) => {
154
+ isNode ( ) {
155
155
try {
156
156
return typeof process === 'object' &&
157
157
Object . prototype . toString . call ( process ) === '[object process]' ;
0 commit comments