Extract config from dataSource nodes.

@param {Node} node
@return {Object}
@private
1503
function getDataSource(node) {
    const config = Object.assign({}, copyXmlAttributes(node));

    if (node.childNodes.length) {
        // parse datasource options
        for (let i = 0; i < node.childNodes.length; ++i) {
            const childNode = node.childNodes.item(i);

            if (childNode.nodeType === TEXT_NODE && childNode.textContent.trim().length > 0) {
                throw new ImplementationError(`dataSource contains useless text: "${childNode.textContent.trim()}"`);
            }

            if (
                childNode.nodeType === ELEMENT_NODE &&
                childNode.namespaceURI === 'urn:flora:options' &&
                childNode.localName === 'option'
            ) {
                if (childNode.attributes.length !== 1)
                    throw new Error('flora:option element requires a name attribute');

                const attr = childNode.attributes.item(0);
                if (attr.localName !== 'name') throw new Error('flora:option element requires a name attribute');
                if (config[attr.value]) throw new Error(`Data source option "${attr.value}" already defined`);

                config[attr.value] = childNode.textContent.trim();
            }
        }
    }

    const name = config.name ? config.name : 'primary';
    if (config.name) delete config.name;

    return { name, config };
}
1058427
function(node) {
        var attributes = {};
        var i, len, data, key;
        var dataNodes = node.getElementsByTagName("Data");
        for (i = 0, len = dataNodes.length; i < len; i++) {
            data = dataNodes[i];
            key = data.getAttribute("name");
            var ed = {};
            var valueNode = data.getElementsByTagName("value");
            if (valueNode.length) {
                ed['value'] = this.getChildValue(valueNode[0]);
            }
            if (this.kvpAttributes) {
                attributes[key] = ed['value'];
            } else {
                var nameNode = data.getElementsByTagName("displayName");
                if (nameNode.length) {
                    ed['displayName'] = this.getChildValue(nameNode[0]);
                }
                attributes[key] = ed;
            } 
        }
        var simpleDataNodes = node.getElementsByTagName("SimpleData");
        for (i = 0, len = simpleDataNodes.length; i < len; i++) {
            var ed = {};
            data = simpleDataNodes[i];
            key = data.getAttribute("name");
            ed['value'] = this.getChildValue(data);
            if (this.kvpAttributes) {
                attributes[key] = ed['value'];
            } else {
                ed['displayName'] = key;
                attributes[key] = ed;
            }
        }
        
        return attributes;    
    }
981760
function(node) {

        var parent = node.parent;

        switch (node.type) {
            case "ClassDeclaration":
            case "FunctionDeclaration":
                if (looksLikeExport(parent)) {
                    return findJSDocComment(parent.leadingComments, parent.loc.start.line);
                }
                return findJSDocComment(node.leadingComments, node.loc.start.line);

            case "ClassExpression":
                return findJSDocComment(parent.parent.leadingComments, parent.parent.loc.start.line);

            case "ArrowFunctionExpression":
            case "FunctionExpression":

                if (parent.type !== "CallExpression" && parent.type !== "NewExpression") {
                    while (parent && !parent.leadingComments && !/Function/.test(parent.type) && parent.type !== "MethodDefinition" && parent.type !== "Property") {
                        parent = parent.parent;
                    }

                    return parent && parent.type !== "FunctionDeclaration" ? findJSDocComment(parent.leadingComments, parent.loc.start.line) : null;
                } else if (node.leadingComments) {
                    return findJSDocComment(node.leadingComments, node.loc.start.line);
                }

            // falls through

            default:
                return null;
        }
    }
