Wraps each +ProductSalesTaxRates+ node with
 ShipCompliant::ProductSalesTaxRate
763944
def wrap_products(products)
      Array.wrap(products[:product_sales_tax_rate]).map do |product|
        ProductSalesTaxRate.new(attributes_to_symbols(product))
      end
    end
1318161
private void maybeUpdateExportDeclaration(NodeTraversal t, Node n) {
    if (!currentScript.isModule
        || !n.getString().equals("exports")
        || !isAssignTarget(n)) {
      return;
    }

    Node assignNode = n.getParent();
    if (!currentScript.declareLegacyNamespace
        && currentScript.defaultExportLocalName != null) {
      assignNode.getParent().detach();
      return;
    }

    // Rewrite "exports = ..." as "var module$exports$foo$Bar = ..."
    Node rhs = assignNode.getLastChild();
    Node jsdocNode;
    if (currentScript.declareLegacyNamespace) {
      Node legacyQname = NodeUtil.newQName(compiler, currentScript.legacyNamespace).srcrefTree(n);
      assignNode.replaceChild(n, legacyQname);
      jsdocNode = assignNode;
    } else {
      rhs.detach();
      Node exprResultNode = assignNode.getParent();
      Node binaryNamespaceName = IR.name(currentScript.getBinaryNamespace());
      binaryNamespaceName.setOriginalName(currentScript.legacyNamespace);
      Node exportsObjectCreationNode = IR.var(binaryNamespaceName, rhs);
      exportsObjectCreationNode.useSourceInfoIfMissingFromForTree(exprResultNode);
      exportsObjectCreationNode.putBooleanProp(Node.IS_NAMESPACE, true);
      exprResultNode.replaceWith(exportsObjectCreationNode);
      jsdocNode = exportsObjectCreationNode;
      currentScript.hasCreatedExportObject = true;
    }
    markConstAndCopyJsDoc(assignNode, jsdocNode);
    compiler.reportChangeToEnclosingScope(jsdocNode);

    maybeUpdateExportObjectLiteral(t, rhs);
    return;
  }
80365
function (backendSummary) {
        backendSummary = backendSummary || {};

        return {
            sum:            safeUse(backendSummary.subtotal),
            shipping:       safeUse(backendSummary.shipping),
            surcharge:      safeUse(backendSummary.surcharge),
            vat:            safeUse(backendSummary.vat),
            total:          safeUse(backendSummary.grandtotal)
        };
    }
1332429
function normalizeRelatedNodes(node, options) {
	'use strict';
	['any', 'all', 'none'].forEach(type => {
		if (!Array.isArray(node[type])) {
			return;
		}
		node[type]
			.filter(checkRes => Array.isArray(checkRes.relatedNodes))
			.forEach(checkRes => {
				checkRes.relatedNodes = checkRes.relatedNodes.map(relatedNode => {
					var res = {
						html: relatedNode.source
					};
					if (options.elementRef && !relatedNode.fromFrame) {
						res.element = relatedNode.element;
					}
					if (options.selectors !== false || relatedNode.fromFrame) {
						res.target = relatedNode.selector;
					}
					if (options.xpath) {
						res.xpath = relatedNode.xpath;
					}
					return res;
				});
			});
	});
}
618152
function(fromSuite, toSuite) {
      each(fromSuite.specs, function(spec){
        spec.assertions = []
        toSuite.specs.push(spec)
      })
    }
