mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
migrate from underscore to lodash
This commit is contained in:
parent
8d7a70c3f6
commit
3b8b0b479b
2
cli.js
2
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;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module jsdoc/doclet
|
||||
*/
|
||||
const _ = require('underscore');
|
||||
const _ = require('lodash');
|
||||
const jsdoc = {
|
||||
env: require('jsdoc/env'),
|
||||
name: require('jsdoc/name'),
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -2,21 +2,16 @@
|
||||
* Parse the command line arguments.
|
||||
* @module jsdoc/opts/argparser
|
||||
*/
|
||||
const _ = require('underscore');
|
||||
const util = require('util');
|
||||
const _ = require('lodash');
|
||||
|
||||
const hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
|
||||
function padding(length) {
|
||||
return new Array(length + 1).join(' ');
|
||||
}
|
||||
|
||||
function padLeft(str, length) {
|
||||
return padding(length) + str;
|
||||
return str.padStart(str.length + length);
|
||||
}
|
||||
|
||||
function padRight(str, length) {
|
||||
return str + padding(length);
|
||||
return str.padEnd(str.length + length);
|
||||
}
|
||||
|
||||
function findMaxLength(arr) {
|
||||
@ -37,7 +32,7 @@ function concatWithMaxLength(items, maxLength) {
|
||||
// to prevent endless loops, always use the first item, regardless of length
|
||||
result += items.shift();
|
||||
|
||||
while ( items.length && (result.length + items[0].length < maxLength) ) {
|
||||
while (items.length && (result.length + items[0].length < maxLength)) {
|
||||
result += ` ${items.shift()}`;
|
||||
}
|
||||
|
||||
@ -72,7 +67,7 @@ function formatHelpInfo({names, descriptions}) {
|
||||
result += concatWithMaxLength(words, wrapDescriptionAt);
|
||||
// if there's anything left, keep going until we've consumed the description
|
||||
while (words.length) {
|
||||
partialDescription = padding( maxNameLength + (MARGIN_LENGTH * 2) );
|
||||
partialDescription = padLeft('', maxNameLength + (MARGIN_LENGTH * 2));
|
||||
partialDescription += concatWithMaxLength(words, wrapDescriptionAt);
|
||||
result += `\n${partialDescription}`;
|
||||
}
|
||||
@ -226,7 +221,7 @@ class ArgParser {
|
||||
let arg;
|
||||
let next;
|
||||
let option;
|
||||
const result = ( defaults && _.defaults({}, defaults) ) || {};
|
||||
const result = (defaults && _.defaults({}, defaults)) || {};
|
||||
let shortName;
|
||||
let longName;
|
||||
let name;
|
||||
@ -252,7 +247,7 @@ class ArgParser {
|
||||
}
|
||||
|
||||
if (option === null) {
|
||||
throw new Error( util.format('Unknown command-line option "%s".', name) );
|
||||
throw new Error(`Unknown command-line option "${name}".`);
|
||||
}
|
||||
|
||||
if (option.hasValue) {
|
||||
@ -260,7 +255,7 @@ class ArgParser {
|
||||
i++;
|
||||
|
||||
if (value === null || value.charAt(0) === '-') {
|
||||
throw new Error( util.format('The command-line option "%s" requires a value.', name) );
|
||||
throw new Error(`The command-line option "${name}" requires a value.`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@ -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'),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Wrapper for underscore'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');
|
||||
|
||||
|
||||
8
package-lock.json
generated
8
package-lock.json
generated
@ -5864,8 +5864,7 @@
|
||||
"lodash": {
|
||||
"version": "4.17.11",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
|
||||
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==",
|
||||
"dev": true
|
||||
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
|
||||
},
|
||||
"lodash._reinterpolate": {
|
||||
"version": "3.0.0",
|
||||
@ -9858,11 +9857,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=="
|
||||
},
|
||||
"underscore-contrib": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/underscore-contrib/-/underscore-contrib-0.3.0.tgz",
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jsdoc",
|
||||
"version": "4.0.0-dev",
|
||||
"revision": "1547932905034",
|
||||
"revision": "1548096695580",
|
||||
"description": "An API documentation generator for JavaScript.",
|
||||
"keywords": [
|
||||
"documentation",
|
||||
@ -21,14 +21,14 @@
|
||||
"escape-string-regexp": "~1.0.5",
|
||||
"js2xmlparser": "~3.0.0",
|
||||
"klaw": "~3.0.0",
|
||||
"lodash": "^4.17.11",
|
||||
"markdown-it": "~8.4.2",
|
||||
"markdown-it-anchor": "~5.0.2",
|
||||
"marked": "~0.6.0",
|
||||
"mkdirp": "~0.5.1",
|
||||
"requizzle": "~0.2.1",
|
||||
"strip-json-comments": "~2.0.1",
|
||||
"taffydb": "2.6.2",
|
||||
"underscore": "~1.9.1"
|
||||
"taffydb": "2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ajv": "~6.7.0",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @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');
|
||||
|
||||
2
test/fixtures/eventorder.js
vendored
2
test/fixtures/eventorder.js
vendored
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var _ = require('underscore');
|
||||
var _ = require('lodash');
|
||||
|
||||
/**
|
||||
* Socket class.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
describe('jsdoc/doclet', () => {
|
||||
// TODO: more tests
|
||||
const _ = require('underscore');
|
||||
const _ = require('lodash');
|
||||
const jsdoc = {
|
||||
doclet: require('jsdoc/doclet')
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user