521388
function parseSource (node, nodeType, feedType) {
  var source = {},
      sourceNode = node.source,
      temp;

  if (!sourceNode) {
    return;
  }

  if (temp = (feedType === 'atom' && utils.get(sourceNode.title)) || utils.get(sourceNode)) {
    source.title = temp;
  }
  if (temp = (feedType === 'atom' && utils.getAttr(sourceNode.link, 'href')) || utils.getAttr(sourceNode, 'url')) {
    source.url = temp;
  }

  return Object.keys(source).length && source;
}
328445
function(node) {
      var i;
      var j;
      var k;
      var l;
      var componentName;
      var componentNode;
      // Get the component path
      var componentPath = [];
      while (node) {
        if (node.property && node.property.type === 'Identifier') {
          componentPath.push(node.property.name);
        }
        if (node.object && node.object.type === 'Identifier') {
          componentPath.push(node.object.name);
        }
        node = node.object;
      }
      componentPath.reverse();
      componentName = componentPath.slice(0, componentPath.length - 1).join('.');

      // Find the variable in the current scope
      var variableName = componentPath.shift();
      if (!variableName) {
        return null;
      }
      var variableInScope;
      var variables = variableUtil.variablesInScope(context);
      for (i = 0, j = variables.length; i < j; i++) {
        if (variables[i].name === variableName) {
          variableInScope = variables[i];
          break;
        }
      }
      if (!variableInScope) {
        return null;
      }

      // Try to find the component using variable references
      var refs = variableInScope.references;
      var refId;
      for (i = 0, j = refs.length; i < j; i++) {
        refId = refs[i].identifier;
        if (refId.parent && refId.parent.type === 'MemberExpression') {
          refId = refId.parent;
        }
        if (sourceCode.getText(refId) !== componentName) {
          continue;
        }
        if (refId.type === 'MemberExpression') {
          componentNode = refId.parent.right;
        } else if (refId.parent && refId.parent.type === 'VariableDeclarator') {
          componentNode = refId.parent.init;
        }
        break;
      }

      if (componentNode) {
        // Return the component
        return components.add(componentNode, 1);
      }

      // Try to find the component using variable declarations
      var defInScope;
      var defs = variableInScope.defs;
      for (i = 0, j = defs.length; i < j; i++) {
        if (defs[i].type === 'ClassName' || defs[i].type === 'FunctionName' || defs[i].type === 'Variable') {
          defInScope = defs[i];
          break;
        }
      }
      if (!defInScope || !defInScope.node) {
        return null;
      }
      componentNode = defInScope.node.init || defInScope.node;

      // Traverse the node properties to the component declaration
      for (i = 0, j = componentPath.length; i < j; i++) {
        if (!componentNode.properties) {
          continue;
        }
        for (k = 0, l = componentNode.properties.length; k < l; k++) {
          if (componentNode.properties[k].key.name === componentPath[i]) {
            componentNode = componentNode.properties[k];
            break;
          }
        }
        if (!componentNode || !componentNode.value) {
          return null;
        }
        componentNode = componentNode.value;
      }

      // Return the component
      return components.add(componentNode, 1);
    }
1242907
function(element) {
        var doc = Y.config.doc;
        if (element) {
            doc = (element[NODE_TYPE] === 9) ? element : // element === document
                element[OWNER_DOCUMENT] || // element === DOM node
                element.document || // element === window
                Y.config.doc; // default
        }

        return doc;
    }
783574
public function getJsonConfig($node = null)
    {
        $json = Json::decode($this->json_config);

        if (!$node) {
            return $json;
        }

        if (isset($json[$node])) {
            return $json[$node];
        }

        return [];
    }
829110
private DatanodeDescriptor getDatanode(DatanodeID node) {
    if (node == null) {
      return null;
    }
    DatanodeDescriptor ds = null;
    try {
      ds = namesystem.getDatanode(node);
    } catch (Exception e) {
      // probably dead on unregistered datanode
      LOG.warn("Failover - caught exception when getting datanode", e);
      return null;
    }
    return ds;
  }
233353
function(node) {
        var data = []

        for (var i = 0, len = node.childNodes.length; i < len; i++) {
            var child = node.childNodes[i]
            if (child.nodeType != ELEMENT_NODE) {
                continue
            }

            data.push(this._parseNode(child))
        }

        return data
    }
