reduce duplication and code improvements (#1707)

* reduce code duplication

* reduce duplication, fix license headers

* simplify code

* typings fixes

* update tests

* minor fixes

* markdown fixes

* revert changes
This commit is contained in:
Denys Vuika
2020-12-11 15:47:17 +00:00
committed by GitHub
parent b71e1530d1
commit 7a5350a06d
64 changed files with 482 additions and 744 deletions

View File

@@ -212,8 +212,7 @@ export function canDownloadSelection(context: RuleContext): boolean {
* JSON ref: `app.selection.folder`
*/
export function hasFolderSelected(context: RuleContext): boolean {
const folder = context.selection.folder;
return folder ? true : false;
return !!context.selection.folder;
}
/**
@@ -221,8 +220,7 @@ export function hasFolderSelected(context: RuleContext): boolean {
* JSON ref: `app.selection.library`
*/
export function hasLibrarySelected(context: RuleContext): boolean {
const library = context.selection.library;
return library ? true : false;
return !!context.selection.library;
}
/**
@@ -256,10 +254,7 @@ export function hasNoLibraryRole(context: RuleContext): boolean {
* JSON ref: `app.selection.file`
*/
export function hasFileSelected(context: RuleContext): boolean {
if (context && context.selection && context.selection.file) {
return true;
}
return false;
return !!(context && context.selection && context.selection.file);
}
/**