diff --git a/.jshintrc b/.jshintrc index c1260897..44926e14 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,19 +1,19 @@ { - "bitwise": false, - "curly": false, + "bitwise": true, + "curly": true, "eqeqeq": false, - "forin": false, - "immed": false, + "forin": true, + "immed": true, "latedef": false, - "newcap": false, - "noarg": false, + "newcap": true, + "noarg": true, "noempty": false, - "nonew": false, + "nonew": true, "plusplus": false, "regexp": false, - "undef": false, + "undef": true, "strict": false, - "trailing": false, + "trailing": true, "asi": true, "boss": true, diff --git a/Jakefile.js b/Jakefile.js index a168e7a3..124b8ea3 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -1,3 +1,4 @@ +/*global desc: true, fail: true, Mustache: true, task: true */ // see: https://github.com/mde/jake desc('Updating package.json revision.'); diff --git a/jsdoc.js b/jsdoc.js index e2f3d19c..8ac91a39 100644 --- a/jsdoc.js +++ b/jsdoc.js @@ -1,3 +1,4 @@ +/*global app: true, args: true, env: true, publish: true */ /** * @project jsdoc * @author Michael Mathews @@ -8,6 +9,8 @@ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// +var hasOwnProp = Object.prototype.hasOwnProperty; + /** Data representing the environment in which this app is running. @namespace */ @@ -30,7 +33,7 @@ env = { */ conf: {}, - /** + /** The absolute path to the base directory of the jsdoc application. @type string */ @@ -151,7 +154,9 @@ function installPlugins(plugins, p) { //...register event handlers if (plugin.handlers) { for (var eventName in plugin.handlers) { - parser.on(eventName, plugin.handlers[eventName]); + if ( hasOwnProp.call(plugin.handlers, eventName) ) { + parser.on(eventName, plugin.handlers[eventName]); + } } } @@ -168,8 +173,7 @@ function installPlugins(plugins, p) { } function indexAll(docs) { - var lookupTable = {}, - hasOwnProp = Object.prototype.hasOwnProperty; + var lookupTable = {}; docs.forEach(function(doc) { if ( !hasOwnProp.call(lookupTable, doc.longname) ) { @@ -260,8 +264,8 @@ function main() { } if (/(\bREADME|\.md)$/i.test(env.opts._[i])) { - var readme = require('jsdoc/readme'); - env.opts.readme = new readme(env.opts._[i]).html; + var Readme = require('jsdoc/readme'); + env.opts.readme = new Readme(env.opts._[i]).html; env.opts._.splice(i--, 1); } } diff --git a/plugins/markdown.js b/plugins/markdown.js index d6d4f40d..a4736628 100644 --- a/plugins/markdown.js +++ b/plugins/markdown.js @@ -1,3 +1,4 @@ +/*global env: true */ /** @overview Translate doclet descriptions from MarkDown into HTML. @module plugins/markdown diff --git a/rhino_modules/fs.js b/rhino_modules/fs.js index 98fb7a1c..8d085f79 100644 --- a/rhino_modules/fs.js +++ b/rhino_modules/fs.js @@ -1,3 +1,4 @@ +/*global Packages: true */ exports.readFileSync = function(filename, encoding) { encoding = encoding || 'utf-8'; diff --git a/rhino_modules/jsdoc/augment.js b/rhino_modules/jsdoc/augment.js index bd9d1ecc..bff28a1e 100644 --- a/rhino_modules/jsdoc/augment.js +++ b/rhino_modules/jsdoc/augment.js @@ -23,14 +23,16 @@ var doop = require("jsdoc/util/doop").doop; function mapDependencies(index) { var doclets, doc, len, dependencies = {}; for (var name in index) { - doclets = index[name]; - for (var i=0, ii=doclets.length; i} * @example diff --git a/rhino_modules/jsdoc/readme.js b/rhino_modules/jsdoc/readme.js index c95496a1..bbd98a85 100644 --- a/rhino_modules/jsdoc/readme.js +++ b/rhino_modules/jsdoc/readme.js @@ -1,3 +1,4 @@ +/*global env: true */ /** @overview @author Michael Mathews diff --git a/rhino_modules/jsdoc/src/filter.js b/rhino_modules/jsdoc/src/filter.js index a2664305..573d9a54 100644 --- a/rhino_modules/jsdoc/src/filter.js +++ b/rhino_modules/jsdoc/src/filter.js @@ -14,10 +14,10 @@ */ exports.Filter = function(opts) { this.exclude = opts.exclude || null; - this.includePattern = opts.includePattern? + this.includePattern = opts.includePattern? typeof opts.includePattern === 'string'? new RegExp(opts.includePattern) : opts.includePattern : null; - this.excludePattern = opts.excludePattern? + this.excludePattern = opts.excludePattern? typeof opts.excludePattern === 'string'? new RegExp(opts.excludePattern) : opts.excludePattern : null; } diff --git a/rhino_modules/jsdoc/src/handlers.js b/rhino_modules/jsdoc/src/handlers.js index 6f5c3c32..06ef880a 100644 --- a/rhino_modules/jsdoc/src/handlers.js +++ b/rhino_modules/jsdoc/src/handlers.js @@ -146,6 +146,7 @@ exports.attachTo = function(parser) { }); function addDoclet(newDoclet) { + var e; if (newDoclet) { e = { doclet: newDoclet }; this.fire('newDoclet', e); diff --git a/rhino_modules/jsdoc/src/parser.js b/rhino_modules/jsdoc/src/parser.js index 6fbd9db6..5ba735c9 100644 --- a/rhino_modules/jsdoc/src/parser.js +++ b/rhino_modules/jsdoc/src/parser.js @@ -1,3 +1,4 @@ +/*global Packages: true */ /** * @module jsdoc/src/parser * @requires common/util @@ -47,7 +48,9 @@ require('common/util').mixin(exports.Parser.prototype, require('common/events')) exports.Parser.prototype.parse = function(sourceFiles, encoding) { const SCHEMA = 'javascript:'; var sourceCode = '', - filename = ''; + filename = '', + i, + leni; if (typeof sourceFiles === 'string') { sourceFiles = [sourceFiles]; } @@ -199,7 +202,9 @@ exports.Parser.prototype.astnodeToMemberof = function(node) { id = 'astnode'+node.parent.hashCode(); doclet = this.refs[id]; - if (!doclet) return ''; // global? + if (!doclet) { + return ''; // global? + } return doclet.longname||doclet.name; } } @@ -236,16 +241,22 @@ exports.Parser.prototype.resolveThis = function(node) { if (node.enclosingFunction){ return this.resolveThis(node.enclosingFunction/* memberof.doclet.meta.code.val */); } - else return ''; // TODO handle global this? + else { + return ''; // TODO handle global this? + } } } else if (node.parent) { var parent = node.parent; - if (parent.type === Token.COLON) parent = parent.parent; // go up one more + if (parent.type === Token.COLON) { + parent = parent.parent; // go up one more + } memberof.id = 'astnode'+parent.hashCode(); memberof.doclet = this.refs[memberof.id]; - if (!memberof.doclet) return ''; // global? + if (!memberof.doclet) { + return ''; // global? + } return memberof.doclet.longname||memberof.doclet.name; } @@ -262,7 +273,9 @@ exports.Parser.prototype.resolvePropertyParent = function(node) { if (node.parent) { var parent = node.parent; - if (parent.type === Token.COLON) parent = parent.parent; // go up one more + if (parent.type === Token.COLON) { + parent = parent.parent; // go up one more + } memberof.id = 'astnode'+parent.hashCode(); memberof.doclet = this.refs[memberof.id]; @@ -366,7 +379,9 @@ function visitNode(node) { var basename = getBasename(e.code.name); - if (basename !== 'this') e.code.funcscope = currentParser.resolveVar(node, basename); + if (basename !== 'this') { + e.code.funcscope = currentParser.resolveVar(node, basename); + } } else if (node.type === Token.COLON) { // assignment within an object literal e = { @@ -484,7 +499,7 @@ function parserFactory() { * @memberof module:src/parser.Parser */ function aboutNode(node) { - about = {}; + var about = {}; if (node.type == Token.FUNCTION || node.type == tkn.NAMEDFUNCTIONSTATEMENT) { about.name = node.type == tkn.NAMEDFUNCTIONSTATEMENT? '' : '' + node.name; @@ -554,7 +569,7 @@ function aboutNode(node) { function nodeToString(node) { var str; - if (!node) return; + if (!node) { return; } if (node.type === Token.GETPROP) { str = [nodeToString(node.target), node.property.string].join('.'); diff --git a/rhino_modules/jsdoc/tag.js b/rhino_modules/jsdoc/tag.js index 2368c5ef..583862df 100644 --- a/rhino_modules/jsdoc/tag.js +++ b/rhino_modules/jsdoc/tag.js @@ -1,3 +1,4 @@ +/*global env: true */ /** @overview @author Michael Mathews diff --git a/rhino_modules/jsdoc/tag/dictionary.js b/rhino_modules/jsdoc/tag/dictionary.js index 4f3c1651..61cfe122 100644 --- a/rhino_modules/jsdoc/tag/dictionary.js +++ b/rhino_modules/jsdoc/tag/dictionary.js @@ -9,7 +9,8 @@ var _synonyms = {}, _namespaces = [], hasOwnProp = Object.prototype.hasOwnProperty; -function _TagDefinition(title, etc) { +/** @private */ +function TagDefinition(title, etc) { etc = etc || {}; this.title = dictionary.normalise(title); @@ -21,7 +22,8 @@ function _TagDefinition(title, etc) { } } -_TagDefinition.prototype.synonym = function(synonymName) { +/** @private */ +TagDefinition.prototype.synonym = function(synonymName) { _synonyms[synonymName.toLowerCase()] = this.title; return this; // chainable } @@ -30,7 +32,7 @@ _TagDefinition.prototype.synonym = function(synonymName) { var dictionary = { /** @function */ defineTag: function(title, opts) { - _definitions[title] = new _TagDefinition(title, opts); + _definitions[title] = new TagDefinition(title, opts); if (opts.isNamespace) { _namespaces.push(title); @@ -52,12 +54,16 @@ var dictionary = { /** @function */ isNamespace: function(kind) { - return ( ~ _namespaces.indexOf(kind) ); + if ( _namespaces.indexOf(kind) !== -1) { + return true; + } + + return false; }, /** @function */ normalise: function(title) { - canonicalName = title.toLowerCase(); + var canonicalName = title.toLowerCase(); if ( hasOwnProp.call(_synonyms, canonicalName) ) { return _synonyms[canonicalName]; diff --git a/rhino_modules/jsdoc/tag/dictionary/definitions.js b/rhino_modules/jsdoc/tag/dictionary/definitions.js index 82fe601f..0e4b5e99 100644 --- a/rhino_modules/jsdoc/tag/dictionary/definitions.js +++ b/rhino_modules/jsdoc/tag/dictionary/definitions.js @@ -1,3 +1,4 @@ +/*global app: true, env: true */ /** Define tags that are known in JSDoc. @module jsdoc/tag/dictionary/definitions @@ -28,7 +29,7 @@ exports.defineTags = function(dictionary) { doclet.access = tag.value.toLowerCase(); } else { - delete doclet.access; + delete doclet.access; } } }); @@ -291,7 +292,7 @@ exports.defineTags = function(dictionary) { dictionary.defineTag('instance', { onTagged: function(doclet, tag) { - setDocletScopeToTitle(doclet, tag); + setDocletScopeToTitle(doclet, tag); } }); @@ -465,7 +466,7 @@ exports.defineTags = function(dictionary) { dictionary.defineTag('static', { onTagged: function(doclet, tag) { - setDocletScopeToTitle(doclet, tag); + setDocletScopeToTitle(doclet, tag); } }); @@ -513,7 +514,9 @@ exports.defineTags = function(dictionary) { onTagged: function(doclet, tag) { if (tag.value && tag.value.type) { doclet.type = tag.value.type; - if (doclet.kind === 'function') doclet.addTag('returns', tag.text); // for backwards compatibility we allow @type for functions to imply return type + if (doclet.kind === 'function') { + doclet.addTag('returns', tag.text); // for backwards compatibility we allow @type for functions to imply return type + } } } }); @@ -583,7 +586,7 @@ function setDocletDescriptionToValue(doclet, tag) { } function setNameToFile(doclet, tag) { - if (doclet.meta.filename) { + if (doclet.meta.filename) { var name = 'file:'; if (doclet.meta.path) { name += doclet.meta.path + java.lang.System.getProperty("file.separator"); } doclet.addTag( 'name', name + doclet.meta.filename ); @@ -601,7 +604,9 @@ function applyNamespace(docletOrNs, tag) { tag.value = app.jsdoc.name.applyNamespace(tag.value, docletOrNs); } else { // doclet - if (!docletOrNs.name) return; // error? + if (!docletOrNs.name) { + return; // error? + } //doclet.displayname = doclet.name; docletOrNs.longname = app.jsdoc.name.applyNamespace(docletOrNs.name, tag.title); diff --git a/rhino_modules/jsdoc/tag/type.js b/rhino_modules/jsdoc/tag/type.js index 256cc5d4..d799bad9 100644 --- a/rhino_modules/jsdoc/tag/type.js +++ b/rhino_modules/jsdoc/tag/type.js @@ -82,7 +82,7 @@ function parseVariable(type) { function parseTypes(type) { var types = []; - if ( ~type.indexOf('|') ) { + if ( type.indexOf('|') !== -1 ) { // remove optional parens, like: { ( string | number ) } // see: http://code.google.com/closure/compiler/docs/js-for-compiler.html#types if ( /^\s*\(\s*(.+)\s*\)\s*$/.test(type) ) { diff --git a/rhino_modules/jsdoc/tag/validator.js b/rhino_modules/jsdoc/tag/validator.js index cc02568d..bb4560cc 100644 --- a/rhino_modules/jsdoc/tag/validator.js +++ b/rhino_modules/jsdoc/tag/validator.js @@ -1,3 +1,4 @@ +/*global env: true */ /** @module jsdoc/tag/validator @requires jsdoc/tag/dictionary diff --git a/rhino_modules/jsdoc/tutorial/resolver.js b/rhino_modules/jsdoc/tutorial/resolver.js index 1ee97869..e587e64f 100644 --- a/rhino_modules/jsdoc/tutorial/resolver.js +++ b/rhino_modules/jsdoc/tutorial/resolver.js @@ -10,6 +10,7 @@ var tutorial = require('jsdoc/tutorial'), fs = require('fs'), + hasOwnProp = Object.prototype.hasOwnProperty, conf = {}, tutorials = {}, finder = /^(.*)\.(x(?:ht)?ml|html?|md|markdown|js(?:on)?)$/i; @@ -44,6 +45,7 @@ exports.load = function(path) { var match, type, name, + content, current, files = fs.ls(path); @@ -97,32 +99,34 @@ exports.resolve = function() { var item, current; for (var name in conf) { - // should we be restrictive here? - // what is someone just wants to keep sample sources in same directory with tutorials? - // I've decided to leave such cases alone - if (!(name in tutorials)) { - continue; - } + if ( hasOwnProp.call(conf, name) ) { + // should we be restrictive here? + // what is someone just wants to keep sample sources in same directory with tutorials? + // I've decided to leave such cases alone + if (!(name in tutorials)) { + continue; + } - item = conf[name]; - current = tutorials[name] + item = conf[name]; + current = tutorials[name] - // set title - if (item.title) { - current.title = item.title; - } + // set title + if (item.title) { + current.title = item.title; + } - // add children - if (item.children) { - item.children.forEach(function(child) { - // I really didn't want to throw you an exception in most cases - // but now, user, you pissed me off ;) - if (!(child in tutorials)) { - throw new Error("Missing child tutorial: " + child); - } + // add children + if (item.children) { + item.children.forEach(function(child) { + // I really didn't want to throw you an exception in most cases + // but now, user, you pissed me off ;) + if (!(child in tutorials)) { + throw new Error("Missing child tutorial: " + child); + } - tutorials[child].setParent(current); - }); + tutorials[child].setParent(current); + }); + } } } }; diff --git a/rhino_modules/jsdoc/util/doop.js b/rhino_modules/jsdoc/util/doop.js index 74ab75fe..a6b0732e 100644 --- a/rhino_modules/jsdoc/util/doop.js +++ b/rhino_modules/jsdoc/util/doop.js @@ -10,8 +10,8 @@ var doop = exports.doop = function(o) { clone = o instanceof Array ? [] : {}; for (prop in o){ - if ( hasOwnProp.call(o, prop) ) { - clone[prop] = (o[prop] instanceof Object)? doop(o[prop]) : o[prop]; + if ( hasOwnProp.call(o, prop) ) { + clone[prop] = (o[prop] instanceof Object)? doop(o[prop]) : o[prop]; } } return clone; diff --git a/rhino_modules/jsdoc/util/dumper.js b/rhino_modules/jsdoc/util/dumper.js index 1e13d2e0..9392401a 100644 --- a/rhino_modules/jsdoc/util/dumper.js +++ b/rhino_modules/jsdoc/util/dumper.js @@ -37,7 +37,7 @@ function pad(depth) { */ function indent(openingBrace) { indentBy++; - if (openingBrace) output += openingBrace + '\n'; + if (openingBrace) { output += openingBrace + '\n'; } } /** @@ -51,7 +51,7 @@ function outdent(closingBrace) { indentBy--; output = output.replace(/,\n$/, '\n'); // trim trailing comma if (closingBrace === false) { output = output.replace(/\n$/, ''); } - else if (closingBrace) output += pad(indentBy) + closingBrace + ',\n'; + else if (closingBrace) { output += pad(indentBy) + closingBrace + ',\n'; } } var seen = []; diff --git a/rhino_modules/jsdoc/util/templateHelper.js b/rhino_modules/jsdoc/util/templateHelper.js index 4303961a..c32a20de 100644 --- a/rhino_modules/jsdoc/util/templateHelper.js +++ b/rhino_modules/jsdoc/util/templateHelper.js @@ -131,7 +131,7 @@ exports.setTutorials = function(root) { tutorials = root; }; -exports.toTutorial = toTutorial = function(tutorial, content) { +var toTutorial = exports.toTutorial = function(tutorial, content) { if (!tutorial) { throw new Error('Missing required parameter: tutorial'); } diff --git a/templates/default/publish.js b/templates/default/publish.js index 794eb3d3..7081ee7c 100644 --- a/templates/default/publish.js +++ b/templates/default/publish.js @@ -1,3 +1,4 @@ +/*global env: true, publish: true */ (function() { var template = require('jsdoc/template'), @@ -14,7 +15,7 @@ */ publish = function(data, opts, tutorials) { var defaultTemplatePath = 'templates/default'; - var templatePath = (opts.template) ? opts.template : defaultTemplate; + var templatePath = (opts.template) ? opts.template : defaultTemplatePath; var out = '', view = new template.Template(env.dirname + '/' + templatePath + '/tmpl'); @@ -53,7 +54,7 @@ while (doc = doc.memberof) { doc = find({longname: doc}); if (doc) { doc = doc[0]; } - if (!doc) break; + if (!doc) { break; } ancestors.unshift( linkto(doc.longname, (scopeToPunc[doc.scope] || '') + doc.name) ); } if (ancestors.length) { @@ -92,8 +93,8 @@ types = types.map(function(t) { return linkto(t, htmlsafe(t)); }); - } - + } + f.signature = (f.signature || '') + ''+(types.length? ' :'+types.join('|') : '')+''; } @@ -109,11 +110,15 @@ } if (f.scope && f.scope !== 'instance' && f.scope !== 'global') { - if (f.kind == 'function' || f.kind == 'member' || f.kind == 'constant') attribs.push(f.scope); + if (f.kind == 'function' || f.kind == 'member' || f.kind == 'constant') { + attribs.push(f.scope); + } } if (f.readonly === true) { - if (f.kind == 'member') attribs.push('readonly'); + if (f.kind == 'member') { + attribs.push('readonly'); + } } if (f.kind === 'constant') { @@ -246,7 +251,9 @@ if (moduleNames.length) { nav += '

Modules

    '; moduleNames.forEach(function(m) { - if ( !hasOwnProp.call(seen, m.longname) ) nav += '
  • '+linkto(m.longname, m.name)+'
  • '; + if ( !hasOwnProp.call(seen, m.longname) ) { + nav += '
  • '+linkto(m.longname, m.name)+'
  • '; + } seen[m.longname] = true; }); @@ -260,7 +267,9 @@ if (externalNames.length) { nav += '

    Externals

      '; externalNames.forEach(function(e) { - if ( !hasOwnProp.call(seen, e.longname) ) nav += '
    • '+linkto( e.longname, e.name.replace(/(^"|"$)/g, '') )+'
    • '; + if ( !hasOwnProp.call(seen, e.longname) ) { + nav += '
    • '+linkto( e.longname, e.name.replace(/(^"|"$)/g, '') )+'
    • '; + } seen[e.longname] = true; }); @@ -284,7 +293,9 @@ nav += '

      Classes

        '; moduleClasses = -1; } - if ( !hasOwnProp.call(seen, c.longname) ) nav += '
      • '+linkto(c.longname, c.name)+'
      • '; + if ( !hasOwnProp.call(seen, c.longname) ) { + nav += '
      • '+linkto(c.longname, c.name)+'
      • '; + } seen[c.longname] = true; }); @@ -298,7 +309,9 @@ if (namespaceNames.length) { nav += '

        Namespaces

          '; namespaceNames.forEach(function(n) { - if ( !hasOwnProp.call(seen, n.longname) ) nav += '
        • '+linkto(n.longname, n.name)+'
        • '; + if ( !hasOwnProp.call(seen, n.longname) ) { + nav += '
        • '+linkto(n.longname, n.name)+'
        • '; + } seen[n.longname] = true; }); @@ -309,10 +322,12 @@ // if (constantNames.length) { // nav += '

          Constants

            '; // constantNames.forEach(function(c) { -// if ( !hasOwnProp.call(seen, c.longname) ) nav += '
          • '+linkto(c.longname, c.name)+'
          • '; +// if ( !hasOwnProp.call(seen, c.longname) ) { +// nav += '
          • '+linkto(c.longname, c.name)+'
          • '; +// } // seen[c.longname] = true; // }); -// +// // nav += '
          '; // } @@ -323,7 +338,9 @@ if (mixinNames.length) { nav += '

          Mixins

            '; mixinNames.forEach(function(m) { - if ( !hasOwnProp.call(seen, m.longname) ) nav += '
          • '+linkto(m.longname, m.name)+'
          • '; + if ( !hasOwnProp.call(seen, m.longname) ) { + nav += '
          • '+linkto(m.longname, m.name)+'
          • '; + } seen[m.longname] = true; }); @@ -347,7 +364,9 @@ nav += '

            Global

              '; globalNames.forEach(function(g) { - if ( g.kind !== 'typedef' && !hasOwnProp.call(seen, g.longname) ) nav += '
            • '+linkto(g.longname, g.name)+'
            • '; + if ( g.kind !== 'typedef' && !hasOwnProp.call(seen, g.longname) ) { + nav += '
            • '+linkto(g.longname, g.name)+'
            • '; + } seen[g.longname] = true; }); @@ -363,26 +382,28 @@ view.nav = nav; for (var longname in helper.longnameToUrl) { - var classes = find({kind: 'class', longname: longname}); - if (classes.length) generate('Class: '+classes[0].name, classes, helper.longnameToUrl[longname]); + if ( hasOwnProp.call(helper.longnameToUrl, longname) ) { + var classes = find({kind: 'class', longname: longname}); + if (classes.length) { generate('Class: '+classes[0].name, classes, helper.longnameToUrl[longname]); } - var modules = find({kind: 'module', longname: longname}); - if (modules.length) generate('Module: '+modules[0].name, modules, helper.longnameToUrl[longname]); + var modules = find({kind: 'module', longname: longname}); + if (modules.length) { generate('Module: '+modules[0].name, modules, helper.longnameToUrl[longname]); } - var namespaces = find({kind: 'namespace', longname: longname}); - if (namespaces.length) generate('Namespace: '+namespaces[0].name, namespaces, helper.longnameToUrl[longname]); + var namespaces = find({kind: 'namespace', longname: longname}); + if (namespaces.length) { generate('Namespace: '+namespaces[0].name, namespaces, helper.longnameToUrl[longname]); } -// var constants = find({kind: 'constant', longname: longname}); -// if (constants.length) generate('Constant: '+constants[0].name, constants, helper.longnameToUrl[longname]); +// var constants = find({kind: 'constant', longname: longname}); +// if (constants.length) { generate('Constant: '+constants[0].name, constants, helper.longnameToUrl[longname]); } - var mixins = find({kind: 'mixin', longname: longname}); - if (mixins.length) generate('Mixin: '+mixins[0].name, mixins, helper.longnameToUrl[longname]); + var mixins = find({kind: 'mixin', longname: longname}); + if (mixins.length) { generate('Mixin: '+mixins[0].name, mixins, helper.longnameToUrl[longname]); } - var externals = find({kind: 'external', longname: longname}); - if (externals.length) generate('External: '+externals[0].name, externals, helper.longnameToUrl[longname]); + var externals = find({kind: 'external', longname: longname}); + if (externals.length) { generate('External: '+externals[0].name, externals, helper.longnameToUrl[longname]); } + } } - if (globals.length) generate('Global', [{kind: 'globalobj'}], 'global.html'); + if (globals.length) { generate('Global', [{kind: 'globalobj'}], 'global.html'); } // index page displays information from package.json and lists files var files = find({kind: 'file'}), @@ -445,4 +466,4 @@ return ''+hash+''; } -})(); +}()); diff --git a/templates/haruki/publish.js b/templates/haruki/publish.js index 42d4ccc7..fcfc8e1a 100644 --- a/templates/haruki/publish.js +++ b/templates/haruki/publish.js @@ -1,3 +1,4 @@ +/*global publish: true */ /** @overview Builds a tree-like JSON string from the doclet data. @version 0.0.1 @@ -39,7 +40,7 @@ function graft(parentNode, childNodes, parentLongname, parentName) { childNodes - .filter(function (element) { + .filter(function (element) { return (element.memberof === parentLongname); }) .forEach(function (element, i) { @@ -209,5 +210,5 @@ }); } -})(); +}());