Skip to content

[Feature]: truncate #763

@ssi02014

Description

@ssi02014

Package Scope

  • 기존 패키지에 기능 추가
  • 새로운 패키지
  • Package name: @modern-kit/utils/string

Overview

[options.length=30] (number): 최대 문자열 길이 (omission 길이 포함)
[options.omission='...'] (string): 생략된 영역을 나타내는 문자열
[options.separator] (RegExp|string): 문자열을 잘라낼 구분자
truncate('hi-diddly-ho there, neighborino'); // 'hi-diddly-ho there, neighbo...'

truncate('hi-diddly-ho there, neighborino', {
  length: 24,
  sperator: ' ',
}); 'hi-diddly-ho there,...'

truncate('hi-diddly-ho there, neighborino', {
  omission: ' [...]'
  length: 24,
  separator: /,? +/
}); 'hi-diddly-ho there [...]'

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions