diff --git a/cli.js b/cli.js index b1de34de..9ff63b20 100644 --- a/cli.js +++ b/cli.js @@ -47,7 +47,7 @@ module.exports = (() => { // TODO: docs cli.loadConfig = () => { - const _ = require('underscore'); + const _ = require('lodash'); const args = require('jsdoc/opts/args'); const Config = require('jsdoc/config'); let config; diff --git a/lib/jsdoc/doclet.js b/lib/jsdoc/doclet.js index 8a862ec6..f24c0f62 100644 --- a/lib/jsdoc/doclet.js +++ b/lib/jsdoc/doclet.js @@ -1,7 +1,7 @@ /** * @module jsdoc/doclet */ -const _ = require('underscore'); +const _ = require('lodash'); const jsdoc = { env: require('jsdoc/env'), name: require('jsdoc/name'), diff --git a/lib/jsdoc/name.js b/lib/jsdoc/name.js index 8b8dcb55..87a8ac64 100644 --- a/lib/jsdoc/name.js +++ b/lib/jsdoc/name.js @@ -2,7 +2,7 @@ * A collection of functions relating to JSDoc symbol name manipulation. * @module jsdoc/name */ -const _ = require('underscore'); +const _ = require('lodash'); const escape = require('escape-string-regexp'); const hasOwnProp = Object.prototype.hasOwnProperty; diff --git a/lib/jsdoc/opts/argparser.js b/lib/jsdoc/opts/argparser.js index 3bab52f3..0618511b 100644 --- a/lib/jsdoc/opts/argparser.js +++ b/lib/jsdoc/opts/argparser.js @@ -2,7 +2,7 @@ * Parse the command line arguments. * @module jsdoc/opts/argparser */ -const _ = require('underscore'); +const _ = require('lodash'); const util = require('util'); const hasOwnProp = Object.prototype.hasOwnProperty; diff --git a/lib/jsdoc/tag/dictionary/definitions.js b/lib/jsdoc/tag/dictionary/definitions.js index a4f3139f..7f38b195 100644 --- a/lib/jsdoc/tag/dictionary/definitions.js +++ b/lib/jsdoc/tag/dictionary/definitions.js @@ -2,7 +2,7 @@ * Define tags that are known in JSDoc. * @module jsdoc/tag/dictionary/definitions */ -const _ = require('underscore'); +const _ = require('lodash'); const jsdoc = { env: require('jsdoc/env'), name: require('jsdoc/name'), diff --git a/lib/jsdoc/template.js b/lib/jsdoc/template.js index c01cb852..93f565a4 100644 --- a/lib/jsdoc/template.js +++ b/lib/jsdoc/template.js @@ -1,13 +1,13 @@ /** - * Wrapper for underscore's template utility to allow loading templates from files. + * Wrapper for Lodash's template utility to allow loading templates from files. * @module jsdoc/template */ -const _ = require('underscore'); +const _ = require('lodash'); const fs = require('jsdoc/fs'); const path = require('path'); /** - * Underscore template helper. + * Template helper. */ class Template { /** diff --git a/package-lock.json b/package-lock.json index 6af0901d..aceeb465 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5234,11 +5234,6 @@ "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", "dev": true }, - "underscore": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", - "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" - }, "undertaker": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.2.1.tgz", diff --git a/package.json b/package.json index 08b8b6f7..6be37b0b 100644 --- a/package.json +++ b/package.json @@ -19,14 +19,14 @@ "escape-string-regexp": "^2.0.0", "js2xmlparser": "^4.0.0", "klaw": "^3.0.0", + "lodash": "^4.17.11", "markdown-it": "^8.4.2", "markdown-it-anchor": "^5.0.2", "marked": "^0.6.2", "mkdirp": "^0.5.1", "requizzle": "^0.2.2", "strip-json-comments": "^3.0.1", - "taffydb": "2.6.2", - "underscore": "~1.9.1" + "taffydb": "2.6.2" }, "devDependencies": { "ajv": "^6.10.0", diff --git a/plugins/eventDumper.js b/plugins/eventDumper.js index 45e59008..4a190bee 100644 --- a/plugins/eventDumper.js +++ b/plugins/eventDumper.js @@ -3,11 +3,10 @@ * * @module plugins/eventDumper */ -const _ = require('underscore'); +const _ = require('lodash'); const doop = require('jsdoc/util/doop'); const dump = require('jsdoc/util/dumper').dump; const env = require('jsdoc/env'); -const util = require('util'); const conf = env.conf.eventDumper || {}; @@ -68,7 +67,7 @@ function cleanse(e) { Object.keys(e).forEach(prop => { // by default, don't stringify properties that contain an array of functions - if (!conf.includeFunctions && util.isArray(e[prop]) && e[prop][0] && + if (!conf.includeFunctions && Array.isArray(e[prop]) && e[prop][0] && String(typeof e[prop][0]) === 'function') { result[prop] = `function[${e[prop].length}]`; } diff --git a/test/fixtures/eventorder.js b/test/fixtures/eventorder.js index 0c9e497b..bf25d561 100644 --- a/test/fixtures/eventorder.js +++ b/test/fixtures/eventorder.js @@ -1,6 +1,6 @@ 'use strict'; -var _ = require('underscore'); +var _ = require('lodash'); /** * Socket class. diff --git a/test/specs/jsdoc/doclet.js b/test/specs/jsdoc/doclet.js index 4a4ef791..200ce4c4 100644 --- a/test/specs/jsdoc/doclet.js +++ b/test/specs/jsdoc/doclet.js @@ -1,6 +1,6 @@ describe('jsdoc/doclet', () => { // TODO: more tests - const _ = require('underscore'); + const _ = require('lodash'); const jsdoc = { doclet: require('jsdoc/doclet') };