solidoc2
Version:
Solidity Documentation Generator 2
25 lines (17 loc) • 511 B
JavaScript
const getText = (x) => typeof (x) === 'object' ? x.text : x || ''
const get = (contents, key) => {
const text = getText(contents)
const members = text.split('@')
for (const i in members) {
const entry = members[i]
if (entry.startsWith(key)) {
return entry.substr(key.length, entry.length - key.length).trim()
}
}
return ''
}
const getNotice = (contents) => {
const title = get(contents, 'notice')
return title || get(contents, 'dev')
}
module.exports = { get, getNotice }