{"id":17008283,"url":"https://github.com/luavixen/cktjs","last_synced_at":"2025-04-12T07:21:55.605Z","repository":{"id":57199320,"uuid":"396658563","full_name":"luavixen/cktjs","owner":"luavixen","description":"JSON-style CKT config language parsing/stringification.","archived":false,"fork":false,"pushed_at":"2022-01-03T21:48:10.000Z","size":178,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T10:11:37.353Z","etag":null,"topics":["javascript","javascript-library","parser","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/cktjs","language":"JavaScript","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/luavixen.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}},"created_at":"2021-08-16T06:45:08.000Z","updated_at":"2025-02-19T20:23:31.000Z","dependencies_parsed_at":"2022-09-16T14:50:51.049Z","dependency_job_id":null,"html_url":"https://github.com/luavixen/cktjs","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luavixen%2Fcktjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luavixen%2Fcktjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luavixen%2Fcktjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luavixen%2Fcktjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luavixen","download_url":"https://codeload.github.com/luavixen/cktjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530911,"owners_count":21119659,"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":["javascript","javascript-library","parser","typescript"],"created_at":"2024-10-14T05:27:54.932Z","updated_at":"2025-04-12T07:21:55.551Z","avatar_url":"https://github.com/luavixen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp\u003e\n  \u003ca href=\"https://www.npmjs.com/package/cktjs\"\u003e\n    \u003cimg src=\"https://badgen.net/npm/v/cktjs?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/cktjs?activeTab=dependencies\"\u003e\n    \u003cimg src=\"https://badgen.net/bundlephobia/dependency-count/cktjs?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/luavixen/cktjs/blob/main/lib/index.d.ts\"\u003e\n    \u003cimg src=\"https://badgen.net/npm/types/cktjs?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://bundlephobia.com/result?p=cktjs\"\u003e\n    \u003cimg src=\"https://badgen.net/bundlephobia/minzip/cktjs?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/luavixen/cktjs/actions\"\u003e\n    \u003cimg src=\"https://badgen.net/github/status/luavixen/cktjs/main?label=build\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://coveralls.io/github/luavixen/cktjs\"\u003e\n    \u003cimg src=\"https://badgen.net/coveralls/c/github/luavixen/cktjs?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/luavixen/cktjs/blob/main/LICENSE\"\u003e\n    \u003cimg src=\"https://badgen.net/github/license/luavixen/cktjs?style=flat-square\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# cktjs\ncktjs is an implementation of a decoder and encoder for the [CKT config language](https://cricket.piapiac.org/software/ckt/).\nIt aims to be a drop-in replacement for JavaScripts's built in [JSON library](https://tc39.es/ecma262/#sec-json-object) minus support for `reviver` and `replacer`.\n\nFor syntax highlighting try the [cktvs extension](https://github.com/luavixen/cktvs) for Visual Studio Code.\n\n## Installation\nThe cktjs npm package provides the original ES module source plus CommonJS and browser IIFE builds.\nIt can be installed with:\n```sh\nnpm install cktjs\n```\n\nFor [Deno](https://deno.land/) users, you can get the module from [deno.land/x/cktjs](https://deno.land/x/cktjs):\n```typescript\nimport * as CKT from \"https://deno.land/x/cktjs@1.0/mod.ts\";\n```\n\nIf you're working with a browser, you can use the IIFE build directly from a CDN.\nCurrently, cktjs officially supports [unpkg](https://www.unpkg.com/) and [jsdelivr](https://www.jsdelivr.com/):\n```html\n\u003c!-- unpkg --\u003e\n\u003cscript src=\"https://www.unpkg.com/cktjs@1.0\"\u003e\u003c/script\u003e\n\u003c!-- jsdelivr --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/cktjs@1.0\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n### Import cktjs\n```javascript\n// CommonJS\nconst CKT = require(\"cktjs\");\n// ESModules\nimport * as CKT from \"cktjs\";\n```\n\n### Parse a CKT document\n```javascript\nconst config = CKT.parse(`\nrate limits = [\n  /* = [\n    request limit = 100\n    window length = 2s\n  ]\n  /api/upload = [\n    size limit = 100mb\n    request limit = 6\n    window length = 5s\n  ]\n]\n`);\n```\n```javascript\n{\n  \"rate limits\": {\n    \"/*\": {\n      \"request limit\": 100,\n      \"window length\": \"2s\"\n    },\n    \"/api/upload\": {\n      \"size limit\": \"100mb\",\n      \"request limit\": 6,\n      \"window length\": \"5s\"\n    }\n  }\n}\n```\n\n### Encode an object as a CKT document\n```javascript\nconst menu = {\n  \"id\": \"file\",\n  \"value\": \"File\",\n  \"popup\": {\n    \"menuitem\": [\n      { \"value\": \"New\"  , \"onclick\": \"CreateNewDoc()\" },\n      { \"value\": \"Open\" , \"onclick\": \"OpenDoc()\"      },\n      { \"value\": \"Close\", \"onclick\": \"CloseDoc()\"     },\n    ],\n  },\n};\nconst text = CKT.stringify(menu, 2);\n```\n```lua\nid = file\nvalue = File\npopup = [\n  menuitem = [\n    [\n      value = New\n      onclick = \"CreateNewDoc()\"\n    ]\n    [\n      value = Open\n      onclick = \"OpenDoc()\"\n    ]\n    [\n      value = Close\n      onclick = \"CloseDoc()\"\n    ]\n  ]\n]\n```\n\n## Authors\nMade with ❤ by Lua MacDougall ([foxgirl.dev](https://foxgirl.dev/))\n\n## License\nThis project is licensed under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluavixen%2Fcktjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluavixen%2Fcktjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluavixen%2Fcktjs/lists"}