parent
60fa5dae29
commit
cde322bff8
|
@ -1748,6 +1748,7 @@ function printArgumentsList(path, options, print) {
|
|||
lastArg.body.type === "ArrowFunctionExpression" ||
|
||||
lastArg.body.type === "ObjectExpression" ||
|
||||
lastArg.body.type === "ArrayExpression" ||
|
||||
lastArg.body.type === "CallExpression" ||
|
||||
lastArg.body.type === "JSXElement") ||
|
||||
lastArg.type === "NewExpression";
|
||||
|
||||
|
|
|
@ -1,3 +1,41 @@
|
|||
exports[`test arrow.js 1`] = `
|
||||
"export default function searchUsers(action$) {
|
||||
return action$.ofType(ActionTypes.SEARCHED_USERS)
|
||||
.map(action => action.payload.query)
|
||||
.filter(q => !!q)
|
||||
.switchMap(q =>
|
||||
Observable.timer(800) // debounce
|
||||
.takeUntil(action$.ofType(ActionTypes.CLEARED_SEARCH_RESULTS))
|
||||
.mergeMap(() => Observable.merge(
|
||||
Observable.of(replace(\`?q=\${q}\`)),
|
||||
ajax.getJSON(\`https://api.github.com/search/users?q=\${q}\`)
|
||||
.map(res => res.items)
|
||||
.map(receiveUsers)
|
||||
))
|
||||
);
|
||||
};
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export default function searchUsers(action$) {
|
||||
return action$
|
||||
.ofType(ActionTypes.SEARCHED_USERS)
|
||||
.map(action => action.payload.query)
|
||||
.filter(q => !!q)
|
||||
.switchMap(q =>
|
||||
Observable
|
||||
.timer(800)
|
||||
.takeUntil(action$.ofType(ActionTypes.CLEARED_SEARCH_RESULTS))
|
||||
.mergeMap(() =>
|
||||
Observable.merge(
|
||||
Observable.of(replace(\`?q=\${q}\`)),
|
||||
ajax
|
||||
.getJSON(\`https://api.github.com/search/users?q=\${q}\`)
|
||||
.map(res => res.items)
|
||||
.map(receiveUsers)
|
||||
)));
|
||||
}
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test jsx.js 1`] = `
|
||||
"const els = items.map(item => (
|
||||
<div className=\"whatever\">
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
export default function searchUsers(action$) {
|
||||
return action$.ofType(ActionTypes.SEARCHED_USERS)
|
||||
.map(action => action.payload.query)
|
||||
.filter(q => !!q)
|
||||
.switchMap(q =>
|
||||
Observable.timer(800) // debounce
|
||||
.takeUntil(action$.ofType(ActionTypes.CLEARED_SEARCH_RESULTS))
|
||||
.mergeMap(() => Observable.merge(
|
||||
Observable.of(replace(`?q=${q}`)),
|
||||
ajax.getJSON(`https://api.github.com/search/users?q=${q}`)
|
||||
.map(res => res.items)
|
||||
.map(receiveUsers)
|
||||
))
|
||||
);
|
||||
};
|
Loading…
Reference in New Issue