jashkenas / jashkenas/underscore

_.size to return symbol count of strings.

Open
#2,302 4 comments 0 reactions 0 assignees View on GitHub
breaking change
Dominant language
JavaScript
Stars
27.3k
Forks
5.4k
Avg merge
2d 5h
Merged PRs (30d)
1

Description

Continuing the [discussion](https://github.com/jashkenas/underscore/commit/bdb06bcfcdcc85bfe3b494d9907762945f7d7c49#commitcomment-13243061), at the moment:

``` js
_.size('💕')
// => 2
```

Since `str.length` is trivial I think it --may-- be handy if `_.size` returned the number of symbols in a string instead.

``` js
_.size('💕')
// => 1
```

Contributor guide

Open the contributing guide

Research direction

Start at the _.size entry point and review the linked discussion to understand the intended string-counting behavior. Determine whether “symbol” means code points or another unit, then add coverage for the emoji example and verify the existing collection behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.