You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
562 B
21 lines
562 B
1 month ago
|
"use strict";
|
||
|
|
||
|
module.exports.mixin = function mixin(target, source) {
|
||
|
const keys = Object.getOwnPropertyNames(source);
|
||
|
for (let i = 0; i < keys.length; ++i) {
|
||
|
Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i]));
|
||
|
}
|
||
|
};
|
||
|
|
||
|
module.exports.wrapperSymbol = Symbol("wrapper");
|
||
|
module.exports.implSymbol = Symbol("impl");
|
||
|
|
||
|
module.exports.wrapperForImpl = function (impl) {
|
||
|
return impl[module.exports.wrapperSymbol];
|
||
|
};
|
||
|
|
||
|
module.exports.implForWrapper = function (wrapper) {
|
||
|
return wrapper[module.exports.implSymbol];
|
||
|
};
|
||
|
|