more
This commit is contained in:
dopeuni444
2025-07-31 12:23:33 +04:00
parent 20b46678b7
commit b5a22951ae
3401 changed files with 331100 additions and 0 deletions

View File

@@ -0,0 +1 @@
node_modules/

22
unified-ai-platform/node_modules/delegates/History.md generated vendored Normal file
View File

@@ -0,0 +1,22 @@
1.0.0 / 2015-12-14
==================
* Merge pull request #12 from kasicka/master
* Add license text
0.1.0 / 2014-10-17
==================
* adds `.fluent()` to api
0.0.3 / 2014-01-13
==================
* fix receiver for .method()
0.0.2 / 2014-01-13
==================
* Object.defineProperty() sucks
* Initial commit

121
unified-ai-platform/node_modules/delegates/index.js generated vendored Normal file
View File

@@ -0,0 +1,121 @@
/**
* Expose `Delegator`.
*/
module.exports = Delegator;
/**
* Initialize a delegator.
*
* @param {Object} proto
* @param {String} target
* @api public
*/
function Delegator(proto, target) {
if (!(this instanceof Delegator)) return new Delegator(proto, target);
this.proto = proto;
this.target = target;
this.methods = [];
this.getters = [];
this.setters = [];
this.fluents = [];
}
/**
* Delegate method `name`.
*
* @param {String} name
* @return {Delegator} self
* @api public
*/
Delegator.prototype.method = function(name){
var proto = this.proto;
var target = this.target;
this.methods.push(name);
proto[name] = function(){
return this[target][name].apply(this[target], arguments);
};
return this;
};
/**
* Delegator accessor `name`.
*
* @param {String} name
* @return {Delegator} self
* @api public
*/
Delegator.prototype.access = function(name){
return this.getter(name).setter(name);
};
/**
* Delegator getter `name`.
*
* @param {String} name
* @return {Delegator} self
* @api public
*/
Delegator.prototype.getter = function(name){
var proto = this.proto;
var target = this.target;
this.getters.push(name);
proto.__defineGetter__(name, function(){
return this[target][name];
});
return this;
};
/**
* Delegator setter `name`.
*
* @param {String} name
* @return {Delegator} self
* @api public
*/
Delegator.prototype.setter = function(name){
var proto = this.proto;
var target = this.target;
this.setters.push(name);
proto.__defineSetter__(name, function(val){
return this[target][name] = val;
});
return this;
};
/**
* Delegator fluent accessor
*
* @param {String} name
* @return {Delegator} self
* @api public
*/
Delegator.prototype.fluent = function (name) {
var proto = this.proto;
var target = this.target;
this.fluents.push(name);
proto[name] = function(val){
if ('undefined' != typeof val) {
this[target][name] = val;
return this;
} else {
return this[target][name];
}
};
return this;
};

View File

@@ -0,0 +1,13 @@
{
"name": "delegates",
"version": "1.0.0",
"repository": "visionmedia/node-delegates",
"description": "delegate methods and accessors to another property",
"keywords": ["delegate", "delegation"],
"dependencies": {},
"devDependencies": {
"mocha": "*",
"should": "*"
},
"license": "MIT"
}