rename helper functions to be more reflective of what they do
This commit is contained in:
@@ -37,6 +37,9 @@ Gaps between patch versions are faulty/broken releases.
|
||||
* Freeze tagged template literal object.
|
||||
* Remove inlined `regenerator` fork.
|
||||
* Remove `ParenthesizedExpression`.
|
||||
* Rename `object-spread` helper to `object-without-properties`.
|
||||
* Rename `class-props` helper to `prototype-properties`.
|
||||
* Rename `extends` helper to `inherits`.
|
||||
|
||||
## 1.15.0
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@ function File(opts) {
|
||||
}
|
||||
|
||||
File.declarations = [
|
||||
"extends",
|
||||
"class-props",
|
||||
"inherits",
|
||||
"prototype-properties",
|
||||
"apply-constructor",
|
||||
"tagged-template-literal",
|
||||
"interop-require",
|
||||
"to-array",
|
||||
"object-spread",
|
||||
"object-without-properties",
|
||||
"has-own",
|
||||
"slice"
|
||||
];
|
||||
|
||||
@@ -77,7 +77,7 @@ Class.prototype.run = function () {
|
||||
//
|
||||
|
||||
if (superName) {
|
||||
body.push(t.expressionStatement(t.callExpression(file.addDeclaration("extends"), [className, superName])));
|
||||
body.push(t.expressionStatement(t.callExpression(file.addDeclaration("inherits"), [className, superName])));
|
||||
}
|
||||
|
||||
this.buildBody();
|
||||
@@ -156,7 +156,7 @@ Class.prototype.buildBody = function () {
|
||||
if (instanceProps) args.push(instanceProps);
|
||||
|
||||
body.push(t.expressionStatement(
|
||||
t.callExpression(this.file.addDeclaration("class-props"), args)
|
||||
t.callExpression(this.file.addDeclaration("prototype-properties"), args)
|
||||
));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ var pushObjectPattern = function (opts, nodes, pattern, parentId) {
|
||||
}
|
||||
keys = t.arrayExpression(keys);
|
||||
|
||||
var value = t.callExpression(opts.file.addDeclaration("object-spread"), [parentId, keys]);
|
||||
var value = t.callExpression(opts.file.addDeclaration("object-without-properties"), [parentId, keys]);
|
||||
nodes.push(buildVariableAssign(opts, prop.argument, value));
|
||||
} else {
|
||||
var pattern2 = prop.value;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var _slice = Array.prototype.slice;
|
||||
var _extends = function (child, parent) {
|
||||
var _inherits = function (child, parent) {
|
||||
child.prototype = Object.create(parent && parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
@@ -26,7 +26,7 @@ var Test = function Test() {
|
||||
Foo.prototype.test.call.apply(Foo.prototype, [this, "test"].concat(_slice.call(arguments)));
|
||||
};
|
||||
|
||||
_extends(Test, Foo);
|
||||
_inherits(Test, Foo);
|
||||
|
||||
Test.prototype.test = function () {
|
||||
Foo.prototype.test.call(this);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
var _inherits = function (child, parent) {
|
||||
child.prototype = Object.create(parent && parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
@@ -17,4 +17,4 @@ var Test = function Test() {
|
||||
Foo.prototype.test.whatever;
|
||||
};
|
||||
|
||||
_extends(Test, Foo);
|
||||
_inherits(Test, Foo);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
var _inherits = function (child, parent) {
|
||||
child.prototype = Object.create(parent && parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
@@ -17,7 +17,7 @@ var Test = function Test() {
|
||||
Foo.prototype.test.call(this);
|
||||
};
|
||||
|
||||
_extends(Test, Foo);
|
||||
_inherits(Test, Foo);
|
||||
|
||||
Test.test = function () {
|
||||
return Foo.wow.call(this);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
var _inherits = function (child, parent) {
|
||||
child.prototype = Object.create(parent && parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
@@ -20,4 +20,4 @@ var Foo = function Foo() {
|
||||
this.state = "test";
|
||||
};
|
||||
|
||||
_extends(Foo, Bar);
|
||||
_inherits(Foo, Bar);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
var _prototypeProperties = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Test = function Test() {};
|
||||
|
||||
_classProps(Test, null, {
|
||||
_prototypeProperties(Test, null, {
|
||||
test: {
|
||||
get: function () {
|
||||
return 5 + 5;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
var _prototypeProperties = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Test = function Test() {};
|
||||
|
||||
_classProps(Test, null, {
|
||||
_prototypeProperties(Test, null, {
|
||||
test: {
|
||||
get: function () {
|
||||
return 5 + 5;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
var _prototypeProperties = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Test = function Test() {};
|
||||
|
||||
_classProps(Test, null, {
|
||||
_prototypeProperties(Test, null, {
|
||||
test: {
|
||||
set: function (val) {
|
||||
this._test = val;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
var _prototypeProperties = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
@@ -9,7 +9,7 @@ var A = function A() {};
|
||||
|
||||
A.a = function () {};
|
||||
|
||||
_classProps(A, {
|
||||
_prototypeProperties(A, {
|
||||
b: {
|
||||
get: function () {},
|
||||
set: function (b) {},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
var _inherits = function (child, parent) {
|
||||
child.prototype = Object.create(parent && parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
@@ -18,7 +18,7 @@ var BaseController = function BaseController() {
|
||||
}
|
||||
};
|
||||
|
||||
_extends(BaseController, Chaplin.Controller);
|
||||
_inherits(BaseController, Chaplin.Controller);
|
||||
|
||||
var BaseController2 = function BaseController2() {
|
||||
if (Chaplin.Controller.Another) {
|
||||
@@ -26,4 +26,4 @@ var BaseController2 = function BaseController2() {
|
||||
}
|
||||
};
|
||||
|
||||
_extends(BaseController2, Chaplin.Controller.Another);
|
||||
_inherits(BaseController2, Chaplin.Controller.Another);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
var _inherits = function (child, parent) {
|
||||
child.prototype = Object.create(parent && parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
@@ -20,4 +20,4 @@ var Q = function Q() {
|
||||
}
|
||||
};
|
||||
|
||||
_extends(Q, _QSuper);
|
||||
_inherits(Q, _QSuper);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
var _inherits = function (child, parent) {
|
||||
child.prototype = Object.create(parent && parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
@@ -18,4 +18,4 @@ var Test = function Test() {
|
||||
}
|
||||
};
|
||||
|
||||
_extends(Test, Foo);
|
||||
_inherits(Test, Foo);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var _objectSpread = function (obj, keys) {
|
||||
var _objectWithoutProperties = function (obj, keys) {
|
||||
var target = {};
|
||||
for (var i in obj) {
|
||||
if (keys.indexOf(i) >= 0) continue;
|
||||
@@ -11,12 +11,12 @@ var _objectSpread = function (obj, keys) {
|
||||
return target;
|
||||
};
|
||||
|
||||
var x = _objectSpread(z, []);
|
||||
var x = _objectWithoutProperties(z, []);
|
||||
|
||||
var x = z.x;
|
||||
var y = _objectSpread(z, ["x"]);
|
||||
var y = _objectWithoutProperties(z, ["x"]);
|
||||
|
||||
(function (_ref) {
|
||||
var x = _ref.x;
|
||||
var y = _objectSpread(_ref, ["x"]);
|
||||
var y = _objectWithoutProperties(_ref, ["x"]);
|
||||
});
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
var _prototypeProperties = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Foo = function Foo() {};
|
||||
|
||||
_classProps(Foo, null, (function (_ref) {
|
||||
_prototypeProperties(Foo, null, (function (_ref) {
|
||||
_ref[bar] = {
|
||||
get: function () {
|
||||
if (this._memoDone) return this._memo;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var _classProps = function (child, staticProps, instanceProps) {
|
||||
var _prototypeProperties = function (child, staticProps, instanceProps) {
|
||||
if (staticProps) Object.defineProperties(child, staticProps);
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Test = function Test() {};
|
||||
|
||||
_classProps(Test, null, {
|
||||
_prototypeProperties(Test, null, {
|
||||
bar: {
|
||||
get: function () {
|
||||
throw new Error("wow");
|
||||
|
||||
Reference in New Issue
Block a user