Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit 7ebe264

Browse files
committed
Simplified code.
1 parent cf6e53e commit 7ebe264

File tree

1 file changed

+16
-40
lines changed

1 file changed

+16
-40
lines changed

index.js

Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -40,50 +40,26 @@ const parser = (content, filename) =>
4040
}, ''),
4141
'tags': {
4242
'example': curr.tags.filter(tag => tag.type === 'example')
43-
.reduce((prev, curr) => {
44-
45-
prev.push(curr.string);
46-
47-
return prev;
48-
49-
}, []),
43+
.map(tag => tag.string),
5044
'param': curr.tags.filter(tag => tag.type === 'param')
51-
.reduce((prev, curr) => {
52-
53-
prev.push({
54-
'name': formatStringForParam(curr.name),
55-
'isOptional': curr.optional,
56-
'types': curr.types,
57-
'description': curr.description
58-
});
59-
60-
return prev;
61-
62-
}, []),
45+
.map(tag => ({
46+
'name': formatStringForParam(tag.name),
47+
'isOptional': tag.optional,
48+
'types': tag.types,
49+
'description': tag.description
50+
})),
6351
'property': curr.tags.filter(tag => tag.type === 'property')
64-
.reduce((prev, curr) => {
65-
66-
prev.push({
67-
'name': curr.name,
68-
'types': curr.types,
69-
'description': curr.description
70-
});
71-
72-
return prev;
73-
74-
}, []),
52+
.map(tag => ({
53+
'name': tag.name,
54+
'types': tag.types,
55+
'description': tag.description
56+
})),
7557
'return': curr.tags.filter(tag =>
7658
tag.type === 'return' || tag.type === 'returns')
77-
.reduce((prev, curr) => {
78-
79-
prev.push({
80-
'types': curr.types,
81-
'description': curr.description
82-
});
83-
84-
return prev;
85-
86-
}, [])
59+
.map(tag => ({
60+
'types': tag.types,
61+
'description': tag.description
62+
}))
8763
}
8864
});
8965

0 commit comments

Comments
 (0)