Skip to content

[BUG]: string/truncate behaves abnormally when truncating strings to length 3 #2630

Closed

Description

Description

Encountered an error when truncating strings to length 3.

Demo

image

Reproduction

  • truncate any string to length 3.

Expected Results

In [1]: truncate('hell', 3)
Out[1]: '...'

In [2]: ans.length
Out[2]: 3

Actual Results

In [1]: truncate('hell', 3)
Out[1]: 'hell...'

In [2]: ans.length
Out[2]: 7

Version

https://github.com/stdlib-js/stdlib/tree/c89a171db9b4664582fab09dc95a5cc3b58f9f21

Environments

Node.js

Node.js / npm Version

Node @20.13.1, npm @10.5.2

Platform

Ubuntu 20.04.6 LTS (container)

Checklist

  • Read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

BugSomething isn't working.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions