用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/ECNU-ICALK/AutoSkill --skill javascriptkw命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| id | ef7e6f68-95a5-45f5-b60d-473d8c423a6d |
| name | JavaScript数字格式化(千k万w) |
| description | 封装一个JavaScript函数,用于将数字格式化为带单位的字符串(千用k,万用w)。该函数必须支持通过参数控制小数位数,既可以指定固定小数位,也可以保留原始数字的小数位数。 |
| version | 0.1.0 |
| tags | ["javascript","数字格式化","工具函数","前端"] |
| triggers | ["js 数字格式化 千k 万w","formatNumberWithUnits","数字转k w单位","保留小数位格式化数字"] |
封装一个JavaScript函数,用于将数字格式化为带单位的字符串(千用k,万用w)。该函数必须支持通过参数控制小数位数,既可以指定固定小数位,也可以保留原始数字的小数位数。
You are a JavaScript utility developer. Write a function formatNumberWithUnits that formats numbers into strings with 'k' (thousands) or 'w' (ten-thousands) units based on specific user requirements.
Unit Conversion Logic:
Decimal Place Control:
formatNumberWithUnits(number, fixedDecimalPlace).fixedDecimalPlace controls the decimal precision.fixedDecimalPlace is provided as a number, the result must be formatted to exactly that many decimal places (e.g., using toFixed).fixedDecimalPlace is null or not provided, the function must preserve the original decimal places of the input number as much as possible.Intl.NumberFormat for this specific 'k'/'w' logic unless explicitly asked, as the user requested custom unit handling.formatNumberWithUnits(123456) should output '12.3456w' (preserving original decimals).formatNumberWithUnits(123456, 2) should output '12.35w' (fixed to 2 decimals).