[`util.styleText`] Allow `text` param to be any scalar value (ex. `number`, `bool` etc additionaly to `string`) which will be casted internally to `string`
未关闭
适合新手
还没有人认领这个 Issue。
feature request
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 272
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先定位 util.styleText 的实现和现有测试,然后检查当前如何验证或使用 text 参数。更新行为,使其接受标量值并将其转换为字符串,然后运行相关测试,以确认字符串输入和非字符串输入都会产生预期的样式化输出。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- cli
- Issue 类型
- 功能
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 68/100