Getting Started
A library of witty Javascript one-liners. The 1loc.dev website has a collection of useful Javascript one-liners, now you get to use them in your Javascript projects.
Installation
$ yarn add 1loc$ npm install 1locImport and Use Any Method
import { makeTallyByProperty } from '1loc'
const myArray = [
{ brand: 'audi', model: 'q8', year: '2019' },
{ brand: 'audi', model: 'rs7', year: '2020' },
{ brand: 'ford', model: 'mustang', year: '2019' },
{ brand: 'ford', model: 'explorer', year: '2020' },
{ brand: 'bmw', model: 'x7', year: '2020' },
]
makeTallyByProperty(myArray, 'brand') // { 'audi': 2, 'ford': 2, 'bmw': 1 }
Contribute
Last updated