mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 04:29:15 +00:00
Fix: multiple list sections (#1004)
* Fix multiple list sections * singleQuotes * Update src/structures/List.js Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
This commit is contained in:
@@ -57,7 +57,7 @@ class List {
|
|||||||
*/
|
*/
|
||||||
_format(sections){
|
_format(sections){
|
||||||
if(!sections.length){throw '[LT02] List without sections';}
|
if(!sections.length){throw '[LT02] List without sections';}
|
||||||
if(sections.length > 1){throw '[LT05] Lists with more than one section are having problems';}
|
if(sections.length > 1 && sections.filter(s => typeof s.title == 'undefined').length > 1){throw '[LT05] You can\'t have more than one empty title.';}
|
||||||
return sections.map( (section) =>{
|
return sections.map( (section) =>{
|
||||||
if(!section.rows.length){throw '[LT03] Section without rows';}
|
if(!section.rows.length){throw '[LT03] Section without rows';}
|
||||||
return {
|
return {
|
||||||
@@ -76,4 +76,4 @@ class List {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = List;
|
module.exports = List;
|
||||||
|
|||||||
Reference in New Issue
Block a user