Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aheckmann committed Feb 9, 2012
1 parent 48b5492 commit 0e899a9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/index.js
Expand Up @@ -8,6 +8,14 @@ module.exports = exports = function keywordize (schema, options) {

schema.add({ keywords: [String] });

/**
* Keywordize.
*
* Breaks apart field values into separate keywords.
* @return {MongooseArray}
* @api public
*/

schema.methods.keywordize = function () {
var self = this;

Expand Down Expand Up @@ -41,6 +49,10 @@ module.exports = exports = function keywordize (schema, options) {
this.keywords = keywords;
}

/**
* Update the keywords if any field changed.
*/

schema.pre('save', function (next) {
var self = this;

Expand All @@ -53,4 +65,8 @@ module.exports = exports = function keywordize (schema, options) {
});
}

/**
* Expose version.
*/

exports.version = '0.0.1';

0 comments on commit 0e899a9

Please sign in to comment.