Socket
Book a DemoInstallSign in
Socket

babel-plugin-transform-mangle-names

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-mangle-names

A JavaScript name mangler plugin for Babel

2.1.2
latest
Source
npmnpm
Version published
Weekly downloads
20
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-transform-mangle-names

An ES2015-aware Babel plugin to generate shorter names for variables and function arguments.

Circle CI

NPM

Installation

$ npm install babel-plugin-transform-mangle-names

Usage

.babelrc

{
  "plugins": ["transform-mangle-names"]
}

Via CLI

$ babel --plugins transform-mangle-names script.js

Example

In

const SEPARATOR = ' ';

function joinNames(first, second) {
  return `${first}${SEPARATOR}${second}`;
}

const reverseName = (name) => name.split('').reverse().join('');

class Person {
  constructor(firstName, lastName, age) {
    this.firstName = firstName;
    this.lastName = lastName;
    this.age = age;
  }

  get fullName() {
    return joinNames(this.firstName, this.lastName);
  }

  reverseName() {
    return reverseName(this.fullName);
  }

  toString() {
    return `${this.fullName} (${this.age} years old)`;
  }
}

const person = new Person("Gnome", "Chompski", 85); // https://youtu.be/8mjky2QE9DA

Out

const a = ' ';

function joinNames(c, d) {
  return `${ c }${ a }${ d }`;
}

const reverseName = c => c.split('').reverse().join('');

class Person {
  constructor(c, d, e) {
    this.firstName = c;
    this.lastName = d;
    this.age = e;
  }

  get fullName() {
    return joinNames(this.firstName, this.lastName);
  }

  reverseName() {
    return reverseName(this.fullName);
  }

  toString() {
    return `${ this.fullName } (${ this.age } years old)`;
  }
}

const b = new Person("Gnome", "Chompski", 85); //https://youtu.be/8mjky2QE9DA

Keywords

babel

FAQs

Package last updated on 01 Jun 2016

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.