-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some lint issues and update airbnb
- Loading branch information
Showing
4 changed files
with
16 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import isFunction from './isFunction'; | ||
|
||
export default function (...args) { | ||
let result = []; | ||
for (let i = 0; i < args.length; i++) { | ||
const arg = args[i]; | ||
if (isFunction(arg)) result.push(arg); | ||
else if (Array.isArray(arg)) result = result.concat(arg.filter(isFunction)); | ||
} | ||
return result.length === 0 ? undefined : result; | ||
const functions = args.reduce((result, arg) => { | ||
if (isFunction(arg)) { | ||
return result.concat(arg); | ||
} else if (Array.isArray(arg)) { | ||
return result.concat(arg.filter(isFunction)); | ||
} | ||
return result; | ||
}, []); | ||
return functions.length === 0 ? undefined : functions; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters