jsdoc-parse
Advanced tools
Comparing version 6.2.0 to 6.2.1
@@ -5,5 +5,13 @@ const testValue = require('test-value') | ||
const extract = require('reduce-extract') | ||
const pick = require('lodash.pick') | ||
const omit = require('lodash.omit') | ||
function pick (object, keys) { | ||
return keys.reduce((obj, key) => { | ||
if (object && object.hasOwnProperty(key)) { | ||
obj[key] = object[key] | ||
} | ||
return obj | ||
}, {}) | ||
} | ||
/** | ||
@@ -144,7 +152,7 @@ * @module transform | ||
function insertConstructors (data) { | ||
var replacements = [] | ||
const replacements = [] | ||
data.forEach(function (doclet, index) { | ||
if (doclet.kind === 'class') { | ||
replacements.push({ index: index, items: createConstructor(doclet) }) | ||
replacements.push({ index, items: createConstructor(doclet) }) | ||
} | ||
@@ -154,3 +162,3 @@ }) | ||
replacements.reverse().forEach(function (replacement) { | ||
var spliceArgs = [replacement.index, 1].concat(replacement.items) | ||
const spliceArgs = [replacement.index, 1].concat(replacement.items) | ||
data.splice.apply(data, spliceArgs) | ||
@@ -186,3 +194,3 @@ }) | ||
function updateIDReferences (doclet, newID) { | ||
var oldID = newID.split('--')[0] | ||
const oldID = newID.split('--')[0] | ||
if (oldID && !doclet.isExported) { | ||
@@ -257,7 +265,7 @@ if (doclet.id) doclet.id = replaceID(doclet.id, oldID, newID) | ||
function buildTodoList (doclet) { | ||
var todoList = [] | ||
let todoList = [] | ||
if (doclet.todo) { | ||
var todo = arrayify(doclet.todo) | ||
const todo = arrayify(doclet.todo) | ||
todoList = todoList.concat(todo.map(function (task) { | ||
return { done: false, task: task } | ||
return { done: false, task } | ||
})) | ||
@@ -271,3 +279,3 @@ } | ||
if (doclet.tags) { | ||
var done = doclet.tags.reduce(extract({ title: 'done' }), []) | ||
const done = doclet.tags.reduce(extract({ title: 'done' }), []) | ||
if (!doclet.tags.length) delete doclet.tags | ||
@@ -287,3 +295,3 @@ todoList = todoList.concat(done.map(function (task) { | ||
if (doclet.tags) { | ||
var typicalName = doclet.tags.reduce(extract({ title: 'typicalname' }), []) | ||
const typicalName = doclet.tags.reduce(extract({ title: 'typicalname' }), []) | ||
if (typicalName.length) doclet.typicalname = typicalName[0].value | ||
@@ -296,3 +304,3 @@ } | ||
if (doclet.tags) { | ||
var category = doclet.tags.reduce(extract({ title: 'category' }), []) | ||
const category = doclet.tags.reduce(extract({ title: 'category' }), []) | ||
if (category.length) doclet.category = category[0].value | ||
@@ -305,3 +313,3 @@ } | ||
if (doclet.tags) { | ||
var chainable = doclet.tags.reduce(extract({ title: 'chainable' }), []) | ||
const chainable = doclet.tags.reduce(extract({ title: 'chainable' }), []) | ||
if (chainable.length) doclet.chainable = true | ||
@@ -333,4 +341,4 @@ } | ||
function sort (object, sortFunction) { | ||
var output = {} | ||
var newPropertyOrder = Object.keys(object).filter(function (prop) { | ||
const output = {} | ||
const newPropertyOrder = Object.keys(object).filter(function (prop) { | ||
return typeof object[prop] !== 'function' | ||
@@ -345,3 +353,3 @@ }).sort(sortFunction) | ||
function sortIdentifier (doclet) { | ||
var fieldOrder = ['id', 'parentId', 'longname', 'name', 'kind', 'scope', 'isExported', 'classdesc', 'augments', 'inherits', 'inherited', 'implements', 'overrides', 'mixes', 'description', 'memberof', 'alias', 'params', 'fires', 'examples', 'returns', 'type', 'defaultvalue', 'readonly', 'thisvalue', 'isEnum', 'properties', 'optional', 'nullable', 'variable', 'author', 'deprecated', 'ignore', 'access', 'requires', 'version', 'since', 'licenses', 'license', 'typicalname', 'category', 'see', 'exceptions', 'codeName', 'todoList', 'customTags', 'chainable', 'meta', 'order'] | ||
const fieldOrder = ['id', 'parentId', 'longname', 'name', 'kind', 'scope', 'isExported', 'classdesc', 'augments', 'inherits', 'inherited', 'implements', 'overrides', 'mixes', 'description', 'memberof', 'alias', 'params', 'fires', 'examples', 'returns', 'type', 'defaultvalue', 'readonly', 'thisvalue', 'isEnum', 'properties', 'optional', 'nullable', 'variable', 'author', 'deprecated', 'ignore', 'access', 'requires', 'version', 'since', 'licenses', 'license', 'typicalname', 'category', 'see', 'exceptions', 'codeName', 'todoList', 'customTags', 'chainable', 'meta', 'order'] | ||
return sort(doclet, function (a, b) { | ||
@@ -357,6 +365,6 @@ if (fieldOrder.indexOf(a) === -1 && fieldOrder.indexOf(b) > -1) { | ||
function update (array, query, newValues) { | ||
for (var i = 0; i < array.length; i++) { | ||
for (let i = 0; i < array.length; i++) { | ||
if (testValue(array[i], query)) { | ||
var values = typeof newValues === 'function' ? newValues(array[i]) : newValues | ||
for (var prop in values) { | ||
const values = typeof newValues === 'function' ? newValues(array[i]) : newValues | ||
for (const prop in values) { | ||
if (values[prop] !== undefined) array[i][prop] = values[prop] | ||
@@ -408,3 +416,3 @@ } | ||
return json.filter(function (doclet) { | ||
var parent = json.find(where({ id: doclet.memberof })) | ||
const parent = json.find(where({ id: doclet.memberof })) | ||
if (parent && parent.kind === 'enum') { | ||
@@ -411,0 +419,0 @@ return false |
The MIT License (MIT) | ||
Copyright (c) 2014-23 Lloyd Brookes <75pound@gmail.com> | ||
Copyright (c) 2014-24 Lloyd Brookes <75pound@gmail.com> | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "jsdoc-parse", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "6.2.0", | ||
"version": "6.2.1", | ||
"description": "Transforms jsdoc data into something more suitable for use as template input", | ||
@@ -24,3 +24,2 @@ "repository": "https://github.com/jsdoc2md/jsdoc-parse", | ||
"lodash.omit": "^4.5.0", | ||
"lodash.pick": "^4.4.0", | ||
"reduce-extract": "^1.0.0", | ||
@@ -27,0 +26,0 @@ "sort-array": "^4.1.5", |
@@ -28,4 +28,4 @@ [![view on npm](https://badgen.net/npm/v/jsdoc-parse)](https://www.npmjs.org/package/jsdoc-parse) | ||
© 2014-23 Lloyd Brookes \<75pound@gmail.com\>. | ||
© 2014-24 Lloyd Brookes \<75pound@gmail.com\>. | ||
Tested by [test-runner](https://github.com/test-runner-js/test-runner). Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16260
5
394
- Removedlodash.pick@^4.4.0
- Removedlodash.pick@4.4.0(transitive)