Comparing version 0.1.1 to 0.3.0
28
index.js
@@ -28,16 +28,20 @@ 'use strict'; | ||
}); | ||
return Object.defineProperty( | ||
return Object.defineProperties( | ||
new (mixinable.bind.apply(mixinable, [mixinable].concat(args)))(), | ||
'__implementations__', | ||
{ | ||
value: keys.reduce(function (result, key) { | ||
result[key] = mixinstances | ||
.filter(function (mixinstance) { | ||
return isFunction(mixinstance[key]); | ||
}) | ||
.map(function (mixinstance) { | ||
return mixinstance[key].bind(mixinstance); | ||
}); | ||
return result; | ||
}, {}) | ||
__clone__: { | ||
value: create.bind.apply(create, [create].concat(args)) | ||
}, | ||
__implementations__: { | ||
value: keys.reduce(function (result, key) { | ||
result[key] = mixinstances | ||
.filter(function (mixinstance) { | ||
return isFunction(mixinstance[key]); | ||
}) | ||
.map(function (mixinstance) { | ||
return mixinstance[key].bind(mixinstance); | ||
}); | ||
return result; | ||
}, {}) | ||
} | ||
} | ||
@@ -44,0 +48,0 @@ ); |
{ | ||
"name": "mixinable", | ||
"version": "0.1.1", | ||
"version": "0.3.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node test.js | tap-spec" | ||
"test": "node test.js | tap-spec", | ||
"postversion": "git push && git push --tags" | ||
}, | ||
@@ -9,0 +10,0 @@ "repository": { |
28
test.js
@@ -23,3 +23,21 @@ 'use strict'; | ||
test('constructor test', function (t) { | ||
test('clone function test', function (t) { | ||
var arg1 = 1; | ||
var arg2 = 2; | ||
var create = mixinable({ | ||
constructor: function (bar, baz) { | ||
this.bar = bar; | ||
this.baz = baz; | ||
} | ||
})(); | ||
var instance = create(arg1); | ||
t.equal(instance.bar, arg1, 'instance has expected 1st property'); | ||
t.equal(instance.baz, undefined, 'instance does not have 2nd property'); | ||
var clone = instance.__clone__(arg2); | ||
t.equal(clone.bar, arg1, 'clone has expected 1st property'); | ||
t.equal(clone.baz, arg2, 'clone has expected 2nd property'); | ||
t.end(); | ||
}); | ||
test('constructor support test', function (t) { | ||
t.plan(4); | ||
@@ -52,3 +70,3 @@ var arg = 1; | ||
test('sync parallel test', function (t) { | ||
test('sync parallel helper test', function (t) { | ||
t.plan(9); | ||
@@ -99,3 +117,3 @@ var arg = 1; | ||
test('async parallel test', function (t) { | ||
test('async parallel helper test', function (t) { | ||
t.plan(14); | ||
@@ -164,3 +182,3 @@ var arg = 1; | ||
test('sync pipe test', function (t) { | ||
test('sync pipe helper test', function (t) { | ||
t.plan(10); | ||
@@ -210,3 +228,3 @@ var arg = 1; | ||
test('async pipe test', function (t) { | ||
test('async pipe helper test', function (t) { | ||
t.plan(11); | ||
@@ -213,0 +231,0 @@ var arg = 1; |
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
62172
368