16905
function TradingWrapper(apiKeyOrParams, apiSecret, nonceGen) {
    // Assume first parameter (i.e. apiKeyOrParams) is a params package
    let params = apiKeyOrParams;

    // Try to prove this assumption wrong
    if (params === null || typeof params !== "object") {
        // Pack parameters if so
        params = {
            apiKey: apiKeyOrParams,
            apiSecret: apiSecret,
            nonceGen: nonceGen
        };
    }

    // Assert parameter expectations
    ParamUtils.expectParams(params, {
        apiKey: "string",
        apiSecret: "string",
        nonceGen: {type: "function", opt: true}
    });

    this._apiKey = params.apiKey;
    this._apiSecret = params.apiSecret;
    this._nonceGen = params.nonceGen;
}
1252835
function wrapAll(callback) {
    // Prepare packages
    var packs = {};

    packages.forEach(function (pack, name) {
        packs[name] = pack;
    });

    return callback(packs);
}
476065
def buildPrices(data, roles=None, regex=default_price_regex,
                default=None, additional={}):
    ''' '''
    if isinstance(data, dict):
        data = [(item[0], convertPrice(item[1])) for item in data.items()]
        return dict([v for v in data if v[1] is not None])
    elif isinstance(data, (str, float, int)) and not isinstance(data, bool):
        if default is None:
            raise ValueError('You have to call setAdditionalCharges '
                             'before it is possible to pass a string as price')
        basePrice = convertPrice(data)
        if basePrice is None:
            return {}
        prices = {default: basePrice}
        for role in additional:
            extraCharge = convertPrice(additional[role])
            if extraCharge is None:
                continue
            prices[role] = basePrice + extraCharge
        return prices
    elif roles:
        prices = {}
        priceRoles = iter(roles)
        for priceData in data:
            price = convertPrice(priceData)
            if price is None:
                continue
            prices[next(priceRoles)] = price
        return prices
    else:
        raise TypeError('This type is for prices not supported!')
406628
function propagateSyntax(parent) {
            if (parent['messages']) {
                parent['messages'].forEach(function(child) {
                    child["syntax"] = parent["syntax"];
                    propagateSyntax(child);
                });
            }
            if (parent['enums']) {
                parent['enums'].forEach(function(child) {
                    child["syntax"] = parent["syntax"];
                });
            }
        }
546516
private void addUnitWrappers(TypeSpec.Builder type, NumberData data) {
    MethodSpec.Builder method = MethodSpec.methodBuilder("wrapUnits")
        .addModifiers(PROTECTED)
        .addParameter(PluralCategory.class, "category")
        .addParameter(DigitBuffer.class, "dbuf")
        .addParameter(String.class, "unit")
        .addParameter(StringBuilder.class, "dest");
    
    
    List<String> patterns = new ArrayList<>(new HashSet<>(data.currencyUnitPattern.values()));
    if (patterns.size() == 1) {
      // Short cut if all patterns are the same.
      List<Node> nodes = WRAPPER_PARSER.parseWrapper(patterns.get(0));
      for (Node node : nodes) {
        if (node instanceof Field) {
          Field field = (Field)node;
          if (field.ch() == '0') {
            method.addStatement("dbuf.appendTo(dest)");
          } else {
            method.addStatement("dest.append(unit)");
          }
        } else if (node instanceof Text) {
          method.addStatement("dest.append($S)", ((Text)node).text());
        }
      }
    } else {
      method.beginControlFlow("switch (category)");
      for (Map.Entry<String, String> entry : data.currencyUnitPattern.entrySet()) {
        String[] parts = entry.getKey().split("-");
        PluralCategory category = PluralCategory.fromString(parts[2]);
        String pattern = entry.getValue();
        List<Node> nodes = WRAPPER_PARSER.parseWrapper(pattern);
        if (category != PluralCategory.OTHER) {
          method.beginControlFlow("case $L:", category);
        } else {
          method.beginControlFlow("case $L:\ndefault:", category);
        }
        for (Node node : nodes) {
          if (node instanceof Field) {
            Field field = (Field)node;
            if (field.ch() == '0') {
              method.addStatement("dbuf.appendTo(dest)");
            } else {
              method.addStatement("dest.append(unit)");
            }
          } else if (node instanceof Text) {
            method.addStatement("dest.append($S)", ((Text)node).text());
          }
        }
        method.addStatement("break");
        method.endControlFlow();
      }
      method.endControlFlow();
    }
    
    type.addMethod(method.build());
  }
