Skip to content

Commit

Permalink
feat: add implementation of splitSection function
Browse files Browse the repository at this point in the history
Closes #20
  • Loading branch information
ifedchankau authored and itekaf committed Jul 11, 2018
1 parent ba35b8a commit 20c3489
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@ const parseSection = (sectionName, help) => {
};

const splitSection = (section) => {
//TODO: create implementation
let split = [];
const regularExp = "\n[ \t]*";
let splitTmp = section.split(regularExp).slice(1);
let j = 0;
splitTmp.forEach(splitTmp => {
if (splitTmp.indexOf("-") === 0 && j > 0) {
split.push(splitTmp);
j++;
} else {
split[j - 1] = split[j - 1] + splitTmp;
}
});
return split;
};

Expand Down

0 comments on commit 20c3489

Please sign in to comment.