Comparing version 6.2.1 to 6.2.2
@@ -1,9 +0,9 @@ | ||
var arrayify = require('array-back') | ||
var util = require('util') | ||
var handlebars = require('handlebars') | ||
var { marked } = require('marked') | ||
var objectGet = require('object-get') | ||
var where = require('test-value').where | ||
var flatten = require('reduce-flatten') | ||
var state = require('../lib/state') | ||
const arrayify = require('array-back') | ||
const util = require('util') | ||
const handlebars = require('handlebars') | ||
const { marked } = require('marked') | ||
const objectGet = require('object-get') | ||
const where = require('test-value').where | ||
const flatten = require('reduce-flatten') | ||
const state = require('../lib/state') | ||
@@ -109,10 +109,10 @@ /** | ||
function children (options) { | ||
var context = _children.call(this, options) | ||
var fn = options.fn | ||
var inverse = options.inverse | ||
var i = 0 | ||
var ret = '' | ||
var data | ||
const context = _children.call(this, options) | ||
const fn = options.fn | ||
const inverse = options.inverse | ||
let i = 0 | ||
let ret = '' | ||
let data | ||
var contextPath | ||
let contextPath | ||
@@ -123,3 +123,3 @@ if (options.data) { | ||
for (var j = context.length; i < j; i++) { | ||
for (let j = context.length; i < j; i++) { | ||
depthIncrement(options) | ||
@@ -135,3 +135,3 @@ if (data) { | ||
} | ||
ret = ret + fn(context[i], { data: data }) | ||
ret = ret + fn(context[i], { data }) | ||
depthDecrement(options) | ||
@@ -153,10 +153,10 @@ } | ||
function indexChildren (options) { | ||
var context = _children.call(this, options) | ||
var fn = options.fn | ||
var inverse = options.inverse | ||
var i = 0 | ||
var ret = '' | ||
var data | ||
const context = _children.call(this, options) | ||
const fn = options.fn | ||
const inverse = options.inverse | ||
let i = 0 | ||
let ret = '' | ||
let data | ||
var contextPath | ||
let contextPath | ||
@@ -167,3 +167,3 @@ if (options.data) { | ||
for (var j = context.length; i < j; i++) { | ||
for (let j = context.length; i < j; i++) { | ||
indexDepthIncrement(options) | ||
@@ -179,3 +179,3 @@ if (data) { | ||
} | ||
ret = ret + fn(context[i], { data: data }) | ||
ret = ret + fn(context[i], { data }) | ||
indexDepthDecrement(options) | ||
@@ -214,4 +214,4 @@ } | ||
var linked, matches, namepath | ||
var output = {} | ||
let linked, matches, namepath | ||
let output = {} | ||
@@ -245,3 +245,3 @@ /* | ||
if (linked.see && linked.see.length) { | ||
var firstLink = parseLink(linked.see[0])[0] | ||
const firstLink = parseLink(linked.see[0])[0] | ||
output.url = firstLink ? firstLink.url : linked.see[0] | ||
@@ -267,3 +267,3 @@ } else { | ||
if (this.returns) { | ||
var typeNames = arrayify(this.returns).map(function (ret) { | ||
let typeNames = arrayify(this.returns).map(function (ret) { | ||
return ret.type && ret.type.names | ||
@@ -305,3 +305,3 @@ }) | ||
function sig (options) { | ||
var data | ||
let data | ||
@@ -325,3 +325,3 @@ if (options.data) { | ||
var mSig = methodSig.call(this) | ||
const mSig = methodSig.call(this) | ||
if (isConstructor.call(this) || isFunction.call(this)) { | ||
@@ -341,3 +341,3 @@ data.methodSign = '(' + mSig + ')' | ||
data.returnSymbol = '⇒' | ||
var typeNames = arrayify(this.returns) | ||
const typeNames = arrayify(this.returns) | ||
.map(function (ret) { | ||
@@ -385,3 +385,3 @@ return ret.type && ret.type.names | ||
return options.fn(this, { data: data }) | ||
return options.fn(this, { data }) | ||
} | ||
@@ -402,3 +402,3 @@ | ||
function isClassMember (options) { | ||
var parent = arrayify(options.data.root).find(where({ id: this.memberof })) | ||
const parent = arrayify(options.data.root).find(where({ id: this.memberof })) | ||
if (parent) { | ||
@@ -463,5 +463,5 @@ return parent.kind === 'class' | ||
function _identifiers (options) { | ||
var query = {} | ||
const query = {} | ||
for (var prop in options.hash) { | ||
for (const prop in options.hash) { | ||
if (/^-/.test(prop)) { | ||
@@ -490,6 +490,6 @@ query[prop.replace(/^-/, '!')] = options.hash[prop] | ||
if (!this.id) return [] | ||
var min = options.hash.min | ||
const min = options.hash.min | ||
delete options.hash.min | ||
options.hash.memberof = this.id | ||
var output = _identifiers(options) | ||
let output = _identifiers(options) | ||
output = output.filter(function (identifier) { | ||
@@ -514,6 +514,6 @@ if (identifier.kind === 'external') { | ||
function descendants (options) { | ||
var min = typeof options.hash.min !== 'undefined' ? options.hash.min : 2 | ||
const min = typeof options.hash.min !== 'undefined' ? options.hash.min : 2 | ||
delete options.hash.min | ||
options.hash.memberof = this.id | ||
var output = [] | ||
const output = [] | ||
function iterate (childrenList) { | ||
@@ -538,3 +538,3 @@ if (childrenList.length) { | ||
function exported (options) { | ||
var exp = arrayify(options.data.root).find(where({ '!kind': 'module', id: this.id })) | ||
const exp = arrayify(options.data.root).find(where({ '!kind': 'module', id: this.id })) | ||
return exp || this | ||
@@ -575,3 +575,3 @@ } | ||
options.hash.id = this.inherits | ||
var inherits = _identifier(options) | ||
const inherits = _identifier(options) | ||
if (inherits) { | ||
@@ -602,3 +602,3 @@ return anchorName.call(inherits, options) | ||
if (string) { | ||
var result = marked(string).replace('lang-js', 'language-javascript') | ||
const result = marked(string).replace('lang-js', 'language-javascript') | ||
return result | ||
@@ -638,8 +638,8 @@ } | ||
if (!text) return '' | ||
var results = [] | ||
var matches = null | ||
var link1 = /{@link\s+([^\s}|]+?)\s*}/g // {@link someSymbol} | ||
var link2 = /\[([^\]]+?)\]{@link\s+([^\s}|]+?)\s*}/g // [caption here]{@link someSymbol} | ||
var link3 = /{@link\s+([^\s}|]+?)\s*\|([^}]+?)}/g // {@link someSymbol|caption here} | ||
var link4 = /{@link\s+([^\s}|]+?)\s+([^}|]+?)}/g // {@link someSymbol Caption Here} | ||
const results = [] | ||
let matches = null | ||
const link1 = /{@link\s+([^\s}|]+?)\s*}/g // {@link someSymbol} | ||
const link2 = /\[([^\]]+?)\]{@link\s+([^\s}|]+?)\s*}/g // [caption here]{@link someSymbol} | ||
const link3 = /{@link\s+([^\s}|]+?)\s*\|([^}]+?)}/g // {@link someSymbol|caption here} | ||
const link4 = /{@link\s+([^\s}|]+?)\s+([^}|]+?)}/g // {@link someSymbol Caption Here} | ||
@@ -705,6 +705,6 @@ while ((matches = link4.exec(text)) !== null) { | ||
if (this.memberof && this.kind !== 'constructor') { | ||
var parent = arrayify(options.data.root).find(where({ id: this.memberof })) | ||
const parent = arrayify(options.data.root).find(where({ id: this.memberof })) | ||
if (parent) { | ||
if (this.scope === 'instance') { | ||
var name = parent.typicalname || parent.name | ||
const name = parent.typicalname || parent.name | ||
return instantiate(name) | ||
@@ -711,0 +711,0 @@ } else if (this.scope === 'static' && !(parent.kind === 'class' || parent.kind === 'constructor')) { |
@@ -1,8 +0,8 @@ | ||
var ddata = require('./ddata') | ||
var arrayify = require('array-back') | ||
var handlebars = require('handlebars') | ||
var util = require('util') | ||
var commonSequence = require('common-sequence') | ||
var unique = require('reduce-unique') | ||
var without = require('reduce-without') | ||
const ddata = require('./ddata') | ||
const arrayify = require('array-back') | ||
const handlebars = require('handlebars') | ||
const util = require('util') | ||
const commonSequence = require('common-sequence') | ||
const unique = require('reduce-unique') | ||
const without = require('reduce-without') | ||
@@ -47,5 +47,5 @@ /** | ||
if (text) { | ||
var links = ddata.parseLink(text) | ||
const links = ddata.parseLink(text) | ||
links.forEach(function (link) { | ||
var linked = ddata._link(link.url, options) | ||
const linked = ddata._link(link.url, options) | ||
if (link.caption === link.url) link.caption = linked.name | ||
@@ -63,9 +63,9 @@ if (linked.url) link.url = linked.url | ||
function tableHead () { | ||
var args = arrayify(arguments) | ||
var data = args.shift() | ||
const args = arrayify(arguments) | ||
const data = args.shift() | ||
if (!data) return | ||
args.pop() | ||
var cols = args | ||
var colHeaders = cols.map(function (col) { | ||
var spl = col.split('|') | ||
let cols = args | ||
const colHeaders = cols.map(function (col) { | ||
const spl = col.split('|') | ||
return spl[1] || spl[0] | ||
@@ -76,5 +76,5 @@ }) | ||
}) | ||
var toSplice = [] | ||
const toSplice = [] | ||
cols = cols.filter(function (col, index) { | ||
var hasValue = data.some(function (row) { | ||
const hasValue = data.some(function (row) { | ||
return typeof row[col] !== 'undefined' | ||
@@ -89,3 +89,3 @@ }) | ||
var table = '| ' + colHeaders.join(' | ') + ' |\n' | ||
let table = '| ' + colHeaders.join(' | ') + ' |\n' | ||
table += cols.reduce(function (p) { return p + ' --- |' }, '|') + '\n' | ||
@@ -105,8 +105,8 @@ return table | ||
function tableRow () { | ||
var args = arrayify(arguments) | ||
var rows = args.shift() | ||
const args = arrayify(arguments) | ||
const rows = args.shift() | ||
if (!rows) return | ||
var options = args.pop() | ||
var cols = args | ||
var output = '' | ||
const options = args.pop() | ||
const cols = args | ||
let output = '' | ||
@@ -116,3 +116,3 @@ if (options.data) { | ||
cols.forEach(function (col, index) { | ||
var colNumber = index + 1 | ||
const colNumber = index + 1 | ||
data['col' + colNumber] = containsData(rows, col) | ||
@@ -122,3 +122,3 @@ }) | ||
rows.forEach(function (row) { | ||
output += options.fn(row, { data: data }) | ||
output += options.fn(row, { data }) | ||
}) | ||
@@ -133,9 +133,9 @@ return output | ||
function tableHeadHtml () { | ||
var args = arrayify(arguments) | ||
var data = args.shift() | ||
const args = arrayify(arguments) | ||
const data = args.shift() | ||
if (!data) return | ||
args.pop() | ||
var cols = args | ||
var colHeaders = cols.map(function (col) { | ||
var spl = col.split('|') | ||
let cols = args | ||
const colHeaders = cols.map(function (col) { | ||
const spl = col.split('|') | ||
return spl[1] || spl[0] | ||
@@ -146,5 +146,5 @@ }) | ||
}) | ||
var toSplice = [] | ||
const toSplice = [] | ||
cols = cols.filter(function (col, index) { | ||
var hasValue = data.some(function (row) { | ||
const hasValue = data.some(function (row) { | ||
return typeof row[col] !== 'undefined' | ||
@@ -192,3 +192,3 @@ }) | ||
function _groupChildren (groupByFields, options) { | ||
var children = ddata._children.call(this, options) | ||
const children = ddata._children.call(this, options) | ||
return _groupBy(children, groupByFields) | ||
@@ -205,3 +205,3 @@ } | ||
groupByFields.forEach(function (group) { | ||
var groupValues = identifiers | ||
const groupValues = identifiers | ||
.filter(function (identifier) { | ||
@@ -217,8 +217,8 @@ /* exclude constructors from grouping.. re-implement to work off a `null` group value */ | ||
var inserts = [] | ||
var prevGroup = [] | ||
var level = 0 | ||
const inserts = [] | ||
let prevGroup = [] | ||
let level = 0 | ||
identifiers.forEach(function (identifier, index) { | ||
if (!deepEqual(identifier._group, prevGroup)) { | ||
var common = commonSequence(identifier._group, prevGroup) | ||
const common = commonSequence(identifier._group, prevGroup) | ||
level = common.length | ||
@@ -228,3 +228,3 @@ identifier._group.forEach(function (group, i) { | ||
inserts.push({ | ||
index: index, | ||
index, | ||
_title: group, | ||
@@ -249,3 +249,3 @@ level: level++ | ||
function add () { | ||
var args = arrayify(arguments) | ||
const args = arrayify(arguments) | ||
args.pop() | ||
@@ -288,3 +288,3 @@ return args.reduce(function (p, c) { return p + (c || 0) }, 0) | ||
if (!string) return | ||
var matches = string.match(/({(.*?)})?([\s\S]*)/) | ||
const matches = string.match(/({(.*?)})?([\s\S]*)/) | ||
if (matches) { | ||
@@ -300,5 +300,5 @@ return { type: matches[2], description: matches[3] } | ||
if (this.params) { | ||
var list = this.params.map(function (param) { | ||
var nameSplit = param.name.split('.') | ||
var name = nameSplit[nameSplit.length - 1] | ||
const list = this.params.map(function (param) { | ||
const nameSplit = param.name.split('.') | ||
let name = nameSplit[nameSplit.length - 1] | ||
if (nameSplit.length > 1) name = '.' + name | ||
@@ -309,3 +309,3 @@ if (param.variable) name = '...' + name | ||
indent: ' '.repeat(nameSplit.length - 1), | ||
name: name, | ||
name, | ||
type: param.type, | ||
@@ -324,7 +324,7 @@ optional: param.optional, | ||
return this.examples.reduce(function (prev, example) { | ||
var lines = example.split(/\r\n|\r|\n/) | ||
const lines = example.split(/\r\n|\r|\n/) | ||
/* Process @lang */ | ||
var exampleLangOptions = ddata.option('example-lang', options) | ||
var matches = lines[0].match(/@lang\s+(\w+)\s*/) | ||
const exampleLangOptions = ddata.option('example-lang', options) | ||
let matches = lines[0].match(/@lang\s+(\w+)\s*/) | ||
if (matches) { | ||
@@ -337,7 +337,7 @@ var exampleLangSubtag = matches[1] | ||
} | ||
var exampleLang = exampleLangSubtag || exampleLangOptions | ||
const exampleLang = exampleLangSubtag || exampleLangOptions | ||
/* Process <caption> and update example */ | ||
matches = lines[0].match(/\s*<caption>(.*?)<\/caption>\s*/) | ||
var caption | ||
let caption | ||
if (matches) { | ||
@@ -354,3 +354,3 @@ caption = matches[1] | ||
return prev + options.fn({ caption: caption, example: example }) | ||
return prev + options.fn({ caption, example }) | ||
}, '') | ||
@@ -369,3 +369,3 @@ } | ||
function regexpTest (value, regex) { | ||
var re = new RegExp(regex) | ||
const re = new RegExp(regex) | ||
return re.test(value) | ||
@@ -372,0 +372,0 @@ } |
@@ -1,3 +0,3 @@ | ||
var handlebars = require('handlebars') | ||
var ddata = require('./ddata') | ||
const handlebars = require('handlebars') | ||
const ddata = require('./ddata') | ||
@@ -31,3 +31,3 @@ exports.identifiers = identifiers | ||
function identifier (options) { | ||
var result = ddata._identifier(options) | ||
const result = ddata._identifier(options) | ||
return result ? options.fn(result) : 'ERROR, Cannot find identifier.' | ||
@@ -67,3 +67,3 @@ } | ||
options.hash.kind = 'module' | ||
var result = ddata._identifiers(options)[0] | ||
const result = ddata._identifiers(options)[0] | ||
return result ? options.fn(result) : 'ERROR, Cannot find module.' | ||
@@ -86,3 +86,3 @@ } | ||
options.hash.kind = 'class' | ||
var result = ddata._identifier(options) | ||
const result = ddata._identifier(options) | ||
return result ? options.fn(result) : 'ERROR, Cannot find class.' | ||
@@ -105,3 +105,3 @@ } | ||
options.hash.kind = 'function' | ||
var result = ddata._identifier(options) | ||
const result = ddata._identifier(options) | ||
return result ? options.fn(result) : 'ERROR, Cannot find function.' | ||
@@ -115,3 +115,3 @@ } | ||
options.hash.kind = 'namespace' | ||
var result = ddata._identifier(options) | ||
const result = ddata._identifier(options) | ||
return result ? options.fn(result) : 'ERROR, Cannot find namespace.' | ||
@@ -125,3 +125,3 @@ } | ||
options.hash.kind = 'enum' | ||
var result = ddata._identifier(options) | ||
const result = ddata._identifier(options) | ||
return result ? options.fn(result) : 'ERROR, Cannot find enum.' | ||
@@ -128,0 +128,0 @@ } |
@@ -53,3 +53,2 @@ /** | ||
const DmdOptions = require('./lib/dmd-options') | ||
const FileSet = require('file-set') | ||
@@ -56,0 +55,0 @@ function registerPartials (paths) { |
@@ -5,3 +5,3 @@ /** | ||
function DmdOptions (options) { | ||
var arrayify = require('array-back') | ||
const arrayify = require('array-back') | ||
options = options || {} | ||
@@ -8,0 +8,0 @@ |
{ | ||
"name": "dmd", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "6.2.1", | ||
"version": "6.2.2", | ||
"description": "The default output template for jsdoc-to-markdown", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
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
58543
1375