smart-mixin
Advanced tools
Comparing version 1.0.3 to 1.1.0
17
index.js
@@ -32,2 +32,15 @@ var objToStr = function(x){ return Object.prototype.toString.call(x); }; | ||
function setNonEnumerable(target, key, value){ | ||
if (key in target){ | ||
target[key] = value; | ||
} | ||
else { | ||
Object.defineProperty(target, key, { | ||
value: value, | ||
writable: true, | ||
configurable: true | ||
}); | ||
} | ||
} | ||
return function applyMixin(source, mixin){ | ||
@@ -52,3 +65,3 @@ Object.keys(mixin).forEach(function(key){ | ||
var fn = rule(left, right, key); | ||
source[key] = wrapIfFunction(fn); | ||
setNonEnumerable(source, key, wrapIfFunction(fn)); | ||
return; | ||
@@ -67,3 +80,3 @@ } | ||
// the default is to throw | ||
source[key] = wrapIfFunction(opts.unknownFunction(left, right, key)); | ||
setNonEnumerable(source, key, wrapIfFunction(opts.unknownFunction(left, right, key))); | ||
return; | ||
@@ -70,0 +83,0 @@ } |
{ | ||
"name": "smart-mixin", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24004
454