dotfiles/.vscode/extensions/saviorisdead.RustyCode-0.18.0/node_modules/deprecated/index.js
Cyryl Płotnicki 2f946d6200 Add .vscode
2016-09-11 10:29:13 +02:00

39 lines
No EOL
721 B
JavaScript

var deprecated = {
method: function(msg, log, fn) {
var called = false;
return function(){
if (!called) {
called = true;
log(msg);
}
return fn.apply(this, arguments);
};
},
field: function(msg, log, parent, field, val) {
var called = false;
var getter = function(){
if (!called) {
called = true;
log(msg);
}
return val;
};
var setter = function(v) {
if (!called) {
called = true;
log(msg);
}
val = v;
return v;
};
Object.defineProperty(parent, field, {
get: getter,
set: setter,
enumerable: true
});
return;
}
};
module.exports = deprecated;