Permalink
Browse files

fixed a few documentation issues

  • Loading branch information...
1 parent 2b427cd commit 383dca42b29295f2aa1b903425d7065a46c3ca39 @mikedeboer committed Feb 22, 2013
Showing with 155 additions and 162 deletions.
  1. +3 −3 lib/DAV/backends/ftp/node.js
  2. +1 −1 lib/DAV/backends/sftp/directory.js
  3. +2 −3 lib/VObject/component/VCalendar.js
  4. +149 −155 lib/shared/base.js
@@ -46,9 +46,9 @@ var jsDAV_Ftp_Node = module.exports = jsDAV_iNode.extend(jsDAV_iProperties, {
* @return {Number}
*/
getLastModified: function(cbftpgetlm) {
- /** Last modification date can't be figured out for root node, because there isn't one.
- * Therefore, return a future date to force update. @todo implement this properly */
- return cbftpgetlm(null, new Date().toUTCString());
+ // Last modification date can't be figured out for root node, because there isn't one.
+ // Therefore, return a future date to force update. @todo implement this properly
+ return cbftpgetlm(null, new Date().toUTCString());
},
$isRoot: function() {
@@ -47,7 +47,7 @@ var jsDAV_SFTP_Directory = module.exports = jsDAV_SFTP_Node.extend(jsDAV_Collect
*/
createDirectory: function(name, cbfscreatedir) {
var newPath = this.path + "/" + name.replace(/[\/]+$/, "");
- this.sftp.mkdir(newPath, 0755, cbfscreatedir);
+ this.sftp.mkdir(newPath, "0755", cbfscreatedir);
},
/**
@@ -116,7 +116,7 @@ var jsVObject_Component_VCalendar = module.exports = jsVObject_Component.extend(
delete this.VTIMEZONE;
},
- /**
+ /*
* Validates the node for correctness.
* An array is returned with warnings.
*
@@ -126,8 +126,7 @@ var jsVObject_Component_VCalendar = module.exports = jsVObject_Component.extend(
* * node - (reference to the offending node)
*
* @return array
- */
- /*
+ *
validate: function() {
var warnings = [];
View
@@ -15,20 +15,19 @@ var Base = module.exports = Object.freeze(Object.create(Object.prototype, {
value: [UUID]
},
/**
- * Base.news() -> Object
- *
- * Creates an object that inherits from `this` object (Analog of
- * `new Object()`).
- *
- * ## Example
- *
- * var Dog = Base.extend({
- * bark: function bark() {
- * return "Ruff! Ruff!";
- * }
- * });
- * var dog = Dog.new();
- **/
+ * Creates an object that inherits from `this` object (Analog of
+ * `new Object()`).
+ *
+ * Example:
+ * var Dog = Base.extend({
+ * bark: function bark() {
+ * return "Ruff! Ruff!";
+ * }
+ * });
+ * var dog = Dog.new();
+ *
+ * @type {Object}
+ */
"new": {
value: function create() {
var object = Object.create(this);
@@ -37,42 +36,41 @@ var Base = module.exports = Object.freeze(Object.create(Object.prototype, {
}
},
/**
- * Base#intialize() -> null
- *
- * When new instance of the this prototype is created it's `initialize`
- * method is called with all the arguments passed to the `new`. You can
- * override `initialize` to set up an instance.
- **/
+ * When new instance of the this prototype is created it's `initialize`
+ * method is called with all the arguments passed to the `new`. You can
+ * override `initialize` to set up an instance.
+ *
+ * @type {mixed}
+ */
initialize: {
value: function initialize() {}
},
/**
- * Base#merge(obj1[, obj2][, obj3]) -> null
- * - obj1 (Object): override prototype's properties with the values in this object
- *
- * Merges all the properties of the passed objects into `this` instance (This
- * method can be used on instances only as prototype objects are frozen).
- *
- * If two or more argument objects have own properties with the same name,
- * the property is overridden, with precedence from right to left, implying,
- * that properties of the object on the left are overridden by a same named
- * property of the object on the right.
- *
- * ## Example
- *
- * var Pet = Dog.extend({
- * initialize: function initialize(options) {
- * // this.name = options.name -> would have thrown (frozen prototype)
- * this.merge(options) // will override all properties.
- * },
- * call: function(name) {
- * return this.name === name ? this.bark() : "";
- * },
- * name: null
- * });
- * var pet = Pet.new({ name: "Pippa", breed: "Jack Russell" });
- * pet.call("Pippa"); // 'Ruff! Ruff!'
- **/
+ * Merges all the properties of the passed objects into `this` instance (This
+ * method can be used on instances only as prototype objects are frozen).
+ *
+ * If two or more argument objects have own properties with the same name,
+ * the property is overridden, with precedence from right to left, implying,
+ * that properties of the object on the left are overridden by a same named
+ * property of the object on the right.
+ *
+ * Example:
+ * var Pet = Dog.extend({
+ * initialize: function initialize(options) {
+ * // this.name = options.name -> would have thrown (frozen prototype)
+ * this.merge(options) // will override all properties.
+ * },
+ * call: function(name) {
+ * return this.name === name ? this.bark() : "";
+ * },
+ * name: null
+ * });
+ * var pet = Pet.new({ name: "Pippa", breed: "Jack Russell" });
+ * pet.call("Pippa"); // 'Ruff! Ruff!'
+ *
+ * @param {Object} [obj1] override prototype's properties with the values in this object
+ * @type {void}
+ */
merge: {
value: function merge() {
var descriptor = {};
@@ -110,121 +108,117 @@ var Base = module.exports = Object.freeze(Object.create(Object.prototype, {
}
},
/**
- * Base.extend(obj1[, obj2][obj3]) -> Object
- * - obj1 (Object): extend object's properties with the values in this object
- *
- * Takes any number of argument objects and returns frozen, composite object
- * that inherits from `this` object and combines all of the own properties of
- * the argument objects. (Objects returned by this function are frozen as
- * they are intended to be used as types).
- *
- * If two or more argument objects have own properties with the same name,
- * the property is overridden, with precedence from right to left, implying,
- * that properties of the object on the left are overridden by a same named
- * property of the object on the right.
- *
- * ## Examples
- *
- * // ### Object composition ###
- *
- * var HEX = Base.extend({
- * hex: function hex() {
- * return "#" + this.color;
- * }
- * });
- *
- * var RGB = Base.extend({
- * red: function red() {
- * return parseInt(this.color.substr(0, 2), 16);
- * },
- * green: function green() {
- * return parseInt(this.color.substr(2, 2), 16);
- * },
- * blue: function blue() {
- * return parseInt(this.color.substr(4, 2), 16);
- * }
- * });
- *
- * var CMYK = Base.extend(RGB, {
- * black: function black() {
- * var color = Math.max(Math.max(this.red(), this.green()), this.blue());
- * return (1 - color / 255).toFixed(4);
- * },
- * cyan: function cyan() {
- * var K = this.black();
- * return (((1 - this.red() / 255).toFixed(4) - K) / (1 - K)).toFixed(4);
- * },
- * magenta: function magenta() {
- * var K = this.black();
- * return (((1 - this.green() / 255).toFixed(4) - K) / (1 - K)).toFixed(4);
- * },
- * yellow: function yellow() {
- * var K = this.black();
- * return (((1 - this.blue() / 255).toFixed(4) - K) / (1 - K)).toFixed(4);
- * }
- * });
- *
- * var Color = Base.extend(HEX, RGB, CMYK, {
- * initialize: function Color(color) {
- * this.color = color;
- * }
- * });
- *
- * // ### Prototypal inheritance ###
- *
- * var Pixel = Color.extend({
- * initialize: function Pixel(x, y, hex) {
- * Color.initialize.call(this, hex);
- * this.x = x;
- * this.y = y;
- * },
- * toString: function toString() {
- * return this.x + ":" + this.y + "@" + this.hex();
- * }
- * });
- *
- * var pixel = Pixel.new(11, 23, "CC3399");
- * pixel.toString(); // 11:23@#CC3399
- *
- * pixel.red(); // 204
- * pixel.green(); // 51
- * pixel.blue(); // 153
- *
- * pixel.cyan(); // 0.0000
- * pixel.magenta(); // 0.7500
- * pixel.yellow(); // 0.2500
- **/
+ * Takes any number of argument objects and returns frozen, composite object
+ * that inherits from `this` object and combines all of the own properties of
+ * the argument objects. (Objects returned by this function are frozen as
+ * they are intended to be used as types).
+ *
+ * If two or more argument objects have own properties with the same name,
+ * the property is overridden, with precedence from right to left, implying,
+ * that properties of the object on the left are overridden by a same named
+ * property of the object on the right.
+ *
+ * Example:
+ * // ### Object composition ###
+ *
+ * var HEX = Base.extend({
+ * hex: function hex() {
+ * return "#" + this.color;
+ * }
+ * });
+ *
+ * var RGB = Base.extend({
+ * red: function red() {
+ * return parseInt(this.color.substr(0, 2), 16);
+ * },
+ * green: function green() {
+ * return parseInt(this.color.substr(2, 2), 16);
+ * },
+ * blue: function blue() {
+ * return parseInt(this.color.substr(4, 2), 16);
+ * }
+ * });
+ *
+ * var CMYK = Base.extend(RGB, {
+ * black: function black() {
+ * var color = Math.max(Math.max(this.red(), this.green()), this.blue());
+ * return (1 - color / 255).toFixed(4);
+ * },
+ * cyan: function cyan() {
+ * var K = this.black();
+ * return (((1 - this.red() / 255).toFixed(4) - K) / (1 - K)).toFixed(4);
+ * },
+ * magenta: function magenta() {
+ * var K = this.black();
+ * return (((1 - this.green() / 255).toFixed(4) - K) / (1 - K)).toFixed(4);
+ * },
+ * yellow: function yellow() {
+ * var K = this.black();
+ * return (((1 - this.blue() / 255).toFixed(4) - K) / (1 - K)).toFixed(4);
+ * }
+ * });
+ *
+ * var Color = Base.extend(HEX, RGB, CMYK, {
+ * initialize: function Color(color) {
+ * this.color = color;
+ * }
+ * });
+ *
+ * // ### Prototypal inheritance ###
+ *
+ * var Pixel = Color.extend({
+ * initialize: function Pixel(x, y, hex) {
+ * Color.initialize.call(this, hex);
+ * this.x = x;
+ * this.y = y;
+ * },
+ * toString: function toString() {
+ * return this.x + ":" + this.y + "@" + this.hex();
+ * }
+ * });
+ *
+ * var pixel = Pixel.new(11, 23, "CC3399");
+ * pixel.toString(); // 11:23@#CC3399
+ *
+ * pixel.red(); // 204
+ * pixel.green(); // 51
+ * pixel.blue(); // 153
+ *
+ * pixel.cyan(); // 0.0000
+ * pixel.magenta(); // 0.7500
+ * pixel.yellow(); // 0.2500
+ *
+ * @param {Object} obj1 extend object's properties with the values in this object
+ */
extend: {
value: function extend() {
return Object.freeze(this.merge.apply(Object.create(this), arguments));
}
},
/**
- * Base#hasFeature(obj) -> Boolean
- * - obj1 (Object): check if this object is part of this object
- *
- * Checks if an object was merged with this object, using Base.extend() or
- * Base#merge(). Each object that was merged in at least once carries a
- * signature in the shape of a bitflag.
- *
- * ## Examples
- *
- * To continue with the example provided by Base.extend():
- *
- * // an instance of Color should contain the following objects:
- * var color = Color.new("CC3399");
- * color.hasFeature(HEX); // true
- * color.hasFeature(RGB); // true
- * color.hasFeature(CMYK); // true
- * color.hasFeature(Pixel); // false
- *
- * // an instance of Pixel should contain the following objects:
- * var pixel = Pixel.new(11, 23, "CC3399");
- * pixel.hasFeature(HEX); // true
- * pixel.hasFeature(RGB); // true
- * pixel.hasFeature(CMYK); // true
- * pixel.hasFeature(Color); // true
- **/
+ * Checks if an object was merged with this object, using Base.extend() or
+ * Base#merge(). Each object that was merged in at least once carries a
+ * signature in the shape of a bitflag.
+ *
+ * Example:
+ * To continue with the example provided by Base.extend():
+ *
+ * // an instance of Color should contain the following objects:
+ * var color = Color.new("CC3399");
+ * color.hasFeature(HEX); // true
+ * color.hasFeature(RGB); // true
+ * color.hasFeature(CMYK); // true
+ * color.hasFeature(Pixel); // false
+ *
+ * // an instance of Pixel should contain the following objects:
+ * var pixel = Pixel.new(11, 23, "CC3399");
+ * pixel.hasFeature(HEX); // true
+ * pixel.hasFeature(RGB); // true
+ * pixel.hasFeature(CMYK); // true
+ * pixel.hasFeature(Color); // true
+ *
+ * @param {Object} obj1: check if this object is part of this object
+ */
hasFeature: {
value: function hasFeature(base) {
return typeof base.UUID != "undefined" && this.UUIDS.indexOf(base.UUID) !== -1;

0 comments on commit 383dca4

Please sign in to comment.