converts AstNode, whether it's a string, array or hash into
 array of strings (when possible).
514959
def to_mixins_array(ast)
      v = ast.to_value
      mixins = v.is_a?(Hash) ? v.values : Array(v)
      mixins.all? {|mx| mx.is_a? String } ? mixins : []
    end
650538
private String toText(AstNode node) throws IOException {
    StringBuilder out = new StringBuilder();
    if (node instanceof StringContentNode) {
      out.append(((StringContentNode)node).getContent());
    } else if (node instanceof ContentNode) {
      NodeList nodes = ((ContentNode) node).getContent();
      for (AstNode subNode : nodes) {
        out.append(toText(subNode));
      }
    }
    return out.toString();
  }
1027741
function toArray(arrayLike) {
        if (arrayLike === undefined || arrayLike === null) {
            return [];
        }
        if (Array.isArray(arrayLike)) {
            return arrayLike;
        }
        return [arrayLike];
    }
880105
function toArray(path: NodePath): Array<string> {
  const parts = [path];
  let result = [];

  while (parts.length > 0) {
    path = parts.shift();
    const node = path.node;
    if (t.CallExpression.check(node)) {
      parts.push(path.get('callee'));
      continue;
    } else if (t.MemberExpression.check(node)) {
      parts.push(path.get('object'));
      if (node.computed) {
        const resolvedPath = resolveToValue(path.get('property'));
        if (resolvedPath !== undefined) {
          result = result.concat(toArray(resolvedPath));
        } else {
          result.push('<computed>');
        }
      } else {
        result.push(node.property.name);
      }
      continue;
    } else if (t.Identifier.check(node)) {
      result.push(node.name);
      continue;
    } else if (t.Literal.check(node)) {
      result.push(node.raw);
      continue;
    } else if (t.ThisExpression.check(node)) {
      result.push('this');
      continue;
    } else if (t.ObjectExpression.check(node)) {
      const properties = path.get('properties').map(function(property) {
        return (
          toString(property.get('key')) + ': ' + toString(property.get('value'))
        );
      });
      result.push('{' + properties.join(', ') + '}');
      continue;
    } else if (t.ArrayExpression.check(node)) {
      result.push(
        '[' +
          path
            .get('elements')
            .map(toString)
            .join(', ') +
          ']',
      );
      continue;
    }
  }

  return result.reverse();
}
742640
def string_to_element(element_as_string, include_namespaces=False):
    

    if element_as_string is None:
        return None
    elif isinstance(element_as_string, ElementTree):
        return element_as_string.getroot()
    elif isinstance(element_as_string, ElementType):
        return element_as_string
    else:
        element_as_string = _xml_content_to_string(element_as_string)

    if not isinstance(element_as_string, string_types):
        # Let cElementTree handle the error
        return fromstring(element_as_string)
    elif not strip_xml_declaration(element_as_string):
        # Same as ElementTree().getroot()
        return None
    elif include_namespaces:
        return fromstring(element_as_string)
    else:
        return fromstring(strip_namespaces(element_as_string))
180365
function toArray (obj) {
  if (Array.isArray(obj)) return obj
  else if (typeof obj === 'string') return obj.trim().split(/\s+/)
  else return [ obj ]
}
1231580
def get_as_array(self, key):
        
        value = self.get(key)
        return AnyValueMap.from_value(value)
501573
private String[] convertListToStringArray(List<?> rawValues, ExtendedAttributeDefinition attrDef, EvaluationContext context,
                                              boolean ignoreWarnings) throws ConfigEvaluatorException {
        @SuppressWarnings({ "unchecked", "rawtypes" })
        Collection<String> collection = (Collection) convertListToVector(rawValues, attrDef, context, ignoreWarnings);
        return collection == null ? null : collection.toArray(new String[collection.size()]);
    }
