mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-18 14:17:30 +00:00
98 lines
1.8 KiB
JavaScript
98 lines
1.8 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Creates a new Klass
|
|
* @class
|
|
*/
|
|
function Klass(foo) {
|
|
this.foo = foo;
|
|
}
|
|
|
|
/**
|
|
* Get this Klass's foo
|
|
* @returns {Number} foo
|
|
* @example
|
|
* foo.getFoo();
|
|
*/
|
|
Klass.prototype.getFoo = function () {
|
|
return this.foo;
|
|
};
|
|
|
|
/**
|
|
* A function with an options parameter
|
|
* @param {Object} options
|
|
* @param {string} options.foo
|
|
* @param {number} options.bar
|
|
*/
|
|
Klass.prototype.withOptions = function (options) {
|
|
};
|
|
|
|
/**
|
|
* Decide whether an object is a Klass instance
|
|
* This is a [klasssic]{@link Klass}
|
|
* This is a [link to something that does not exist]{@link DoesNot}
|
|
*
|
|
* @param {Object} other
|
|
* @param {*} also
|
|
* @returns {boolean} whether the other thing is a Klass
|
|
*/
|
|
Klass.isClass = function (other, also) {
|
|
return other instanceof Klass;
|
|
};
|
|
|
|
/**
|
|
* A function that triggers the case where the autolinker doesn't find
|
|
* the referenced class type
|
|
*
|
|
* @param {Weird} other
|
|
* @returns {boolean} whether the other thing is a Klass
|
|
*/
|
|
Klass.isWeird = function (other) {
|
|
return other instanceof Weird;
|
|
};
|
|
|
|
/**
|
|
* This method takes a Buffer object that will be linked to nodejs.org
|
|
*
|
|
* @param {Buffer|string} buf
|
|
* @param {number} [size=0] size
|
|
* @returns {boolean} whether the other thing is a Klass
|
|
*/
|
|
Klass.isBuffer = function (buf, size) {
|
|
return other instanceof Buffer;
|
|
};
|
|
|
|
/**
|
|
* This method takes an array of buffers and counts them
|
|
*
|
|
* @param {Array<Buffer>} buffers
|
|
* @returns {number} how many
|
|
*/
|
|
Klass.isArrayOfBuffers = function (buffers) {
|
|
return buffers.length;
|
|
};
|
|
|
|
/**
|
|
* A magic number that identifies this Klass.
|
|
*/
|
|
Klass.MAGIC_NUMBER = 42;
|
|
|
|
/**
|
|
* Get an instance of {@link Klass}. Will make
|
|
* a {@link Klass klass instance multiword},
|
|
* like a {@link Klass|klass}
|
|
*
|
|
* @returns {Klass} that class
|
|
*/
|
|
function bar() {
|
|
return new Klass(1);
|
|
}
|
|
|
|
/**
|
|
* Klass event
|
|
* @event event
|
|
* @memberof Klass
|
|
*/
|
|
|
|
bar();
|