427129
function decorateClasses(node) {
    // check for class nodes
    var clsNode = getCommentedClassNode(node);
    if (!clsNode || !clsNode.jsdoc || clsNode.jsdoc.props.length === 0) {
        return;
    }

    var clsSrc = clsNode.node.source();
    if (clsSrc[0] !== "{") {
        // something isn't right, bail.
        return;
    }

    // work out line endings (find first \n and see if it has \r before it)
    var nl = "\n";
    var newlineIndex = clsSrc.indexOf("\n");
    if (clsSrc[newlineIndex-1] === "\r") {
        nl = "\r\n";
    }

    // use the same indent as the next non-blank line
    var indent = "";
    var lines = clsSrc.split(nl);
    for (var i = 1; i < lines.length; i++) { //i=1 to skip the starting {
        if (lines[i].length > 0) {
            var whitespaceMatch = /^[ \t]+/.exec(lines[i]); // match spaces or tabs
            if (whitespaceMatch) {
                indent = whitespaceMatch[0];
                break;
            }
        }
    }

    // work out what to inject into the class definition
    var fieldTypeDecls = clsNode.jsdoc.props.map(function(p) {
        return indent + p.name + ": " + p.type + ";";
    }).join(nl);

    clsNode.node.update("{" + nl + fieldTypeDecls + clsSrc.substr(1));
}
1118608
private static ProductPartitionNode copyCustomParametersToNode(
      BiddableAdGroupCriterion biddableCriterion, ProductPartitionNode node) {
    if (biddableCriterion.getUrlCustomParameters() == null
        || biddableCriterion.getUrlCustomParameters().getParameters() == null) {
      return node;
    }
    for (CustomParameter customParameter :
        biddableCriterion.getUrlCustomParameters().getParameters()) {
      node.putCustomParameter(customParameter.getKey(), customParameter.getValue());
    }
    return node;
  }
1118017
function templateNodeTransformation( $functionName, &$node,
                                         $tpl, $parameters, $privateData )
    {
        $tpl->ElseifCounter++;
        $newNodes       = array();
        $nodesToPrepend = array();
        $nodesToAppend  = array();
        $nodePlacement  = eZTemplateNodeTool::extractFunctionNodePlacement( $node );
        $uniqid        =  md5( $nodePlacement[2] ) . "_" . $tpl->ElseifCounter;
        $children       = eZTemplateNodeTool::extractFunctionNodeChildren( $node );


        $newNodes[] = eZTemplateNodeTool::createCodePieceNode( "// if begins" );
        $newNodes[] = eZTemplateNodeTool::createVariableNode( false, $parameters['condition'], $nodePlacement, array( 'treat-value-as-non-object' => true ), 'if_cond' );
        $newNodes[] = eZTemplateNodeTool::createCodePieceNode( "if ( \$if_cond )\n{" );
        $newNodes[] = eZTemplateNodeTool::createSpacingIncreaseNode();

        if ( is_array( $children ) )
        {
            foreach ( array_keys( $children ) as $childKey )
            {
                $child =& $children[$childKey];

                if ( $child[0] == eZTemplate::NODE_FUNCTION )
                {
                    $childFunctionName =& $child[2];
                    $childChildren     = eZTemplateNodeTool::extractFunctionNodeChildren( $child );
                    $childFunctionArgs =& $child[3];

                    if ( $childFunctionName == 'elseif' )
                    {
                        $compiledElseifCondition = eZTemplateCompiler::processElementTransformationList( $tpl, $child, $childFunctionArgs['condition'], $privateData );
                        $nodesToPrepend[] = eZTemplateNodeTool::createVariableNode( false, $compiledElseifCondition,
                                                                                    $nodePlacement,
                                                                                    array( 'text-result' => true ),
                                                                                    "elseif_cond_$uniqid" );
                        $newNodes[] = eZTemplateNodeTool::createSpacingDecreaseNode();
                        $newNodes[] = eZTemplateNodeTool::createCodePieceNode( "}\nelseif ( \$elseif_cond_$uniqid )\n{" );
                        $newNodes[] = eZTemplateNodeTool::createSpacingIncreaseNode();
                        $nodesToAppend[] = eZTemplateNodeTool::createVariableUnsetNode( "elseif_cond_$uniqid" );
                        // increment unique elseif counter
                        $uniqid        =  md5( $nodePlacement[2] ) . "_" . ++$tpl->ElseifCounter;
                    }
                    elseif ( $childFunctionName == 'else' )
                    {
                        $newNodes[] = eZTemplateNodeTool::createSpacingDecreaseNode();
                        $newNodes[] = eZTemplateNodeTool::createCodePieceNode( "}\nelse\n{" );
                        $newNodes[] = eZTemplateNodeTool::createSpacingIncreaseNode();
                    }
                    elseif ( $childFunctionName == 'break' )
                        $newNodes[] = eZTemplateNodeTool::createCodePieceNode( "break;\n" );
                    elseif ( $childFunctionName == 'continue' )
                        $newNodes[] = eZTemplateNodeTool::createCodePieceNode( "continue;\n" );
                    elseif ( $childFunctionName == 'skip' )
                        $newNodes[] = eZTemplateNodeTool::createCodePieceNode( "\$skipDelimiter = true;\ncontinue;\n" );

                    // let other functions (ones not listed in the conditions above) be transformed
                    if ( in_array( $childFunctionName, array( 'elseif', 'else', 'break', 'continue', 'skip' ) ) )
                         continue;
                }
                $newNodes[] = $child;
            }
        }

        $newNodes[] = eZTemplateNodeTool::createSpacingDecreaseNode();
        $newNodes[] = eZTemplateNodeTool::createCodePieceNode( "}" );
        $newNodes[] = eZTemplateNodeTool::createCodePieceNode( "unset( \$if_cond );" );
        $newNodes[] = eZTemplateNodeTool::createCodePieceNode( "// if ends\n" );

        $newNodes = array_merge( $nodesToPrepend, $newNodes, $nodesToAppend );

        return $newNodes;
    }
