{"id":15879073,"url":"https://github.com/keyz/babel-plugin-transform-optimize-object-literal","last_synced_at":"2025-03-16T09:33:39.477Z","repository":{"id":46911124,"uuid":"220756410","full_name":"keyz/babel-plugin-transform-optimize-object-literal","owner":"keyz","description":"Rewrites object and array literals with JSON.parse calls.","archived":false,"fork":false,"pushed_at":"2023-01-05T06:16:17.000Z","size":7639,"stargazers_count":5,"open_issues_count":14,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T22:56:01.378Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.org/package/babel-plugin-transform-optimize-object-literal","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/keyz.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":"2019-11-10T07:28:58.000Z","updated_at":"2023-03-10T11:02:31.000Z","dependencies_parsed_at":"2023-02-03T15:15:49.183Z","dependency_job_id":null,"html_url":"https://github.com/keyz/babel-plugin-transform-optimize-object-literal","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keyz%2Fbabel-plugin-transform-optimize-object-literal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keyz%2Fbabel-plugin-transform-optimize-object-literal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keyz%2Fbabel-plugin-transform-optimize-object-literal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keyz%2Fbabel-plugin-transform-optimize-object-literal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keyz","download_url":"https://codeload.github.com/keyz/babel-plugin-transform-optimize-object-literal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243658215,"owners_count":20326465,"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":[],"created_at":"2024-10-06T03:00:33.174Z","updated_at":"2025-03-16T09:33:37.929Z","avatar_url":"https://github.com/keyz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# babel-plugin-transform-optimize-object-literal\n\n[![Node.js CI](https://github.com/keyz/babel-plugin-transform-optimize-object-literal/workflows/Node.js%20CI/badge.svg)](https://github.com/keyz/babel-plugin-transform-optimize-object-literal/actions \"CI Status\") [![npm version](http://img.shields.io/npm/v/babel-plugin-transform-optimize-object-literal.svg?style=flat)](https://npmjs.org/package/babel-plugin-transform-optimize-object-literal \"View on npm\")\n\nBecause I heard `JSON.parse` is blazing fast https://v8.dev/blog/cost-of-javascript-2019#json\n\nInput:\n\n```javascript\nconst foo = { a: \"3\", d: \"f\" };\nconst bar = [1, 4, -2, true, false, {}, \"ok\"];\n```\n\nOutput:\n\n```javascript\nconst foo = JSON.parse('{\"a\":\"3\",\"d\":\"f\"}');\nconst bar = JSON.parse('[1,4,-2,true,false,{},\"ok\"]');\n```\n\n## Usage\n\n```\nyarn add -D babel-plugin-transform-optimize-object-literal\n```\n\n`.babelrc`:\n\n```json\n{\n  \"plugins\": [\n    [\n      \"babel-plugin-transform-optimize-object-literal\",\n      {\n        \"skipArrayOptimizationIfLengthIsBelow\": 0,\n        \"skipObjectOptimizationIfLengthIsBelow\": 0\n      }\n    ]\n  ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeyz%2Fbabel-plugin-transform-optimize-object-literal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeyz%2Fbabel-plugin-transform-optimize-object-literal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeyz%2Fbabel-plugin-transform-optimize-object-literal/lists"}