1069012
function nodeToString(node) {
    switch (node.type) {
        case ("BinaryExpression"): {
            return nodeToString(node.left) + node.operator.toString() + nodeToString(node.right);
        }
        case ("CallExpression"): {
            var args = node.arguments.map(function(arg) {
                return nodeToString(arg);
            }).toString();
            return nodeToString(node.callee) + "(" + args + ")";
        }
        case ("ConditionalExpression"): {
            return nodeToString(node.test) + "?" + nodeToString(node.consequent) + ":" + nodeToString(node.alternate);
        }
        case ("Identifier"): {
            return node.name.toString();
        }
        case ("Literal"): {
            return node.value.toString();
        }
        case ("MemberExpression"): {
            return nodeToString(node.object) + "[" + nodeToString(node.property) + "]";
        }
        case ("TemplateElement"): {
            return node.value.raw.toString();
        }
        case ("TemplateLiteral"): {
            // interleave quasis with expressions
            var s = [];
            node.quasis.forEach(function(quasi, i) {
                if (quasi.value.raw) {
                    s.push(nodeToString(quasi));
                }
                var expression = node.expressions[i];
                if (expression) {
                    s.push(nodeToString(expression));
                }
            });
            return s.join("");
        }
        default: {
            // Silently ignore Nodes with types we don't handle
            return "";
        }
    }
}
84966
def _nodes_to_values(self):
        
        def is_none(slice):
            return slice[0] == -1 and slice[1] == -1

        def get(slice):
            return self.string[slice[0]:slice[1]]

        return [(varname, get(slice), slice) for varname, slice in self._nodes_to_regs() if not is_none(slice)]
1249218
function arrayOfArraysOfStrings(a, checkLowerCase) {
    return check.array(a) && a.every(function (arr) {
      return check.arrayOfStrings(arr, checkLowerCase);
    });
  }
110836
def to_hash(node)
      node_type = get_node_type node

      case node_type
      when :blank
        {}
      when :branch
        hash = {}

        16.times do |i|
          sub_hash = to_hash decode_to_node(node[i])
          sub_hash.each {|k, v| hash[NibbleKey.new([i]) + k] = v }
        end

        hash[NibbleKey.terminator] = node.last if node.last.true?
        hash
      when *NODE_KV_TYPE
        nibbles = NibbleKey.decode(node[0]).terminate(false)

        sub_hash = node_type == :extension ?
          to_hash(decode_to_node(node[1])) : {NibbleKey.terminator => node[1]}

        {}.tap do |hash|
          sub_hash.each {|k, v| hash[nibbles + k] = v }
        end
      else
        # do nothing
      end
    end
522253
function(ast, source) {
      if(!ast) return;
      for(var i=0;i<ast.length;i++) {
        var node=ast[i];
        if(node && node.length>=3 && node[0]=='=') {
          // looking for ['=', id, val]
          runtime.ast()[node[1]] = {'ast': [node]};
          runtime.source()[node[1]] = source;
        }
      }
    }
41640
def as_strings(self):
        """"""
        ret = []
        for x in self.children:
            if isinstance(x, (Key, Comment)):
                ret.append(x.as_strings)
            else:
                for y in x.as_strings:
                    ret.append(y)
        if ret:
            ret[-1] = re.sub('}\n+$', '}\n', ret[-1])
        return ret
963273
function isStringLiteralArray(node) {
    return isArrayExpr(node) &&
           isArray(node.elements) &&
           node.elements.every(isStringLiteral);
}
1342736
def from_string(cls, string):
        """"""
        if string is None:
            string = ''

        if not isinstance(string, six.string_types):
            raise TypeError('string has to be a string type, got: {}'.format(type(string)))

        dictionary = {}
        tokens = [token.strip() for token in shlex.split(string)]

        def list_tuples(some_iterable):
            items, nexts = itertools.tee(some_iterable, 2)
            nexts = itertools.chain(itertools.islice(nexts, 1, None), [None])
            return list(zip(items, nexts))

        for token_current, token_next in list_tuples(tokens):

            # If current token starts with a dash, it is a value so we skip it
            if not token_current.startswith('-'):
                continue

            # If the next token is None or starts with a dash, the current token must be a flag, so the value is True
            if not token_next or token_next.startswith('-'):
                dictionary[token_current.lstrip('-')] = True

            # Otherwise the current token is an option with the next token being its value
            else:
                dictionary[token_current.lstrip('-')] = token_next

        return cls.from_dictionary(dictionary)
924480
def string_to_hash(markup)
      options = {}

      if match = markup.match(Syntax)
        markup.scan(TagAttributes) do |key, value|
          options[key.to_sym] = value.gsub(/\A"|"\z/, "")
        end
      end

      options
    end