data(){ return:{ data: [ { name: 'Hello', phone_num: '1234'}, { name: 'Hello', phone_num: '1234'}, { name: 'Hello', phone_num: '1234'}, { name: 'Hello', phone_num: '1234'}, { name: 'Hello', phone_num: '1234'}, { name: 'Hello', phone_num: '1234'}, { name: 'Hello', phone_num: '1234'}, { name: 'Marc', phone_num: '5432'}, { name: 'Marc', phone_num: '5432'}, { name: 'Marc', phone_num: '5432'}, { name: 'Marc', phone_num: '5432'}, { name: 'Marc', phone_num: '5432'}, { name: 'Marc', phone_num: '5432'}, { name: 'Marc', phone_num: '5432'}, { name: 'Marc', phone_num: '5432'}, { name: 'Sam', phone_num: '76532'}, { name: 'Sam', phone_num: '76532'}, { name: 'Sam', phone_num: '76532'}, { name: 'Sam', phone_num: '76532'} ] } } },computed:{ productVal(){ return _(this.data) .groupBy('name') .map((items, name) => ({ name, count: items.length })) .value(); } }, //[ { "name": "Hello", "count": 7 }, { "name": "Marc", "count": 8 }, { "name": "Sam", "count": 4 } ]
Search thousands of free JavaScript snippets that you can quickly copy and paste into your web pages. Get free JavaScript tutorials, references, code, menus, calendars, popup windows, games, and much more.
lodash count unique of field
Subscribe to:
Post Comments (Atom)
The 6 New Rules of Communicating
The era of teleprompters and talking points has come to an end ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ...
-
code.gs // 1. Enter sheet name where data is to be written below var SHEET_NAME = "Sheet1" ; // 2. Run > setup // // 3....
No comments:
Post a Comment