822712
function findDeepestNode(node) {
	while (node.children.length) {
		node = node.children[node.children.length - 1];
	}

	return node;
}
1278179
function getCommandLineNodeConfig () {
  if (commandLineNodeConfig === undefined) {
    var argv = process.argv.slice(2, process.argv.length);
    for (var i = 0; i < argv.length; i++) {
      if (startsWith(argv[i], '--NODE_CONFIG=')) {
        commandLineNodeConfig = parseJSON(argv[i].substring('--NODE_CONFIG='.length), 'Unable to parse the JSON from the "--NODE_CONFIG" command line argument');
        break;
      }
    }

    if (commandLineNodeConfig === undefined) {
      commandLineNodeConfig = null;
    }
  }

  return commandLineNodeConfig;
}
164966
private Config getNodeConfigWithOverrides(Config nodeConfig, Path nodeFilePath) {
    String nodeId = nodeFilePath.getParent().getName();
    return nodeConfig.withValue(FlowGraphConfigurationKeys.DATA_NODE_ID_KEY, ConfigValueFactory.fromAnyRef(nodeId));
  }
1014294
function parseNodeValue(node) {
  const childNodes = node && node.childNodes && [...node.childNodes];
  if (!childNodes) {
    return {};
  }

  // Trying to find and parse CDATA as JSON
  const cdatas = childNodes.filter((childNode) => childNode.nodeName === '#cdata-section');
  if (cdatas && cdatas.length > 0) {
    try {
      return JSON.parse(cdatas[0].data);
    } catch (e) {}
  }

  // Didn't find any CDATA or failed to parse it as JSON
  return childNodes.reduce((previousText, childNode) => {
    let nodeText = '';
    switch (childNode.nodeName) {
      case '#text':
        nodeText = childNode.textContent.trim();
        break;
      case '#cdata-section':
        nodeText = childNode.data;
        break;
    }
    return previousText + nodeText;
  }, '');
}
1148355
function transformFunction(node) {
  var nameNode = node.nodes[0];
  var paramsNodes = node.nodes[1] ? node.nodes[1].nodes : [];
  node.name = nameNode.value;
  if (node.name) {
    node.item('functions')[node.name] = node;
  }
  node.params = [];
  node.paramIndex = {};

  var paramTags = node.paramTags;
  // for functions assigned to variables, paramTags are in parent --
  // i.e. '/* @param a */ var parent = function (a) {}'
  if (node.paramTags === undefined && node.parent &&
      node.parent.type === 'assign' && node.parent.paramTags) {
    paramTags = node.parent.paramTags;
  }
  node.item('paramTags', paramTags);

  if (node.copyTags) {
    var tagSource = node.item('functions')[node.copyTags];
    if (tagSource) {
      if (!node.description && tagSource.description) {
        node.description = tagSource.description;
      }
      if (!paramTags && tagSource.item('paramTags')) {
        paramTags = tagSource.item('paramTags');
      }
    }
  }

  paramsNodes.forEach(function (paramNode, i) {
    var param = {
      name: paramNode.value
    };
    node.paramIndex[param.name] = i;
    if (paramTags) {
      if (paramTags[param.name]) {
        var tagValue = paramTags[param.name];
    // if (node.item('path') === 'cli') {
    //   console.log(tagValue)
    // }
        Object.keys(tagValue).forEach(function (key, i) {
          if (key !== 'name') {
            param[key] = tagValue[key];
          }
        });
      }
    }
    node.params.push(param);
  });
    // if (node.item('path') === 'cli') {
    //   console.log(node.params)
    // }
}
201143
public static Key<ConfigRecord> getKey (String node, String object, String field)
    {
        return newKey(_R, node, object, field);
    }
