Giter Club home page Giter Club logo

babel-preset-unminify's Introduction

babel-preset-unminify

make minified code more readable.

npm travis standard

Install

npm install babel-preset-unminify

Example

Input:

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.dlv=n()}(this,function(){return function(e,n,t,o){for(o=0,n=n.split?n.split("."):n;e&&o<n.length;)e=e[n[o++]];return void 0===e||o<n.length?t:e}});
//# sourceMappingURL=dlv.umd.js.map

Output:

!(function(freci, iliet) {
  if ('object' == typeof exports && 'undefined' != typeof module) {
    module.exports = iliet()
  } else if ('function' == typeof define && define.amd) {
    define(iliet)
  } else {
    freci.dlv = iliet()
  }
})(this, function() {
  return function(habuk, hodoy, bedat, quetif) {
    quetif = 0
    for (hodoy = hodoy.split ? hodoy.split('.') : hodoy; habuk && quetif < hodoy.length; ) {
      habuk = habuk[hodoy[quetif++]]
    }
    if (void 0 === habuk || quetif < hodoy.length) {
      return bedat
    } else {
      return habuk
    }
  }
})

Usage

Unlike other Babel presets, this one should normally not be used with a Babel config file. Instead, use the included CLI:

npx babel-preset-unminify < input.min.js > formatted.js

Or use it via the Babel Node API:

var babel = require('@babel/core')
var unminify = require('babel-preset-unminify')

babel.transformSync(sourceCode, {
  presets: [unminify]
})

Options

For each option, the -- version is the CLI syntax, and the name: val is the Node API syntax.

--no-words, words: false

Disable phonetic variable name generation. By default this preset finds mangled variable names (3 characters or less) and generates unique names for them. Minifiers often reuse single-character names. This option allows easily manually renaming variables afterwards, using a simple search/replace over entire files at a time. If the source code doesn't use variable name mangling or something you can disable the words option.

License

Apache-2.0

babel-preset-unminify's People

Contributors

goto-bus-stop avatar

Stargazers

Marcos Porto avatar Cat  avatar Andrew Chou avatar  avatar ivan k avatar Radu Micu avatar Daniel Rubin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.