Inline _ or $ in the root of a method chain (#4621)

master
Lucas Duailibe 2018-06-01 12:51:06 -03:00 committed by GitHub
parent 26b13b6274
commit a4da6e6c8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 3 deletions

View File

@ -4440,10 +4440,11 @@ function printMemberChain(path, options, print) {
// .map(x => x)
//
// In order to detect those cases, we use an heuristic: if the first
// node is an identifier with the name starting with a capital letter.
// The rationale is that they are likely to be factories.
// node is an identifier with the name starting with a capital
// letter or just a sequence of _$. The rationale is that they are
// likely to be factories.
function isFactory(name) {
return /^[A-Z]/.test(name);
return /^[A-Z]|^[_$]+$/.test(name);
}
// In case the Identifier is shorter than tab width, we can keep the

View File

@ -607,6 +607,16 @@ Object.keys(
.forEach(locale => {
// ...
});
this.layoutPartsToHide = this.utils.hashset(
_.flatMap(this.visibilityHandlers, fn => fn())
.concat(this.record.resolved_legacy_visrules)
.filter(Boolean)
);
var jqxhr = $.ajax("example.php")
.done(doneFn)
.fail(failFn);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Object.keys(
availableLocales({
@ -616,6 +626,16 @@ Object.keys(
// ...
});
this.layoutPartsToHide = this.utils.hashset(
_.flatMap(this.visibilityHandlers, fn => fn())
.concat(this.record.resolved_legacy_visrules)
.filter(Boolean)
);
var jqxhr = $.ajax("example.php")
.done(doneFn)
.fail(failFn);
`;
exports[`logical.js 1`] = `

View File

@ -6,3 +6,13 @@ Object.keys(
.forEach(locale => {
// ...
});
this.layoutPartsToHide = this.utils.hashset(
_.flatMap(this.visibilityHandlers, fn => fn())
.concat(this.record.resolved_legacy_visrules)
.filter(Boolean)
);
var jqxhr = $.ajax("example.php")
.done(doneFn)
.fail(failFn);