{"id":18552421,"url":"https://github.com/andrejewski/babel-plugin-taft","last_synced_at":"2025-05-15T11:12:46.521Z","repository":{"id":68511619,"uuid":"89158885","full_name":"andrejewski/babel-plugin-taft","owner":"andrejewski","description":"JavaScript Maxifier ft. President Taft","archived":false,"fork":false,"pushed_at":"2017-04-23T18:55:31.000Z","size":49,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-15T11:12:38.651Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrejewski.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-23T17:15:30.000Z","updated_at":"2017-08-17T17:52:58.000Z","dependencies_parsed_at":"2023-03-11T03:48:54.453Z","dependency_job_id":null,"html_url":"https://github.com/andrejewski/babel-plugin-taft","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"2a709f571a53a3a9f69cd79742746dd37bfefb10"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrejewski%2Fbabel-plugin-taft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrejewski%2Fbabel-plugin-taft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrejewski%2Fbabel-plugin-taft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrejewski%2Fbabel-plugin-taft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrejewski","download_url":"https://codeload.github.com/andrejewski/babel-plugin-taft/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254328389,"owners_count":22052633,"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-11-06T21:14:10.132Z","updated_at":"2025-05-15T11:12:41.512Z","avatar_url":"https://github.com/andrejewski.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Taft, a Babel Plugin\n\nA JavaScript maxifier which uses text from President Taft's [Mann–Elkins Act](https://en.wikipedia.org/wiki/Mann%E2%80%93Elkins_Act).\n\nInstall\n---------------------------------------\n\n```\n$ npm install --save-dev babel-plugin-taft\n```\n\nHow to use\n---------------------------------------\n\n### via [.babelrc](http://babeljs.io/docs/usage/babelrc/) (Recommended)\n\n```javascript\n{\n  \"presets\": [\n    ...\n  ],\n  \"env\": {\n    \"production\": {\n      \"plugins\": [\n        \"babel-plugin-taft\"\n      ]\n    }\n  }\n}\n```\n\n```\n$ babel /path/to/src/target.js \u003e /path/to/build/target.js\n```\n\n\n### via [Babel CLI](http://babeljs.io/docs/usage/cli/)\n\n```\n$ babel --plugins babel-plugin-taft /path/to/src/target.js \u003e /path/to/build/target.js\n```\n\nor,\n\n```\n$ babel --plugins taft /path/to/src/target.js \u003e /path/to/build/target.js\n```\n\n\n### via [Babel API](http://babeljs.io/docs/usage/api/)\n\n```javascript\nvar babel = require('babel-core');\nvar jsCode = fs.readFileSync('/path/to/src/target.js');\nvar transformed = babel.transform(jsCode, {\n    presets: [...],\n    plugins: ['babel-plugin-taft']\n});\nconsole.log(transformed.code);\n```\n\nExample\n---------------------------------------\n\nFor given `math.js` below,\n\n```javascript\n'use strict';\n\nvar assert = require('assert');\n\nfunction add (a, b) {\n    console.assert(typeof a === 'number');\n    assert(!isNaN(a));\n    assert.equal(typeof b, 'number');\n    assert.ok(!isNaN(b));\n    return a + b;\n}\n```\n\nRun `babel` with `--plugins taft` to transform code.\n\n```\n$ babel --plugins taft /path/to/demo/math.js \u003e /path/to/build/math.js\n```\n\nYou will see the improved version.\n\n```javascript\n'use strict';\n\nvar suchArmyAndNavyOfficers = typeof shallNotReceiveAnySalary === \"function\" \u0026\u0026 typeof shallNotReceiveAnySalary.iterator === \"symbol\" ? function (orCompensationInAdditionTo) { return typeof orCompensationInAdditionTo; } : function (orCompensationInAdditionTo) { return orCompensationInAdditionTo \u0026\u0026 typeof shallNotReceiveAnySalary === \"function\" \u0026\u0026 orCompensationInAdditionTo.function Object() { [native code] }=== shallNotReceiveAnySalary \u0026\u0026 orCompensationInAdditionTo !== shallNotReceiveAnySalary.prototype ? \"symbol\" : typeof orCompensationInAdditionTo; };\nvar sixtyfirstCongressSessIiCxs = require('assert');\n\nmodule.exports = function ofThisSectionAssigArmy(andNavyOfficersToAct, inLieuOfTheAppointment) {\n  console.sixtyfirstCongressSessIiCxs(typeof andNavyOfficersToAct === 'number');\n  sixtyfirstCongressSessIiCxs(!ofCivilianLighthouseInspectorsBut(andNavyOfficersToAct));\n  sixtyfirstCongressSessIiCxs.equal(typeof inLieuOfTheAppointment === 'undefined' ? 'undefined' : suchArmyAndNavyOfficers(inLieuOfTheAppointment), 'number');\n  sixtyfirstCongressSessIiCxs.ok(!ofCivilianLighthouseInspectorsBut(inLieuOfTheAppointment));\n  return andNavyOfficersToAct + inLieuOfTheAppointment;\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrejewski%2Fbabel-plugin-taft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrejewski%2Fbabel-plugin-taft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrejewski%2Fbabel-plugin-taft/lists"}