mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
tslint arrow-parens rule (#4003)
This commit is contained in:
@@ -105,8 +105,8 @@ export function reduceEmptyMenus(
|
||||
export function mergeObjects(...objects): any {
|
||||
const result = {};
|
||||
|
||||
objects.forEach(source => {
|
||||
Object.keys(source).forEach(prop => {
|
||||
objects.forEach((source) => {
|
||||
Object.keys(source).forEach((prop) => {
|
||||
if (!prop.startsWith('$')) {
|
||||
if (prop in result && Array.isArray(result[prop])) {
|
||||
// result[prop] = result[prop].concat(source[prop]);
|
||||
@@ -127,7 +127,7 @@ export function mergeArrays(left: any[], right: any[]): any[] {
|
||||
const result = [];
|
||||
const map = {};
|
||||
|
||||
(left || []).forEach(entry => {
|
||||
(left || []).forEach((entry) => {
|
||||
const element = entry;
|
||||
if (element && element.hasOwnProperty('id')) {
|
||||
map[element.id] = element;
|
||||
@@ -136,7 +136,7 @@ export function mergeArrays(left: any[], right: any[]): any[] {
|
||||
}
|
||||
});
|
||||
|
||||
(right || []).forEach(entry => {
|
||||
(right || []).forEach((entry) => {
|
||||
const element = entry;
|
||||
if (element && element.hasOwnProperty('id') && map[element.id]) {
|
||||
const merged = mergeObjects(map[element.id], element);
|
||||
|
@@ -23,7 +23,7 @@ export function not(context: RuleContext, ...args: RuleParameter[]): boolean {
|
||||
}
|
||||
|
||||
return args
|
||||
.every(arg => {
|
||||
.every((arg) => {
|
||||
const evaluator = context.getEvaluator(arg.value);
|
||||
if (!evaluator) {
|
||||
console.warn('evaluator not found: ' + arg.value);
|
||||
@@ -39,7 +39,7 @@ export function every(context: RuleContext, ...args: RuleParameter[]): boolean {
|
||||
}
|
||||
|
||||
return args
|
||||
.every(arg => {
|
||||
.every((arg) => {
|
||||
const evaluator = context.getEvaluator(arg.value);
|
||||
if (!evaluator) {
|
||||
console.warn('evaluator not found: ' + arg.value);
|
||||
@@ -55,7 +55,7 @@ export function some(context: RuleContext, ...args: RuleParameter[]): boolean {
|
||||
}
|
||||
|
||||
return args
|
||||
.some(arg => {
|
||||
.some((arg) => {
|
||||
const evaluator = context.getEvaluator(arg.value);
|
||||
if (!evaluator) {
|
||||
console.warn('evaluator not found: ' + arg.value);
|
||||
|
@@ -28,11 +28,12 @@ import { RuleRef } from '../config/rule.extensions';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ExtensionLoaderService {
|
||||
constructor(private http: HttpClient) {}
|
||||
constructor(private http: HttpClient) {
|
||||
}
|
||||
|
||||
load(configPath: string, pluginsPath: string): Promise<ExtensionConfig> {
|
||||
return new Promise<any>(resolve => {
|
||||
this.loadConfig(configPath, 0).then(result => {
|
||||
return new Promise<any>((resolve) => {
|
||||
this.loadConfig(configPath, 0).then((result) => {
|
||||
let config = result.config;
|
||||
|
||||
const override = sessionStorage.getItem('app.extension.config');
|
||||
@@ -45,11 +46,11 @@ export class ExtensionLoaderService {
|
||||
this.loadConfig(`${pluginsPath}/${name}`, idx)
|
||||
);
|
||||
|
||||
Promise.all(plugins).then(results => {
|
||||
Promise.all(plugins).then((results) => {
|
||||
const configs = results
|
||||
.filter(entry => entry)
|
||||
.filter((entry) => entry)
|
||||
.sort(sortByOrder)
|
||||
.map(entry => entry.config);
|
||||
.map((entry) => entry.config);
|
||||
|
||||
if (configs.length > 0) {
|
||||
config = mergeObjects(config, ...configs);
|
||||
@@ -58,7 +59,7 @@ export class ExtensionLoaderService {
|
||||
config = {
|
||||
...config,
|
||||
...this.getMetadata(result.config),
|
||||
$references: configs.map(ext => this.getMetadata(ext))
|
||||
$references: configs.map((ext) => this.getMetadata(ext))
|
||||
};
|
||||
|
||||
resolve(config);
|
||||
@@ -75,8 +76,8 @@ export class ExtensionLoaderService {
|
||||
|
||||
Object
|
||||
.keys(config)
|
||||
.filter(key => key.startsWith('$'))
|
||||
.forEach(key => {
|
||||
.filter((key) => key.startsWith('$'))
|
||||
.forEach((key) => {
|
||||
result[key] = config[key];
|
||||
});
|
||||
|
||||
@@ -87,15 +88,15 @@ export class ExtensionLoaderService {
|
||||
url: string,
|
||||
order: number
|
||||
): Promise<{ order: number; config: ExtensionConfig }> {
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve) => {
|
||||
this.http.get<ExtensionConfig>(url).subscribe(
|
||||
config => {
|
||||
(config) => {
|
||||
resolve({
|
||||
order,
|
||||
config
|
||||
});
|
||||
},
|
||||
error => {
|
||||
() => {
|
||||
resolve(null);
|
||||
}
|
||||
);
|
||||
|
@@ -65,7 +65,7 @@ describe('ExtensionService', () => {
|
||||
service.setup(blankConfig);
|
||||
|
||||
const evaluators = ['core.every', 'core.some', 'core.not'];
|
||||
evaluators.forEach(key => {
|
||||
evaluators.forEach((key) => {
|
||||
expect(service.getEvaluator(key)).toBeDefined(`Evaluator ${key} is missing`);
|
||||
});
|
||||
});
|
||||
|
@@ -85,17 +85,17 @@ export class ExtensionService {
|
||||
}
|
||||
|
||||
getRouteById(id: string): RouteRef {
|
||||
return this.routes.find(route => route.id === id);
|
||||
return this.routes.find((route) => route.id === id);
|
||||
}
|
||||
|
||||
getAuthGuards(ids: string[]): Array<Type<{}>> {
|
||||
return (ids || [])
|
||||
.map(id => this.authGuards[id])
|
||||
.filter(guard => guard);
|
||||
.map((id) => this.authGuards[id])
|
||||
.filter((guard) => guard);
|
||||
}
|
||||
|
||||
getActionById(id: string): ActionRef {
|
||||
return this.actions.find(action => action.id === id);
|
||||
return this.actions.find((action) => action.id === id);
|
||||
}
|
||||
|
||||
getEvaluator(key: string): RuleEvaluator {
|
||||
@@ -130,7 +130,7 @@ export class ExtensionService {
|
||||
}
|
||||
|
||||
getRuleById(id: string): RuleRef {
|
||||
return this.rules.find(ref => ref.id === id);
|
||||
return this.rules.find((ref) => ref.id === id);
|
||||
}
|
||||
|
||||
runExpression(value: string, context?: any) {
|
||||
|
Reference in New Issue
Block a user