Skip to content

Commit

Permalink
factor test-value out of the project
Browse files Browse the repository at this point in the history
  • Loading branch information
75lb committed Aug 30, 2024
1 parent 5b0ebe7 commit 2ba5b64
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 47 deletions.
25 changes: 12 additions & 13 deletions helpers/ddata.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const util = require('util')
const handlebars = require('handlebars')
const { marked } = require('marked')
const objectGet = require('object-get')
const where = require('test-value').where
const state = require('../lib/state')

let malformedDataWarningIssued = false
Expand Down Expand Up @@ -400,7 +399,7 @@ returns true if the parent of the current identifier is a class
@static
*/
function isClassMember (options) {
const parent = arrayify(options.data.root).find(where({ id: this.memberof }))
const parent = arrayify(options.data.root).find(i => i.id === this.memberof)
if (parent) {
return parent.kind === 'class'
}
Expand Down Expand Up @@ -462,15 +461,15 @@ function _orphans (options) {
function _identifiers (options) {
const query = {}
for (const prop in options.hash) {
if (/^-/.test(prop)) {
query[prop.replace(/^-/, '!')] = options.hash[prop]
} else if (/^_/.test(prop)) {
query[prop.replace(/^_/, '')] = new RegExp(options.hash[prop])
} else {
query[prop] = options.hash[prop]
}
query[prop] = options.hash[prop]
}
return arrayify(options.data.root).filter(where(query)).filter(function (doclet) {
return arrayify(options.data.root)
.filter(doclet => {
return Object.keys(query).every(prop => {
return doclet[prop] === query[prop]
})
})
.filter(function (doclet) {
return !doclet.ignore && (state.options.private ? true : doclet.access !== 'private')
})
}
Expand Down Expand Up @@ -540,7 +539,7 @@ returns the exported identifier of this module
@static
*/
function exported (options) {
const exp = arrayify(options.data.root).find(where({ '!kind': 'module', id: this.id }))
const exp = arrayify(options.data.root).find(d => d.kind !== 'module' && d.id === this.id)
return exp || this
}

Expand All @@ -557,7 +556,7 @@ Returns the parent
@static
*/
function parentObject (options) {
return arrayify(options.data.root).find(where({ id: this.memberof }))
return arrayify(options.data.root).find(d => d.id === this.memberof)
}

/**
Expand Down Expand Up @@ -722,7 +721,7 @@ function parentName (options) {
if (this.isExported) return ''

if (this.memberof && this.kind !== 'constructor') {
const parent = arrayify(options.data.root).find(where({ id: this.memberof }))
const parent = arrayify(options.data.root).find(d => d.id === this.memberof)
if (parent) {
if (this.scope === 'instance') {
const name = parent.typicalname || parent.name
Expand Down
34 changes: 1 addition & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"marked": "^14.1.0",
"object-get": "^2.1.1",
"reduce-unique": "^2.0.1",
"test-value": "^3.0.0",
"walk-back": "^5.1.1"
},
"devDependencies": {
Expand Down

0 comments on commit 2ba5b64

Please sign in to comment.