Skip to content

fix[compat/truncate]: count emoji sequences as one character like Lodash - #2209

Open
wonjangcloud9 wants to merge 2 commits into
toss:mainfrom
wonjangcloud9:fix/compat-truncate-emoji-sequences
Open

wonjangcloud9 wants to merge 2 commits into
toss:mainfrom
wonjangcloud9:fix/compat-truncate-emoji-sequences

Conversation

@wonjangcloud9

Copy link
Copy Markdown

Summary

It counts emoji sequences differently from Lodash, so they get cut or broken. Outline actually uses it.

import { truncate } from 'lodash';

truncate('👨‍👩‍👧 family photos from 🇰🇷', { length: 12 });
// lodash:     '👨‍👩‍👧 family ...'
// es-toolkit: '👨‍👩‍👧 fam...'

truncate('📅 Weekly sync 👨‍👩‍👧‍👦 notes', { length: 16, omission: '…' });
// lodash:     '📅 Weekly sync 👨‍👩‍👧‍👦…'
// es-toolkit: '📅 Weekly sync 👨…'

Changes

  • I changed it to the Lodash-style helper.

Benchmark results

ns/op main this branch lodash
short ascii 25 22 21
long ascii 31 26 25
short unicode 445 870 960
long unicode ~6800 4200 32500

@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
es-toolkit Ready Ready Preview Nov 25, 2026 11:03am UTC

Request Review

wonjangcloud9 and others added 2 commits November 25, 2026 19:57
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — 160dd729 Deployed Nov 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant