{"_id":"@atishhamte/loon","_rev":"2-13f85fb434950e4773e18ad834a3157a","name":"@atishhamte/loon","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@atishhamte/loon","version":"1.0.0","keywords":["loon","encoder","llm","json","token-optimization","encoding","compression","ai","gpt","language-model","data-format","typescript"],"author":"","license":"MIT","_id":"@atishhamte/loon@1.0.0","maintainers":[{"name":"atishhamte","email":"atishh.amte@gmail.com"}],"homepage":"https://github.com/atishhamte/loon#readme","bugs":{"url":"https://github.com/atishhamte/loon/issues"},"dist":{"shasum":"d16a796023216e8b923cf30da03de6108ea36571","tarball":"https://registry.npmjs.org/@atishhamte/loon/-/loon-1.0.0.tgz","fileCount":29,"integrity":"sha512-9VBIwTv6pNgg5SSNECT37nL4Z/AzWjrTMpYKM4p57h0bnlgprDw/v/hbE4SFtornk3DT4U6R9uBU2hrFymZL+w==","signatures":[{"sig":"MEUCIQDhnPu/jHWo04PlIptdZCXlsk+2EGYxhdQYG1LOOXNb9wIgDRvWXUFLPhGo2kwnoeBaHRs+/sjkORl2LOJDVAAE+DY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":60328},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=16"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"9e1a24d42c1469abf8d3389dd48d514f69bef910","scripts":{"lint":"eslint src --ext .ts","build":"npm run build:cjs && npm run build:esm && npm run build:types","format":"prettier --write \"src/**/*.ts\"","lint:fix":"eslint src --ext .ts --fix","build:cjs":"tsc --module commonjs --outDir dist","build:esm":"tsc --module esnext --outDir dist-esm && node scripts/rename-esm.js","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist","format:check":"prettier --check \"src/**/*.ts\""},"_npmUser":{"name":"atishhamte","email":"atishh.amte@gmail.com"},"repository":{"url":"git+https://github.com/atishhamte/loon.git","type":"git"},"_npmVersion":"10.3.0","description":"LOON (LLM Optimised Object Notations) - An encoder-only library that reduces token consumption by ~40-50% compared to minified JSON through schema optimization and intelligent formatting","directories":{},"_nodeVersion":"18.20.8","_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.0.0","prettier":"^3.0.0","typescript":"^5.0.0","@types/node":"^20.0.0","eslint-config-prettier":"^9.0.0","@typescript-eslint/parser":"^6.0.0","@typescript-eslint/eslint-plugin":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/loon_1.0.0_1763731551115_0.32375474791066217","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@atishhamte/loon","version":"1.0.1","description":"LOON (LLM Optimised Object Notations) - An encoder-only library that reduces token consumption by ~40-50% compared to minified JSON through schema optimization and intelligent formatting","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"npm run build:cjs && npm run build:esm && npm run build:types","build:cjs":"tsc --module commonjs --outDir dist","build:esm":"tsc --module esnext --outDir dist-esm && node scripts/rename-esm.js","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist","lint":"eslint src --ext .ts","lint:fix":"eslint src --ext .ts --fix","format":"prettier --write \"src/**/*.ts\"","format:check":"prettier --check \"src/**/*.ts\""},"keywords":["loon","encoder","llm","json","token-optimization","encoding","compression","ai","gpt","language-model","data-format","typescript"],"author":"","license":"MIT","repository":{"type":"git","url":"git+https://github.com/atishhamte/loon.git"},"bugs":{"url":"https://github.com/atishhamte/loon/issues"},"homepage":"https://github.com/atishhamte/loon#readme","engines":{"node":">=16"},"devDependencies":{"@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0","eslint":"^8.0.0","eslint-config-prettier":"^9.0.0","prettier":"^3.0.0","typescript":"^5.0.0"},"_id":"@atishhamte/loon@1.0.1","gitHead":"886f3bc1a3880e9523230700d4a4fe70766d9ebe","_nodeVersion":"18.20.8","_npmVersion":"10.3.0","dist":{"integrity":"sha512-nEsZWSrC6RGJoP5hOXsRNkoDm/nNvn/gKmsGnpjUzuWN/h+eFsBCyGhLvUMzFcbUSoHgGLvln4WoVLV10uI3aA==","shasum":"57869e106634aeb98512b739a718827046a46632","tarball":"https://registry.npmjs.org/@atishhamte/loon/-/loon-1.0.1.tgz","fileCount":29,"unpackedSize":60402,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCd7xQ0l+b28CW+1P0APMOnJwtNmJD2LsxowfnDdUPTogIgPKSZ2rCjF7lRNO24oTQAsi1FyNTmtEj6mpo2pahwKHQ="}]},"_npmUser":{"name":"atishhamte","email":"atishh.amte@gmail.com"},"directories":{},"maintainers":[{"name":"atishhamte","email":"atishh.amte@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/loon_1.0.1_1763732355520_0.9260598888059204"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-21T13:25:51.019Z","modified":"2025-11-21T13:39:15.942Z","1.0.0":"2025-11-21T13:25:51.369Z","1.0.1":"2025-11-21T13:39:15.767Z"},"bugs":{"url":"https://github.com/atishhamte/loon/issues"},"license":"MIT","homepage":"https://github.com/atishhamte/loon#readme","keywords":["loon","encoder","llm","json","token-optimization","encoding","compression","ai","gpt","language-model","data-format","typescript"],"repository":{"type":"git","url":"git+https://github.com/atishhamte/loon.git"},"description":"LOON (LLM Optimised Object Notations) - An encoder-only library that reduces token consumption by ~40-50% compared to minified JSON through schema optimization and intelligent formatting","maintainers":[{"name":"atishhamte","email":"atishh.amte@gmail.com"}],"readme":"# LOON (LLM Optimised Object Notations)\r\n\r\n[![npm version](https://img.shields.io/npm/v/loon.svg)](https://www.npmjs.com/package/loon)\r\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\r\n\r\n**LOON** is an encoder-only library that reduces token consumption by ~40-50% compared to minified JSON. It's designed specifically for LLM communication where every token counts.\r\n\r\nThe format removes unnecessary syntax, uses unquoted strings where safe, and employs schema optimization for arrays – all while remaining readable enough for LLMs to understand naturally.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @atishhamte/loon\r\n```\r\n\r\n## Usage\r\n\r\n```typescript\r\nimport { encode } from '@atishhamte/loon';\r\n\r\n// Encode JavaScript data to LOON format\r\nconst data = {\r\n  users: [\r\n    { id: 1, name: 'Alice', role: 'admin' },\r\n    { id: 2, name: 'Bob', role: 'user' },\r\n    { id: 3, name: 'Charlie', role: 'user' },\r\n  ],\r\n};\r\n\r\nconst loon = encode(data);\r\nconsole.log(loon);\r\n// {users:[{id,name,role}:1,Alice,admin;2,Bob,user;3,Charlie,user]}\r\n```\r\n\r\n### With LLMs\r\n\r\n```typescript\r\nimport { encode } from 'loon';\r\n\r\nconst context = {\r\n  conversation: [\r\n    { role: 'user', message: 'What is the weather?' },\r\n    { role: 'assistant', message: 'It is sunny today.' },\r\n  ],\r\n  settings: { temperature: 0.7, maxTokens: 150 },\r\n};\r\n\r\nconst prompt = `Context: ${encode(context)}\\n\\nQuestion: Summarize the conversation.`;\r\n// Send to LLM...\r\n```\r\n\r\n## Format Comparison\r\n\r\n### Example: User Data\r\n\r\n**JSON (formatted):**\r\n\r\n```json\r\n{\r\n  \"users\": [\r\n    { \"id\": 1, \"name\": \"Alice\", \"role\": \"admin\" },\r\n    { \"id\": 2, \"name\": \"Bob\", \"role\": \"user\" },\r\n    { \"id\": 3, \"name\": \"Charlie\", \"role\": \"user\" }\r\n  ]\r\n}\r\n```\r\n\r\n**236 characters** (includes newlines and spaces)\r\n\r\n**JSON.stringify (minified):**\r\n\r\n```json\r\n{\r\n  \"users\": [\r\n    { \"id\": 1, \"name\": \"Alice\", \"role\": \"admin\" },\r\n    { \"id\": 2, \"name\": \"Bob\", \"role\": \"user\" },\r\n    { \"id\": 3, \"name\": \"Charlie\", \"role\": \"user\" }\r\n  ]\r\n}\r\n```\r\n\r\n**126 characters**\r\n\r\n**TOON:**\r\n\r\n```\r\nusers[3]{id,name,role}:\r\n  1,Alice,admin\r\n  2,Bob,user\r\n  3,Charlie,user\r\n```\r\n\r\n**69 characters** (45.2% vs minified)\r\n\r\n**LOON:**\r\n\r\n```\r\n{users:[{id,name,role}:1,Alice,admin;2,Bob,user;3,Charlie,user]}\r\n```\r\n\r\n**64 characters** (49.2% vs minified) - Single line, better for LLMs\r\n\r\n## Benchmarks\r\n\r\n| Data Type               | JSON (formatted) | Minified   | TOON      | LOON      | LOON Savings |\r\n| ----------------------- | ---------------- | ---------- | --------- | --------- | ------------ |\r\n| Simple objects          | 236 chars        | 126 chars  | 69 chars  | 64 chars  | **49.2%** ✓  |\r\n| API responses           | 520 chars        | 277 chars  | 179 chars | 161 chars | **41.9%** ✓  |\r\n| Database records        | 414 chars        | 293 chars  | 186 chars | 176 chars | **39.9%** ✓  |\r\n| Time series (5 items)   | 547 chars        | 325 chars  | 149 chars | 139 chars | **57.2%** ✓  |\r\n| Large arrays (20 items) | 1985 chars       | 1384 chars | 750 chars | 707 chars | **48.9%** ✓  |\r\n| Mixed data types        | 192 chars        | 122 chars  | 109 chars | 100 chars | **18.0%** ✓  |\r\n\r\n**Average: 42.5% compression vs minified JSON**\r\n\r\n**LOON advantages:**\r\n\r\n✅ Single-line format (better for LLMs and APIs)\r\n\r\n✅ 42.5% average compression vs minified JSON\r\n\r\n✅ Handles mixed/nested structures efficiently\r\n\r\n✅ No newlines (saves tokens)\r\n\r\n## API\r\n\r\n### `encode(value: unknown): string`\r\n\r\nEncodes a JavaScript value into LOON format.\r\n\r\n**Example:**\r\n\r\n```typescript\r\nconst data = { name: 'Alice', age: 30 };\r\nconst loon = encode(data);\r\n// {name:Alice;age:30}\r\n```\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.\r\n\r\n```bash\r\n# Clone and setup\r\ngit clone https://github.com/YOUR_USERNAME/loon.git\r\ncd loon\r\nnpm install\r\n\r\n# Build\r\nnpm run build\r\n\r\n# Lint and format\r\nnpm run lint\r\nnpm run format\r\n```\r\n\r\n## License\r\n\r\n[MIT](./LICENSE) License © 2025-PRESENT\r\n\r\n---\r\n\r\n**Questions or feedback?** Open an issue on [GitHub](https://github.com/YOUR_USERNAME/loon/issues).\r\n","readmeFilename":"README.md"}