Skip to content

Commit b4c91ec

Browse files
author
Igor Canedo
committed
refactoring navigate function
1 parent 65d8d76 commit b4c91ec

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/loadAttributes.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,8 @@ const loadAttributes = (
3131
entityRanges: Array<Object>,
3232
entityMap: Object,
3333
navigate?: Function): any => {
34-
let navigateFunction;
35-
if (navigate) {
36-
navigateFunction = navigate;
37-
} else {
38-
navigateFunction = (url: string) => {
39-
Linking.openURL(url);
40-
};
41-
}
34+
const defaultNavigationFn = (url: string) => { Linking.openURL(url); };
35+
const navigateFunction = navigate || defaultNavigationFn;
4236
const elementList = [];
4337
let attributes = inlineStyles ? inlineStyles.concat(entityRanges) : entityRanges;
4438
attributes = attributes.sort((a: Object, b: Object): number => a.offset - b.offset);

0 commit comments

Comments
 (0)