Skip to content

Commit

Permalink
Improve type signatures: Polymer.Base.extend and Polymer.Base.mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksay committed May 25, 2016
1 parent cd0064a commit 8382aa7
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/lib/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,19 @@
* object to a target object.
*
* @method extend
* @param {Object} prototype Target object to copy properties to.
* @param {Object} api Source object to copy properties from.
* @return {Object} prototype object that was passed as first argument.
* @param {?Object} target Target object to copy properties to.
* @param {?Object} source Source object to copy properties from.
* @return {?Object} Target object that was passed as first argument or
* source object if the target was null.
*/
extend: function(prototype, api) {
if (prototype && api) {
var n$ = Object.getOwnPropertyNames(api);
extend: function(target, source) {
if (target && source) {
var n$ = Object.getOwnPropertyNames(source);
for (var i=0, n; (i<n$.length) && (n=n$[i]); i++) {
this.copyOwnProperty(n, api, prototype);
this.copyOwnProperty(n, source, target);
}
}
return prototype || api;
return target || source;
},

/**
Expand All @@ -138,9 +139,9 @@
* to target and that accessor implementations are copied, use `extend`.
*
* @method mixin
* @param {Object} target Target object to copy properties to.
* @param {Object} source Source object to copy properties from.
* @return {Object} Target object that was passed as first argument.
* @param {!Object} target Target object to copy properties to.
* @param {?Object} source Source object to copy properties from.
* @return {!Object} Target object that was passed as first argument.
*/
mixin: function(target, source) {
for (var i in source) {
Expand Down

0 comments on commit 8382aa7

Please sign in to comment.