{"id":21340668,"url":"https://github.com/vikiboss/ck-util","last_synced_at":"2025-03-16T02:42:45.349Z","repository":{"id":146187304,"uuid":"617883115","full_name":"vikiboss/ck-util","owner":"vikiboss","description":"简单、轻量、平台无关的 JavaScript Cookie 工具类","archived":false,"fork":false,"pushed_at":"2023-05-17T11:41:32.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T15:06:21.703Z","etag":null,"topics":["cookie","cookie-parser","cookies","parser","toolkit"],"latest_commit_sha":null,"homepage":"https://npm.im/ck-util","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vikiboss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-23T10:06:49.000Z","updated_at":"2023-03-29T08:23:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5cb55e9-9725-4533-b51b-975c82543bfc","html_url":"https://github.com/vikiboss/ck-util","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikiboss%2Fck-util","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikiboss%2Fck-util/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikiboss%2Fck-util/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikiboss%2Fck-util/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vikiboss","download_url":"https://codeload.github.com/vikiboss/ck-util/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243817840,"owners_count":20352616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cookie","cookie-parser","cookies","parser","toolkit"],"created_at":"2024-11-22T00:52:22.847Z","updated_at":"2025-03-16T02:42:45.342Z","avatar_url":"https://github.com/vikiboss.png","language":"TypeScript","readme":"# 🍪 Cookie Util 🍪\n\n一个简单、轻量级的、与平台无关的 JavaScript Cookie 工具类。\n\n**为什么是 Cookie Util？**\n\n- 💡 简单易用，提供直观的 API\n- 📦 轻量级，零生产依赖\n- 💻 平台无关，适用于浏览器、Node.js 等环境\n- 🌈 使用 TypeScript 编写，更安全、更健壮\n\n试试 Cookie Util，让 Cookie 操作轻松愉快，睡个安稳觉！🥳\n\n## 🚀 安装\n\n使用 npm 安装：\n\n```bash\nnpm install ck-util\n```\n\n## 🎉 使用\n\n```javascript\n// 🧭 从 ck-util 中引入 CookieUtil 类\nconst { CookieUtil } = require('ck-util')\n\n// 🔍 解析 Cookie 字符串\nconst cookies = new CookieUtil('name=Viki%20Moe; age=21; city=Beijing')\nconsole.log(cookies.get('name')) // 输出：'Viki Moe'\n\n// ✏️ 设置 Cookie 字段\ncookies.set('country', 'China')\nconsole.log(cookies.get('country')) // 输出：'China'\n\n// 📖 获取 Cookie 字段值\nconst name = cookies.get('name')\nconsole.log(name) // 输出：'Viki Moe'\n\n// ❌ 删除 Cookie 字段\nconst deletedValue = cookies.delete('name')\nconsole.log(deletedValue, cookies.get('name')) // 输出：Viki Moe, undefined\n\n// 🧐 检查 Cookie 字段是否存在\nconst hasName = cookies.has('name')\nconsole.log(hasName) // 输出：false\n\n// 🔄 将 Cookies 对象转换为标准字符串\nconst cookieStr = cookies.stringify()\nconsole.log(cookieStr) // 输出：\"age=21; city=Beijing; country=China\"\n```\n\n## License\n\n- [MIT](LICENSE) License © 2023-PRESENT Viki","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikiboss%2Fck-util","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvikiboss%2Fck-util","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikiboss%2Fck-util/lists"}