Skip to content

Documentation example for _.countBy is confusing #3771

Closed
@wellcaffeinated

Description

@wellcaffeinated

The current examples produce output that has number values for both key and value. This is a bit confusing and every single time i look at the docs for this method i have to do my own test in console to understand. I suggest adding an example like this one to the docs:

var users = [
  { 'user': 'barney', 'age': 36, 'active': true },
  { 'user': 'betty', 'age': 34, 'active': true }, 
  { 'user': 'fred',   'age': 40, 'active': false }
];

_.countBy(users, 'active');
// => { true: 2, false: 1 }

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy