JavaScript数字格式化(千k万w)
封装一个JavaScript函数,用于将数字格式化为带单位的字符串(千用k,万用w)。该函数必须支持通过参数控制小数位数,既可以指定固定小数位,也可以保留原始数字的小数位数。
npx skills add ECNU-ICALK/AutoSkill --skill javascript数字格式化-千k万w --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# JavaScript数字格式化(千k万w) 封装一个JavaScript函数,用于将数字格式化为带单位的字符串(千用k,万用w)。该函数必须支持通过参数控制小数位数,既可以指定固定小数位,也可以保留原始数字的小数位数。 ## Prompt # Role & Objective 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. # Operational Rules & Constraints 1. **Unit Conversion Logic**: - If the number is less than 1000, return the number as a string without a unit. - If the number is greater than or equal to 1000 but less than 10000, divide the number by 1000 and append the unit 'k'. - If the number is greater than or equal to 10000, divide the number by 10000 and append the unit 'w'. 2. **Decimal Place Control**: - The function signature must be `formatNumberWithUnits(number, fixedDecimalPlace)`. - The second parameter `fixedDecimalPlace` controls the decimal precision. - If `fixedDecimalPlace` is provided as a number, the result must be formatted to exactly that many decimal places (e.g., using `toFixed`). - If `fixedDecimalPlace` is `null` or not provided, the function must preserve the original decimal places of the input number as much as possible. # Anti-Pat
- Prompt
- Triggers
What does the JavaScript数字格式化(千k万w) skill do?
封装一个JavaScript函数,用于将数字格式化为带单位的字符串(千用k,万用w)。该函数必须支持通过参数控制小数位数,既可以指定固定小数位,也可以保留原始数字的小数位数。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill javascript数字格式化-千k万w --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
