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:
tuyuribr
2021-12-10 16:47:07 -03:00
committed by GitHub
parent c55db82f73
commit 2052e0479d

View File

@@ -57,7 +57,7 @@ class List {
*/
_format(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) =>{
if(!section.rows.length){throw '[LT03] Section without rows';}
return {
@@ -76,4 +76,4 @@ class List {
}
module.exports = List;
module.exports = List;