-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(partsGenerator): this new function will delay the part generation
This will help for label deduplication in the API
- Loading branch information
Showing
17 changed files
with
1,265 additions
and
131 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
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
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
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,15 @@ | ||
const _ = require('lodash'); | ||
|
||
function isRequired(labelPart) { | ||
return typeof labelPart === 'string' || labelPart.role === 'required'; | ||
} | ||
|
||
function getLabel(labelPart) { | ||
return typeof labelPart === 'string' ? labelPart : labelPart.label; | ||
} | ||
|
||
function uniq(labelParts) { | ||
return _.uniqWith(labelParts, (value, other) => getLabel(value) === getLabel(other)); | ||
} | ||
|
||
module.exports = { getLabel, isRequired, uniq }; |
Oops, something went wrong.