Skip to content

Commit

Permalink
update deps, dates, linting, CI
Browse files Browse the repository at this point in the history
  • Loading branch information
75lb committed Jan 31, 2024
1 parent ff28e97 commit 563cfde
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 606 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [12, 14, 16, 18, 19]
node-version: [12, 14, 16, 18, 20, 21]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014-23 Lloyd Brookes <75pound@gmail.com>
Copyright (c) 2014-24 Lloyd Brookes <75pound@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ $ jsdoc2md --json <files>

* * *

&copy; 2014-23 Lloyd Brookes \<75pound@gmail.com\>.
&copy; 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).
48 changes: 24 additions & 24 deletions lib/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ const arrayify = require('array-back')
const extract = require('reduce-extract')
const omit = require('lodash.omit')

function pick(object, keys) {
function pick (object, keys) {
return keys.reduce((obj, key) => {
if (object && object.hasOwnProperty(key)) {
obj[key] = object[key];
}
return obj;
}, {});
if (object && object.hasOwnProperty(key)) {
obj[key] = object[key]
}
return obj
}, {})
}

/**
Expand Down Expand Up @@ -148,16 +148,16 @@ function createConstructor (class_) {

/* split each class found into two new items, then re-insert them over the original class */
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) })
}
})

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)
})

Expand Down Expand Up @@ -188,7 +188,7 @@ function replaceID (id, oldID, newID) {
}

function updateIDReferences (doclet, newID) {
var oldID = newID.split('--')[0]
const oldID = newID.split('--')[0]
if (oldID && !doclet.isExported) {
if (doclet.id) doclet.id = replaceID(doclet.id, oldID, newID)
if (doclet.memberof) doclet.memberof = replaceID(doclet.memberof, oldID, newID)
Expand Down Expand Up @@ -258,11 +258,11 @@ function wantedProperties (input) {
}

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 }
}))
}

Expand All @@ -271,7 +271,7 @@ function buildTodoList (doclet) {
Combine @todo array with @done custom tags to make @todoList
*/
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
todoList = todoList.concat(done.map(function (task) {
return { done: true, task: task.value }
Expand All @@ -286,23 +286,23 @@ function buildTodoList (doclet) {

function extractTypicalName (doclet) {
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
}
return doclet
}

function extractCategory (doclet) {
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
}
return doclet
}

function extractChainable (doclet) {
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
}
return doclet
Expand All @@ -329,8 +329,8 @@ function setTypedefScope (doclet) {
}

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'
}).sort(sortFunction)
newPropertyOrder.forEach(function (prop) {
Expand All @@ -340,7 +340,7 @@ function sort (object, 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) {
if (fieldOrder.indexOf(a) === -1 && fieldOrder.indexOf(b) > -1) {
return 1
Expand All @@ -351,10 +351,10 @@ function sortIdentifier (doclet) {
}

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]
}
}
Expand Down Expand Up @@ -401,7 +401,7 @@ function convertIsEnumFlagToKind (doclet) {
/* remove properties which have enum parents.. depends on convertIsEnumFlagToKind */
function removeEnumChildren (json) {
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') {
return false
} else {
Expand Down

0 comments on commit 563cfde

Please sign in to comment.