{"id":15495111,"url":"https://github.com/samchon/fast-object","last_synced_at":"2026-03-08T07:31:59.830Z","repository":{"id":38086744,"uuid":"501616145","full_name":"samchon/fast-object","owner":"samchon","description":"Fast object creator, via JSON.parse(), but type safe","archived":false,"fork":false,"pushed_at":"2022-06-10T12:55:08.000Z","size":23,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-19T10:53:42.827Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/samchon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-09T11:00:54.000Z","updated_at":"2023-10-27T14:35:50.000Z","dependencies_parsed_at":"2022-09-17T20:51:42.528Z","dependency_job_id":null,"html_url":"https://github.com/samchon/fast-object","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/samchon/fast-object","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samchon%2Ffast-object","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samchon%2Ffast-object/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samchon%2Ffast-object/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samchon%2Ffast-object/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samchon","download_url":"https://codeload.github.com/samchon/fast-object/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samchon%2Ffast-object/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30248876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T05:41:50.788Z","status":"ssl_error","status_checked_at":"2026-03-08T05:41:39.075Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-02T08:16:08.772Z","updated_at":"2026-03-08T07:31:59.814Z","avatar_url":"https://github.com/samchon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fast-Object\nFast object creator, via transforming to `JSON.parse()`, but type safe.\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/fast-object/blob/master/LICENSE)\n[![npm version](https://badge.fury.io/js/fast-object.svg)](https://www.npmjs.com/package/fast-object)\n[![Downloads](https://img.shields.io/npm/dm/fast-object.svg)](https://www.npmjs.com/package/fast-object)\n[![Build Status](https://github.com/samchon/fast-object/workflows/build/badge.svg)](https://github.com/samchon/fast-object/actions?query=workflow%3Abuild)\n\n![json](https://user-images.githubusercontent.com/13158709/172905432-8a316e9c-fbdb-4652-aefa-28113cbad98d.svg)\n\n  - [Faster apps with JSON.parse (Chrome Dev Summit 2019)](https://www.youtube.com/watch?v=ff4fgQxPaO0)\n  - [The cost of parsing JSON](https://v8.dev/blog/cost-of-javascript-2019#json)\n\nYou know what? `JSON.parse()` is faster than literal construction, when only one-time constructed.\n\n`fast-object` is a transformer library which converts a literal object construction to a `JSON.parse()` function call expression with JSON string argument. Therefore, if you construct a literal object with `fast-object`, you can get benefit from type safety and perforamce tuning at the same time.\n\nLook at the below code, then you may understand how `fast-object` works.\n\n#### `example.ts`\n```typescript\nimport create from \"fast-object\";\n\ninterface IUser {\n    id: number;\n    account: string;\n    name: string;\n}\nconst member: IUser = create({\n    id: 1,\n    account: \"samchon\",\n    name: \"Jeongho Nam\",\n});\n```\n\n#### `example.js`\n```js\nconst member = JSON.parse(\"{\\\"id\\\":1,\\\"account\\\":\\\"samchon\\\",\\\"name\\\":\\\"Jeongho Nam\\\"}\");\n```\n\n\n\n\n## Setup\n### NPM Package\nAt first, install this `fast-object` by the `npm install` command. \n\nAlso, you need additional `devDependencies` to compile the TypeScript code with transformation. Therefore, install those all libraries `typescript`, `ttypescript` and `ts-node`. Note that, `ttypescript` is not mis-writing. Therefore, do not forget to install the `ttypescript`.\n\n```bash\nnpm install --save fast-object\n\n# ENSURE THOSE PACKAGES ARE INSTALLED\nnpm install --save-dev typescript\nnpm install --save-dev ttypescript\nnpm install --save-dev ts-node\n```\n\n### tsconfig.json\nAfter the installation, you've to configure the `tsconfig.json` file like below. Add the new property `transform` and its value `fast-object/lib/transform` into the `compilerOptions.plugins` array.\n\n```json\n{\n  \"compilerOptions\": {\n    \"plugins\": [\n      {\n        \"transform\": \"fast-object/lib/transform\"\n      }\n    ]\n  }\n}\n```\n\nAfter the `tsconfig.json` definition, you can compile `fast-object` utilized code by using `ttypescript`. If you want to run your TypeScript file through `ts-node`, use `-C ttypescript` argument like below:\n\n```bash\n# COMPILE\nnpx ttsc\n\n# WITH TS-NODE\nnpx ts-node -C ttypescript\n```\n\n### webpack\nIf you're using a `webpack` with `ts-loader`, configure the `webpack.config.js` file like below:\n\n```javascript\nconst transform = require('fast-object/lib/transform').default;\n\nmodule.exports = {\n    // I am hiding the rest of the webpack config\n    module: {\n        rules: [\n            {\n                test: /\\.ts$/,\n                exclude: /node_modules/,\n                loader: 'ts-loader',\n                options: {\n                    getCustomTransformers: program =\u003e ({\n                        before: [transform(program)]\n                    })\n                }\n            }\n        ]\n    }\n};\n```\n\n\n\n\n## Features\n### Default Function\n```typescript\nexport default function create\u003cT\u003e(input: T): T;\n```\n\n`fast-object` provides only one default function `create()`.\n\nJust import it and utilize the function to boost up your object construction speed.\n\n```typescript\nimport create from \"fast-object\";\n\nconst member: IUser = create({\n    id: 1,\n    account: \"samchon\",\n    name: \"Jeongho Nam\",\n});\n```\n\n### Literal Only\nUse only constant literal values.\n\n`fast-object` is a transformer library which converts literal object construction to a `JSON.parse()` function call expression with JSON string argument. Therefore, you have you only constant literal values in that object.\n\nIf you're using a variable value like below, `fast-object` will throw an exception.\n\n```typescript\nimport create from \"fast-object\";\n\nconst account: string = \"samchon\";\nconst member: IUser = create({\n    id: 1,\n    account, // DON'T DO THAT\n    name: \"Jeongho Nam\",\n});\n```\n\n\n\n\n\n## Appendix\nMy anothers libraries using TypeScript Compiler API.\n\n### TypeScript-JSON\n\u003e `typescript-json` is not 10x faster yet, but would be soon in the v3 update.\n\nhttps://github.com/samchon/typescript-json\n\nRuntime type checker, and 10x faster `JSON.stringify()` function, with only one line.\n\n```typescript\nimport TSON from \"typescript-json\";\n\nTSON.assert\u003cT\u003e(input); // runtime type checker throwing exception\nTSON.is\u003cT\u003e(input); // runtime type checker returning boolean\nTSON.stringify\u003cT\u003e(input); // 10x faster JSON.stringify()\nTSON.create\u003cT\u003e(input); // same with this fast-object\n```\n\n`typescript-json` is a transformer library providing JSON related functions.\n\nFor an example, with `typescript-json`, **type check** in the **runtime** is possible. Boosting up **JSON** string conversion speed about **10x times faster** or creating is also possible. Important thing is, all of those features can be used by **only one line**. Besides, other similar libraries like `ajv` or `fast-json-stringify`, they require complicate JSON schema definition.\n\nFurthermore, `typescript-json` does not require any optimizer plan construction in the runtime. Therefore, `typescript-json` is about **10,000x times faster** than `ajv` and `fast-json-stringify`, if compare only one-time JSON string conversion or validation.\n\nOnly JSON string conversion time | Include optimization planning time\n---------------------------------|------------------------------------\n![only-json-string-conversion-time](https://user-images.githubusercontent.com/13158709/172457566-d23100c2-808a-4544-a914-de92d8ec12b0.png) | ![include-optimization-planning-time](https://user-images.githubusercontent.com/13158709/172457381-d8ccbb92-43a1-4c96-aae1-cdac7d2e03cd.png)\n\n### Nestia\nhttps://github.com/samchon/nestia\n\nAutomatic `SDK` and `Swagger` generator for the `NestJS`, evolved than ever.\n\n`nestia` is an evolved `SDK` and `Swagger` generator, which analyzes your `NestJS` server code in the compilation level. With `nestia` and compilation level analyzer, you don't need to write any swagger or class-validator decorators.\n\nReading below table and example code, feel how the \"compilation level\" makes `nestia` stronger.\n\nComponents | `nestia`::SDK | `nestia`::swagger | `@nestjs/swagger`\n-----------|---|---|---\nPure DTO interface | ✔ | ✔ | ❌\nDescription comments | ✔ | ✔ | ❌\nSimple structure | ✔ | ✔ | ✔\nGeneric type | ✔ | ✔ | ❌\nUnion type | ✔ | ✔ | ▲\nIntersection type | ✔ | ✔ | ▲\nConditional type | ✔ | ▲ | ❌\nAuto completion | ✔ | ❌ | ❌\nType hints | ✔ | ❌ | ❌\n2x faster `JSON.stringify()` | ✔ | ❌ | ❌\nEnsure type safety | ✅ | ❌ | ❌\n\n```typescript\n// IMPORT SDK LIBRARY GENERATED BY NESTIA\nimport api from \"@samchon/shopping-api\";\nimport { IPage } from \"@samchon/shopping-api/lib/structures/IPage\";\nimport { ISale } from \"@samchon/shopping-api/lib/structures/ISale\";\nimport { ISaleArticleComment } from \"@samchon/shopping-api/lib/structures/ISaleArticleComment\";\nimport { ISaleQuestion } from \"@samchon/shopping-api/lib/structures/ISaleQuestion\";\n\nexport async function trace_sale_question_and_comment\n    (connection: api.IConnection): Promise\u003cvoid\u003e\n{\n    // LIST UP SALE SUMMARIES\n    const index: IPage\u003cISale.ISummary\u003e = await api.functional.shoppings.sales.index\n    (\n        connection,\n        \"general\",\n        { limit: 100, page: 1 }\n    );\n\n    // PICK A SALE\n    const sale: ISale = await api.functional.shoppings.sales.at\n    (\n        connection, \n        index.data[0].id\n    );\n    console.log(\"sale\", sale);\n\n    // WRITE A QUESTION\n    const question: ISaleQuestion = await api.functional.shoppings.sales.questions.store\n    (\n        connection,\n        \"general\",\n        sale.id,\n        {\n            title: \"How to use this product?\",\n            body: \"The description is not fully enough. Can you introduce me more?\",\n            files: []\n        }\n    );\n    console.log(\"question\", question);\n\n    // WRITE A COMMENT\n    const comment: ISaleArticleComment = await api.functional.shoppings.sales.comments.store\n    (\n        connection,\n        \"general\",\n        sale.id,\n        question.id,\n        {\n            body: \"p.s) Can you send me a detailed catalogue?\",\n            anonymous: false\n        }\n    );\n    console.log(\"comment\", comment);\n}\n```\n\n### Nestia-Helper\nhttps://github.com/samchon/nestia-helper\n\nBoost up `JSON.stringify()` function, of the API responses, 10x times faster.\n\n`nestia-helper` is a helper library of `NestJS`, which can boost up the `JSON.stringify()` function 10x times faster about the API responses. Just by installing and utilizing this `nestia-helper`, your NestJS developed backend server will convert JSON string 10x times faster.\n\n```typescript\nimport helper from \"nestia-helper\";\nimport * as nest from \"@nestjs/common\";\n\n@nest.Controller(\"bbs/articles\")\nexport class BbsArticlesController\n{\n    // JSON.stringify for IPage\u003cIBbsArticle.ISummary\u003e would be 2 times faster \n    @helper.TypedRoute.Get()\n    public get(): Promise\u003cIPage\u003cIBbsArticle.ISummary\u003e\u003e;\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamchon%2Ffast-object","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamchon%2Ffast-object","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamchon%2Ffast-object/lists"}