summaryrefslogtreecommitdiffstats
path: root/common/src/main/webapp/usageguide/appserver/node_modules/mongoose/lib/virtualtype.js
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/main/webapp/usageguide/appserver/node_modules/mongoose/lib/virtualtype.js')
-rw-r--r--common/src/main/webapp/usageguide/appserver/node_modules/mongoose/lib/virtualtype.js103
1 files changed, 0 insertions, 103 deletions
diff --git a/common/src/main/webapp/usageguide/appserver/node_modules/mongoose/lib/virtualtype.js b/common/src/main/webapp/usageguide/appserver/node_modules/mongoose/lib/virtualtype.js
deleted file mode 100644
index f43cbe2..0000000
--- a/common/src/main/webapp/usageguide/appserver/node_modules/mongoose/lib/virtualtype.js
+++ /dev/null
@@ -1,103 +0,0 @@
-
-/**
- * VirtualType constructor
- *
- * This is what mongoose uses to define virtual attributes via `Schema.prototype.virtual`.
- *
- * ####Example:
- *
- * var fullname = schema.virtual('fullname');
- * fullname instanceof mongoose.VirtualType // true
- *
- * @parma {Object} options
- * @api public
- */
-
-function VirtualType(options, name) {
- this.path = name;
- this.getters = [];
- this.setters = [];
- this.options = options || {};
-}
-
-/**
- * Defines a getter.
- *
- * ####Example:
- *
- * var virtual = schema.virtual('fullname');
- * virtual.get(function () {
- * return this.name.first + ' ' + this.name.last;
- * });
- *
- * @param {Function} fn
- * @return {VirtualType} this
- * @api public
- */
-
-VirtualType.prototype.get = function(fn) {
- this.getters.push(fn);
- return this;
-};
-
-/**
- * Defines a setter.
- *
- * ####Example:
- *
- * var virtual = schema.virtual('fullname');
- * virtual.set(function (v) {
- * var parts = v.split(' ');
- * this.name.first = parts[0];
- * this.name.last = parts[1];
- * });
- *
- * @param {Function} fn
- * @return {VirtualType} this
- * @api public
- */
-
-VirtualType.prototype.set = function(fn) {
- this.setters.push(fn);
- return this;
-};
-
-/**
- * Applies getters to `value` using optional `scope`.
- *
- * @param {Object} value
- * @param {Object} scope
- * @return {any} the value after applying all getters
- * @api public
- */
-
-VirtualType.prototype.applyGetters = function(value, scope) {
- var v = value;
- for (var l = this.getters.length - 1; l >= 0; l--) {
- v = this.getters[l].call(scope, v, this);
- }
- return v;
-};
-
-/**
- * Applies setters to `value` using optional `scope`.
- *
- * @param {Object} value
- * @param {Object} scope
- * @return {any} the value after applying all setters
- * @api public
- */
-
-VirtualType.prototype.applySetters = function(value, scope) {
- var v = value;
- for (var l = this.setters.length - 1; l >= 0; l--) {
- v = this.setters[l].call(scope, v, this);
- }
- return v;
-};
-
-/*!
- * exports
- */
-
-module.exports = VirtualType;