This repository has been archived by the owner on Jun 30, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stacks are created without unnecessary sequences
a single level stack is now just a level and a a single item in single level stack is now just an item this makes the YAML less verbose
- Loading branch information
1 parent
7715827
commit c81c2fc
Showing
4 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...IdentifierOrItemOrLevelOrAddWhenStack/createLevelMap/getStackOrSingleLevelOrSingleItem.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module.exports = | ||
stack => { | ||
return whenSingleLevel() || stack; | ||
|
||
function whenSingleLevel() { | ||
return ( | ||
stack.length === 1 | ||
&& | ||
getLevelOrSingleItem(stack[0]) | ||
); | ||
} | ||
}; | ||
|
||
function getLevelOrSingleItem( | ||
level, | ||
) { | ||
return whenSingleItem() || level; | ||
|
||
function whenSingleItem() { | ||
return ( | ||
level.length === 1 | ||
&& | ||
level[0] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters