File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class Contacts {
15
15
* @throws {Error } If contact contains more than one organization component
16
16
*/
17
17
constructor ( ...contact ) {
18
- if ( ! contact ? .length ) throw new Error ( "Contacts must have at least one contact" ) ;
18
+ if ( ! contact . length ) throw new Error ( "Contacts must have at least one contact" ) ;
19
19
20
20
this . contacts = [ ] ;
21
21
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ class ActionList {
134
134
constructor ( button , ...sections ) {
135
135
if ( ! button ) throw new Error ( "Action must have a button content" ) ;
136
136
if ( button . length > 20 ) throw new Error ( "Button content must be 20 characters or less" ) ;
137
- if ( ! sections ? .length || sections . length > 10 ) throw new Error ( "Action must have between 1 and 10 sections" ) ;
137
+ if ( ! sections . length || sections . length > 10 ) throw new Error ( "Action must have between 1 and 10 sections" ) ;
138
138
if ( sections . length > 1 ) sections . forEach ( s => { if ( ! s . title ) throw new Error ( "Sections must have a title if more than 1 section is provided" ) } ) ;
139
139
140
140
this . _ = "list" ;
@@ -160,7 +160,7 @@ class Section {
160
160
*/
161
161
constructor ( title , ...rows ) {
162
162
if ( title && title . length > 24 ) throw new Error ( "Section title must be 24 characters or less" ) ;
163
- if ( ! rows ? .length || rows . length > 10 ) throw new Error ( "Section must have between 1 and 10 rows" ) ;
163
+ if ( ! rows . length || rows . length > 10 ) throw new Error ( "Section must have between 1 and 10 rows" ) ;
164
164
165
165
if ( title ) this . title = title ;
166
166
this . rows = rows ;
@@ -216,7 +216,7 @@ class ActionButtons {
216
216
* @throws {Error } If two or more buttons have the same title
217
217
*/
218
218
constructor ( ...button ) {
219
- if ( ! button ? .length || button . length > 3 ) throw new Error ( "Reply buttons must have between 1 and 3 buttons" ) ;
219
+ if ( ! button . length || button . length > 3 ) throw new Error ( "Reply buttons must have between 1 and 3 buttons" ) ;
220
220
221
221
// Find if there are duplicates in button.id
222
222
const ids = button . map ( b => b [ b . type ] . id ) ;
Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ class ButtonComponent {
124
124
*/
125
125
constructor ( sub_type , ...parameters ) {
126
126
if ( ! [ "url" , "quick_reply" ] . includes ( sub_type ) ) throw new Error ( "ButtonComponent sub_type must be either 'url' or 'quick_reply'" ) ;
127
- if ( ! parameters ? .length ) throw new Error ( "ButtonComponent must have at least 1 parameter" ) ;
127
+ if ( ! parameters . length ) throw new Error ( "ButtonComponent must have at least 1 parameter" ) ;
128
128
if ( parameters . length > 3 ) throw new Error ( "ButtonComponent can only have up to 3 parameters" ) ;
129
129
130
130
const buttonType = sub_type === "url" ? "text" : "payload" ;
You can’t perform that action at this time.
0 commit comments