Add sum function (#2653)
This commit is contained in:
		| @@ -86,6 +86,7 @@ import MkRenoteFormWindow from './renote-form-window.vue'; | ||||
| import MkNoteMenu from '../../../common/views/components/note-menu.vue'; | ||||
| import MkReactionPicker from '../../../common/views/components/reaction-picker.vue'; | ||||
| import XSub from './notes.note.sub.vue'; | ||||
| import { sum } from '../../../../../prelude/array'; | ||||
|  | ||||
| export default Vue.extend({ | ||||
| 	components: { | ||||
| @@ -122,9 +123,7 @@ export default Vue.extend({ | ||||
| 		}, | ||||
| 		reactionsCount(): number { | ||||
| 			return this.p.reactionCounts | ||||
| 				? Object.keys(this.p.reactionCounts) | ||||
| 					.map(key => this.p.reactionCounts[key]) | ||||
| 					.reduce((a, b) => a + b) | ||||
| 				? sum(Object.values(this.p.reactionCounts)) | ||||
| 				: 0; | ||||
| 		}, | ||||
| 		title(): string { | ||||
|   | ||||
| @@ -78,6 +78,7 @@ import MkRenoteFormWindow from './renote-form-window.vue'; | ||||
| import MkNoteMenu from '../../../common/views/components/note-menu.vue'; | ||||
| import MkReactionPicker from '../../../common/views/components/reaction-picker.vue'; | ||||
| import XSub from './notes.note.sub.vue'; | ||||
| import { sum } from '../../../../../prelude/array'; | ||||
|  | ||||
| function focus(el, fn) { | ||||
| 	const target = fn(el); | ||||
| @@ -120,9 +121,7 @@ export default Vue.extend({ | ||||
|  | ||||
| 		reactionsCount(): number { | ||||
| 			return this.p.reactionCounts | ||||
| 				? Object.keys(this.p.reactionCounts) | ||||
| 					.map(key => this.p.reactionCounts[key]) | ||||
| 					.reduce((a, b) => a + b) | ||||
| 				? sum(Object.values(this.p.reactionCounts)) | ||||
| 				: 0; | ||||
| 		}, | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Aya Morisawa
					Aya Morisawa