256163
function getNodeProps(node, key, opts, renderer) {
    var props = { key: key }, undef;

    // `sourcePos` is true if the user wants source information (line/column info from markdown source)
    if (opts.sourcePos && node.sourcepos) {
        props['data-sourcepos'] = flattenPosition(node.sourcepos);
    }

    var type = normalizeTypeName(node.type);

    switch (type) {
        case 'html_inline':
        case 'html_block':
            props.isBlock = type === 'html_block';
            props.escapeHtml = opts.escapeHtml;
            props.skipHtml = opts.skipHtml;
            break;
        case 'code_block':
            var codeInfo = node.info ? node.info.split(/ +/) : [];
            if (codeInfo.length > 0 && codeInfo[0].length > 0) {
                props.language = codeInfo[0];
                props.codeinfo = codeInfo;
            }
            break;
        case 'code':
            props.children = node.literal;
            props.inline = true;
            break;
        case 'heading':
            props.level = node.level;
            break;
        case 'softbreak':
            props.softBreak = opts.softBreak;
            break;
        case 'link':
            props.href = opts.transformLinkUri ? opts.transformLinkUri(node.destination) : node.destination;
            props.title = node.title || undef;
            if (opts.linkTarget) {
                props.target = opts.linkTarget;
            }
            break;
        case 'image':
            props.src = opts.transformImageUri ? opts.transformImageUri(node.destination) : node.destination;
            props.title = node.title || undef;

            // Commonmark treats image description as children. We just want the text
            props.alt = node.react.children.join('');
            node.react.children = undef;
            break;
        case 'list':
            props.start = node.listStart;
            props.type = node.listType;
            props.tight = node.listTight;
            break;
        default:
    }

    if (typeof renderer !== 'string') {
        props.literal = node.literal;
    }

    var children = props.children || (node.react && node.react.children);
    if (Array.isArray(children)) {
        props.children = children.reduce(reduceChildren, []) || null;
    }

    return props;
}
946466
function (node) {
      let currentNode = node;
      let i;
      let j;
      let k;
      let l;
      // Get the component path
      const componentPath = [];
      while (currentNode) {
        if (currentNode.property && currentNode.property.type === 'Identifier') {
          componentPath.push(currentNode.property.name);
        }
        if (currentNode.object && currentNode.object.type === 'Identifier') {
          componentPath.push(currentNode.object.name);
        }
        currentNode = currentNode.object;
      }
      componentPath.reverse();

      // Find the variable in the current scope
      const variableName = componentPath.shift();
      if (!variableName) {
        return null;
      }
      let variableInScope;
      const variables = context.getScope().variables;
      for (i = 0, j = variables.length; i < j; i++) { // eslint-disable-line no-plusplus
        if (variables[i].name === variableName) {
          variableInScope = variables[i];
          break;
        }
      }
      if (!variableInScope) {
        return null;
      }

      // Find the variable declaration
      let defInScope;
      const defs = variableInScope.defs;
      for (i = 0, j = defs.length; i < j; i++) { // eslint-disable-line no-plusplus
        if (
          defs[i].type === 'ClassName' ||
          defs[i].type === 'FunctionName' ||
          defs[i].type === 'Variable'
        ) {
          defInScope = defs[i];
          break;
        }
      }
      if (!defInScope) {
        return null;
      }
      currentNode = defInScope.node.init || defInScope.node;

      // Traverse the node properties to the component declaration
      for (i = 0, j = componentPath.length; i < j; i++) { // eslint-disable-line no-plusplus
        if (!currentNode.properties) {
          continue; // eslint-disable-line no-continue
        }
        for (k = 0, l = currentNode.properties.length; k < l; k++) { // eslint-disable-line no-plusplus, max-len
          if (currentNode.properties[k].key.name === componentPath[i]) {
            currentNode = currentNode.properties[k];
            break;
          }
        }
        if (!currentNode) {
          return null;
        }
        currentNode = currentNode.value;
      }

      // Return the component
      return components.get(currentNode);
    }