Coder Social home page Coder Social logo

goog-base-migrator's Introduction

goog-base-migrator

Build Status NPM version Coverage Status Code Climate
Dependency Status devDependency Status

Migration tool from goog.base to static base class methods.

Install

$ npm install -g goog-base-migrator

How to use

Find and confirm replacement with --debug option.

View demo

$ goog-base-migrator test/fixture/basic.js --debug
File: test/fixture/basic.js
before: goog.base(this, opt_domHelper)
 after: my.app.Sample.base(this, 'constructor', opt_domHelper)
before: goog.base(this, 'enterDocument')
 after: my.app.Sample.base(this, 'enterDocument')
before: goog.base(this, 'renderBefore', sibling)
 after: my.app.Sample.base(this, 'renderBefore', sibling)
before: goog.base(this, 'disposeInternal')
 after: my.app.Sample.base(this, 'disposeInternal')
Found 4 expressions.

OK, fix it with --fix-in-place option!

View demo

$ goog-base-migrator test/fixture/basic.js --fix-in-place
File: test/fixture/basic.js
Fixed 4 expressions.
$ git diff test/fixture/basic.js
diff --git a/test/fixture/basic.js b/test/fixture/basic.js
index f74e4fc..fa57b6f 100644
--- a/test/fixture/basic.js
+++ b/test/fixture/basic.js
@@ -12,7 +12,7 @@ goog.require('goog.ui.Component');
  * @extends {goog.ui.Component}
  */
 my.app.Sample = function(opt_domHelper) {
-  goog.base(this, opt_domHelper);
+  my.app.Sample.base(this, 'constructor', opt_domHelper);

   /**
    * @type {number}
@@ -24,16 +24,16 @@ goog.inherits(my.app.Sample, goog.ui.Component);

 /** @override */
 my.app.Sample.prototype.enterDocument = function() {
-  goog.base(this, 'enterDocument');
+  my.app.Sample.base(this, 'enterDocument');
 };

 /** @override */
 my.app.Sample.prototype.renderBefore = function(sibling) {
-  goog.base(this, 'renderBefore', sibling);
+  my.app.Sample.base(this, 'renderBefore', sibling);
 };

 /** @override */
 my.app.Sample.prototype.disposeInternal = function() {
-  goog.base(this, 'disposeInternal');
+  my.app.Sample.base(this, 'disposeInternal');
   delete this.number_;
 };

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 0.2.0 (2014/11/19) Support the commented arguments.
  • 0.1.0 (2014/04/21) Support the expression to assign result of goog.base().
  • 0.0.1 (2014/04/20) Initial release.

License

Copyright (c) 2014 ama-ch
Licensed under the MIT license.

goog-base-migrator's People

Contributors

ama-ch avatar

Watchers

 avatar  avatar

goog-base-migrator's Issues

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.