How to use the dmd/helpers/ddata._identifier function in dmd

To help you get started, we’ve selected a few dmd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twitch-js / twitch-js / scripts / generateDocs / helpers.js View on Github external
test input for
  1. A type expression containing a namepath, e.g. Array.
  2. a namepath referencing an `id`
  3. a namepath referencing a `longname`
  */
  if ((matches = input.match(/.*?<(.*?)>/))) {
    namepath = matches[1]
  } else {
    namepath = input
  }

  options.hash = { id: namepath }
  linked = dmd._identifier(options)
  if (!linked) {
    options.hash = { longname: namepath }
    linked = dmd._identifier(options)
  }
  if (!linked) {
    output = { name: input, url: null }
  } else {
    output.name = input.replace(namepath, linked.name)
    if (dmd.isExternal.call(linked)) {
      if (linked.description) {
        output.url = 'external#' + dmd.anchorName.call(linked, options)
      } else {
        if (linked.see && linked.see.length) {
          var firstLink = dmd.arseLink(linked.see[0])[0]
          output.url = firstLink ? firstLink.url : linked.see[0]
        } else {
          output.url = null
        }
      }
github apifytech / apify-js / website / tools / helpers.js View on Github external
exports.class = (options) => {
    options.hash.kind = 'class';
    const result = ddata._identifier(options);
    if (result && result.kind === 'class') {
        result.scope = 'global';
        delete result.memberof;
    }
    return result ? options.fn(result) : 'ERROR, Cannot find class.';
};
github twitch-js / twitch-js / scripts / generateDocs / helpers.js View on Github external
var output = {}

  /*
  test input for
  1. A type expression containing a namepath, e.g. Array.
  2. a namepath referencing an `id`
  3. a namepath referencing a `longname`
  */
  if ((matches = input.match(/.*?<(.*?)>/))) {
    namepath = matches[1]
  } else {
    namepath = input
  }

  options.hash = { id: namepath }
  linked = dmd._identifier(options)
  if (!linked) {
    options.hash = { longname: namepath }
    linked = dmd._identifier(options)
  }
  if (!linked) {
    output = { name: input, url: null }
  } else {
    output.name = input.replace(namepath, linked.name)
    if (dmd.isExternal.call(linked)) {
      if (linked.description) {
        output.url = 'external#' + dmd.anchorName.call(linked, options)
      } else {
        if (linked.see && linked.see.length) {
          var firstLink = dmd.arseLink(linked.see[0])[0]
          output.url = firstLink ? firstLink.url : linked.see[0]
        } else {