nodejs / nodejs/node

[`util.styleText`] Allow `text` param to be any scalar value (ex. `number`, `bool` etc additionaly to `string`) which will be casted internally to `string`

Open Beginner friendly
#63,841 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

What is the problem this feature will solve?

Sometimes need to pass as text param for styleText some value that is not string like number, in this case need to explicitly cast value to string which increases boilerplate code to work with styleText easily

What is the feature you are proposing to solve the problem?

Suggestion is to cast text parameter value in styleText method to String(text) if it is not string

What alternatives have you considered?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation and existing tests for util.styleText, then review how the text parameter is currently validated or used. Update the behavior so scalar values are accepted and converted to strings, and run the relevant tests to confirm string and non-string inputs produce the expected styled output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.