785839
function dollarRaw(selector, context, childOnly) {
    function flatten(a) { // flatten list, keep non-lists, remove nulls
      return isList(a) ? collector(flexiEach, a, flatten) : a;
    }
    function filterElements(list) { // converts into array, makes sure context is respected
      return filter(collector(flexiEach, list, flatten), function(node) {
        var a = node;
        while (a = a['parentNode'])
          if (a == context[0] || childOnly)
            return a == context[0];
        // fall through to return undef
      });
    }

    if (context) {
      if ((context = dollarRaw(context)).length != 1)
        return collectUniqNodes(context, function(ci) { return dollarRaw(selector, ci, childOnly);});
      else if (isString(selector)) {
        if (isNode(context[0]) != 1)
          return [];
        else
          return childOnly ? filterElements(context[0].querySelectorAll(selector)) : context[0].querySelectorAll(selector);
      }
      else
        return filterElements(selector);

    }
    else if (isString(selector))
      return document.querySelectorAll(selector);
    else
      return collector(flexiEach, selector, flatten);
  }
263135
function collect(node, options, context, variables={}) {
    for (let rule of node.rules) {
        if (rule.isRuleset)
            collect(rule, options, context, variables);
        else if (rule.importedFilename)
            collect(rule.root, options, context, variables);
        else if (rule.variable === true) {
            const name = rule.name.substring(1);
            const value = rule.value.eval(context);

            // save under all aliases
            for (let fn of options.rename) {
                variables[ fn(name) ] = toJS(value, options, context);
            }
        }
    }

    return variables;
}
807800
@Indexable(type = IndexableType.REINDEX)
	@Override
	public CommerceTaxFixedRate updateCommerceTaxFixedRate(
		CommerceTaxFixedRate commerceTaxFixedRate) {
		return commerceTaxFixedRatePersistence.update(commerceTaxFixedRate);
	}
424764
def glue(data)
      return unless block_given?

      template = sub_compile(data) { yield }

      template.nodes.each_value do |value|
        @attributes.add name: value.name, attr: "#{data}.#{value.attr}", nested: value.nested
      end
    end