magic-spells-utils
v2.0.0
Published
🧙♂️ 一个充满魔法的JavaScript工具库!让你的代码变得有趣和神奇 ✨
Maintainers
Readme
🧙♂️ Magic Spells Utils
一个充满魔法的 JavaScript 工具库!让你的代码变得有趣和神奇 ✨
🌟 简介
欢迎来到魔法世界!这个库包含了各种有趣的魔法工具,让你的编程体验变得更加有趣和创意。从彩虹文本到魔法药水,从占卜到魔法生物召唤 - 一切皆有可能!
🚀 安装
npm install magic-spells-utils📖 使用方法
const magic = require("magic-spells-utils");
// 或者使用 ES6 模块
import magic from "magic-spells-utils";🎨 API 文档
🌈 彩虹文本 (rainbowText)
为文本添加魔法装饰!
console.log(magic.rainbowText("Hello Magic World!"));
// 🔴H🟠e🟡l🟢l🔵o ⚫M🟠a🟡g🟢i🔵c ⚫W🟠o🟡r🟢l🔵d!✨
console.log(magic.rainbowText("Sparkles!", "sparkle"));
// ✨S🌟p💫a⭐r✨k🌟l💫e⭐s!✨🧪 魔法药水 (createPotion)
生成神奇的魔法药水配方!
console.log(magic.createPotion());
// 🧪 LOVE POTION 🧪
// Ingredients: dragon scales, unicorn tears, phoenix feathers
// Brewed by: wizard 🧙♂️
// Effect: enchanting powers! ✨🎭 魔法咒语 (castSpell)
释放强大的魔法咒语!
console.log(magic.castSpell("heal"));
// ✨ HEALICUS MAXIMUS ✨
// *Waves magic wand* ✨
console.log(magic.castSpell("protect"));
// 🌟 PROTEGO TOTALUM 🌟
// *Waves magic wand* ✨🦄 召唤魔法生物 (summonCreature)
召唤神秘的魔法生物!
const creature = magic.summonCreature();
console.log(creature.greeting);
// Greetings! I am a majestic dragon! 🌟 My power is mystical!
console.log(creature);
// {
// name: 'majestic dragon',
// emoji: '🌟',
// power: 'mystical',
// greeting: 'Greetings! I am a majestic dragon! 🌟 My power is mystical!'
// }🌟 魔法进度条 (magicProgress)
显示带有魔法效果的进度条!
console.log(magic.magicProgress(75, "Loading Magic"));
// 🌟 Loading Magic: [🟩🟩🟩🟩🟩🟩🟩⬜⬜⬜] 75% 🌟
console.log(magic.magicProgress(100, "Complete!"));
// ✨ Complete!: [🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩] 100% ✨🎪 魔法笑话 (magicJoke)
获取一个魔法主题的笑话!
console.log(magic.magicJoke());
// Why don't wizards ever get cold? Because they have dragon breath! 🔥🎨 魔法用户名 (magicUsername)
生成充满魔力的用户名!
console.log(magic.magicUsername("dragon"));
// MagicDragon
console.log(magic.magicUsername("alice"));
// AliceTheWizard
console.log(magic.magicUsername());
// CrystalUnicorn🌈 魔法密码 (magicPassword)
生成包含 emoji 的魔法密码!
console.log(magic.magicPassword(16));
// A1b2C3d4E5f6G7h8✨🌟💫⭐
console.log(magic.magicPassword(12, false));
// K9m2N8p4Q1r7🎲 魔法骰子 (magicDice)
掷出魔法骰子!
const result = magic.magicDice(20, 3);
console.log(result.message);
// 🎲 Rolled 15, 8, 20 (Total: 43) 🎲
console.log(result);
// {
// rolls: [15, 8, 20],
// total: 43,
// average: 14.33,
// emoji: '🎲',
// message: '🎲 Rolled 15, 8, 20 (Total: 43) 🎲'
// }🔮 魔法占卜 (fortuneTelling)
获取神秘的占卜结果!
console.log(magic.fortuneTelling("Will I find true love?"));
// 🔮 Will I find true love?
//
// The stars align in your favor! ✨ Great success awaits you.🎯 快捷方法
为了更方便使用,所有方法都有对应的快捷别名:
const magic = require("magic-spells-utils");
// 以下调用是等价的
magic.castSpell() === magic.spell();
magic.createPotion() === magic.potion();
magic.summonCreature() === magic.creature();
magic.magicProgress() === magic.progress();
magic.magicJoke() === magic.joke();
magic.magicUsername() === magic.username();
magic.magicPassword() === magic.password();
magic.magicDice() === magic.dice();
magic.fortuneTelling() === magic.fortune();
magic.rainbowText() === magic.rainbow();🎪 完整示例
const magic = require("magic-spells-utils");
// 欢迎来到魔法世界
console.log(magic.rainbowText("Welcome to the Magic World!"));
// 召唤一个魔法生物
const creature = magic.summonCreature();
console.log(creature.greeting);
// 制作魔法药水
console.log(magic.createPotion());
// 释放保护咒语
console.log(magic.castSpell("protect"));
// 掷骰子决定命运
const dice = magic.magicDice(12);
console.log(dice.message);
// 获取占卜
console.log(magic.fortuneTelling("What adventure awaits me today?"));
// 显示魔法进度
console.log(magic.magicProgress(85, "Casting Spell"));
// 听个魔法笑话
console.log(magic.magicJoke());🧪 测试
运行测试:
npm test🎭 演示
运行演示:
npm run demo🤝 贡献
欢迎提交 Issue 和 Pull Request!
- Fork 这个项目
- 创建你的魔法分支 (
git checkout -b feature/AmazingSpell) - 提交你的魔法 (
git commit -m 'Add some AmazingSpell') - 推送到分支 (
git push origin feature/AmazingSpell) - 开启一个 Pull Request
📜 许可证
这个项目使用 MIT 许可证 - 查看 LICENSE 文件了解详情。
🎉 更新日志
v2.0.0 - 重大更新!🎊
- 🆕 新增 20 个魔法函数! 现在总共 31 个魔法工具
- 🏰 魔法城堡生成器
- ⚡ 魔法能量等级系统
- 🎭 魔法面具生成器
- 🌙 月相魔法效果
- 🔥 元素魔法系统(火、水、土、气、雷、冰)
- 🎵 魔法音乐生成器
- 🌟 星座魔法祝福
- 🍀 幸运魔法效果
- 🧪 魔法实验系统
- 🎨 魔法艺术创作
- 🍯 魔法蜂蜜效果
- 🌊 潮汐魔法
- 🎪 魔法马戏团
- 🌸 季节魔法系统
- 🎯 魔法目标设定
- 🔮 魔法预言生成
- 🌈 彩虹桥连接
- 🎭 魔法戏剧表演
- 🍄 魔法蘑菇效果
- 🎨 魔法调色板
- 🏆 魔法成就系统
- ✅ 完善了所有测试用例(50/50 通过)
- 📚 更新了完整文档
- 🎭 优化了演示脚本
v1.1.0
- 🐛 修复了彩虹文本测试中的 bug
- ✅ 完善了所有测试用例(22/22 通过)
- 📚 更新了文档和示例
- 🎭 优化了演示脚本
- 🧪 改进了测试覆盖率
v1.0.0
- ✨ 初始版本发布
- 🧙♂️ 包含 10 个魔法工具函数
- 🌈 支持彩虹文本装饰
- 🧪 魔法药水生成器
- 🎭 魔法咒语系统
- 🦄 魔法生物召唤
- 🌟 魔法进度条
- 🎪 魔法笑话生成器
- 🎨 魔法用户名生成器
- 🌈 魔法密码生成器
- 🎲 魔法骰子
- 🔮 魔法占卜
🌟 致谢
感谢所有魔法师们的贡献!这个库的灵感来自于对编程的热爱和对魔法的向往。
"In programming, as in magic, the impossible becomes possible with the right incantation." ✨
Made with ❤️ and magic by BK300
