This is an automated email from the ASF dual-hosted git repository. huxing pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-js.git
The following commit(s) were added to refs/heads/master by this push: new 4f5f63c use prettier to format setting module new 5558d6e Merge pull request #111 from hufeng/master 4f5f63c is described below commit 4f5f63c7927377eab75ade3a88d7de3c6b50c4ba Author: hufeng <huf...@qianmi.com> AuthorDate: Tue May 21 10:54:03 2019 +0800 use prettier to format setting module --- packages/dubbo/src/setting/index.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/dubbo/src/setting/index.ts b/packages/dubbo/src/setting/index.ts index 7f25d9c..d55be29 100644 --- a/packages/dubbo/src/setting/index.ts +++ b/packages/dubbo/src/setting/index.ts @@ -27,10 +27,10 @@ const log = debug('dubbo:dubbo-setting'); * 多么想要一个ReasonML的match-pattern 😆 */ export class Setting { - private readonly _rules: Map<string, Array<IRule>> = new Map<string, Array<IRule>>() - .set("Array", new Array<IRule>()) - .set("RegExp", new Array<IRule>()) - .set("TPredictFunction", new Array<IRule>()); + private readonly _rules: Map<string, Array<IRule>> = new Map() + .set('Array', new Array<IRule>()) + .set('RegExp', new Array<IRule>()) + .set('TPredictFunction', new Array<IRule>()); private _cache: Map<string, IDubboSetting> = new Map(); /** @@ -51,13 +51,13 @@ export class Setting { log('add match rule %j', rule); if (isString(arg)) { rule.condition = [arg]; - this._rules.get("Array").push(rule); + this._rules.get('Array').push(rule); } else if (isArray(arg)) { - this._rules.get("Array").push(rule); + this._rules.get('Array').push(rule); } else if (isFn(arg)) { - this._rules.get("TPredictFunction").push(rule); + this._rules.get('TPredictFunction').push(rule); } else if (isRegExp(arg)) { - this._rules.get("RegExp").push(rule); + this._rules.get('RegExp').push(rule); } return this; } @@ -69,7 +69,7 @@ export class Setting { } let matchedRule = null; if (!matchedRule) { - for (let rule of this._rules.get("Array")) { + for (let rule of this._rules.get('Array')) { if (isArray(rule.condition) && rule.condition.indexOf(dubboInterface)) { matchedRule = rule; break; @@ -77,7 +77,7 @@ export class Setting { } } if (!matchedRule) { - for (let rule of this._rules.get("TPredictFunction")) { + for (let rule of this._rules.get('TPredictFunction')) { if (isFn(rule.condition) && rule.condition(dubboInterface)) { matchedRule = rule; break; @@ -86,7 +86,7 @@ export class Setting { } if (!matchedRule) { - for (let rule of this._rules.get("RegExp")) { + for (let rule of this._rules.get('RegExp')) { if (isRegExp(rule.condition) && rule.condition.test(dubboInterface)) { matchedRule = rule; break; @@ -95,10 +95,10 @@ export class Setting { } if (matchedRule) { log( - '%s =match=> rule %s result=> %j', - dubboInterface, - matchedRule.condition, - matchedRule.dubboSetting, + '%s =match=> rule %s result=> %j', + dubboInterface, + matchedRule.condition, + matchedRule.dubboSetting, ); this._cache.set(dubboInterface, matchedRule.dubboSetting); return matchedRule.dubboSetting;