{"id":23409003,"url":"https://github.com/wjsjtu/frequency-mangle","last_synced_at":"2025-10-28T20:20:48.619Z","repository":{"id":57241711,"uuid":"80988952","full_name":"WJsjtu/frequency-mangle","owner":"WJsjtu","description":null,"archived":false,"fork":false,"pushed_at":"2017-02-08T10:12:08.000Z","size":230,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T01:37:15.006Z","etag":null,"topics":["ast","bundle","frequency","mangle","minify","optimization","property","string"],"latest_commit_sha":null,"homepage":null,"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/WJsjtu.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":"2017-02-05T11:41:20.000Z","updated_at":"2017-02-06T00:08:01.000Z","dependencies_parsed_at":"2022-09-08T00:40:52.050Z","dependency_job_id":null,"html_url":"https://github.com/WJsjtu/frequency-mangle","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/WJsjtu%2Ffrequency-mangle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WJsjtu%2Ffrequency-mangle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WJsjtu%2Ffrequency-mangle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WJsjtu%2Ffrequency-mangle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WJsjtu","download_url":"https://codeload.github.com/WJsjtu/frequency-mangle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247958711,"owners_count":21024821,"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":["ast","bundle","frequency","mangle","minify","optimization","property","string"],"created_at":"2024-12-22T15:19:14.143Z","updated_at":"2025-10-28T20:20:48.527Z","avatar_url":"https://github.com/WJsjtu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# frequency-mangle\nA property/string mangle tools for javascript.\n\n###Install\n`npm install --save-dev frequency-mangle`\n\n###How it works?\n`frequency-mangle` analyze the code by using `esprima`.\n`frequency-mangle` will get all the stats of properties or strings.\n\nThis is very useful when using Babel in development.\n\nBabel will transform React jsx tags into `React.createElement`. If there are lots of tags, there will be hundreds of `createElement` in the bundle even if it is minfied.\n\nSuch problems also occurs when `Babel` transform ES6 Classes. Each ES6 Class will be transform according to template of Babel which contains a lot of strings like \"this hasn't been initialised - super() hasn't been called\", \"Super expression must either be null or a function, not \", \"__esModule\" and etc.\n\nSome properties or words are of high frequency in certain Apps. For example, we will write `this.setState`, `this.state`, `this.props` many times. `React.ProtoTypes` will also be used frequently. ES6 class methods will be transformed into properties of Object by Babel, so some string can also be seen frequently in bundles, such as `componentDidMount`, `componentWillUnmount` and etc.\n  \n`frequency-mangle` gather all the stats of such information and provide a chance to use variables to replace such words.\n\nSimply it can be:\n```\n(function(){\n    var a = \"setState\", b = \"default\", ...\n    this[a]({...})..\n    export[b] ...\n})();\n```\n\n**Caution**: `frequency-mangle` may take a long time to mangle. Make sure you won't use it frequently on large bundles.\n**Note**: `frequency-mangle` will create IIFE to wrap origin code. So do not use it on ES6 with `import` or other codes which may cause side-effect.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwjsjtu%2Ffrequency-mangle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwjsjtu%2Ffrequency-mangle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwjsjtu%2Ffrequency-mangle/lists"}