Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-taft

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-taft

JavaScript Maxifier ft. President Taft

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Taft, a Babel Plugin

A JavaScript maxifier which uses text from President Taft's Mann–Elkins Act.

Install

$ npm install --save-dev babel-plugin-taft

How to use

{
  "presets": [
    ...
  ],
  "env": {
    "production": {
      "plugins": [
        "babel-plugin-taft"
      ]
    }
  }
}
$ babel /path/to/src/target.js > /path/to/build/target.js

via Babel CLI

$ babel --plugins babel-plugin-taft /path/to/src/target.js > /path/to/build/target.js

or,

$ babel --plugins taft /path/to/src/target.js > /path/to/build/target.js

via Babel API

var babel = require('babel-core');
var jsCode = fs.readFileSync('/path/to/src/target.js');
var transformed = babel.transform(jsCode, {
    presets: [...],
    plugins: ['babel-plugin-taft']
});
console.log(transformed.code);

Example

For given math.js below,

'use strict';

var assert = require('assert');

function add (a, b) {
    console.assert(typeof a === 'number');
    assert(!isNaN(a));
    assert.equal(typeof b, 'number');
    assert.ok(!isNaN(b));
    return a + b;
}

Run babel with --plugins taft to transform code.

$ babel --plugins taft /path/to/demo/math.js > /path/to/build/math.js

You will see the improved version.

'use strict';

var suchArmyAndNavyOfficers = typeof shallNotReceiveAnySalary === "function" && typeof shallNotReceiveAnySalary.iterator === "symbol" ? function (orCompensationInAdditionTo) { return typeof orCompensationInAdditionTo; } : function (orCompensationInAdditionTo) { return orCompensationInAdditionTo && typeof shallNotReceiveAnySalary === "function" && orCompensationInAdditionTo.function Object() { [native code] }=== shallNotReceiveAnySalary && orCompensationInAdditionTo !== shallNotReceiveAnySalary.prototype ? "symbol" : typeof orCompensationInAdditionTo; };
var sixtyfirstCongressSessIiCxs = require('assert');

module.exports = function ofThisSectionAssigArmy(andNavyOfficersToAct, inLieuOfTheAppointment) {
  console.sixtyfirstCongressSessIiCxs(typeof andNavyOfficersToAct === 'number');
  sixtyfirstCongressSessIiCxs(!ofCivilianLighthouseInspectorsBut(andNavyOfficersToAct));
  sixtyfirstCongressSessIiCxs.equal(typeof inLieuOfTheAppointment === 'undefined' ? 'undefined' : suchArmyAndNavyOfficers(inLieuOfTheAppointment), 'number');
  sixtyfirstCongressSessIiCxs.ok(!ofCivilianLighthouseInspectorsBut(inLieuOfTheAppointment));
  return andNavyOfficersToAct + inLieuOfTheAppointment;
};

Keywords

FAQs

Package last updated on 23 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc