Replaces output placeholders inside <code>source</code> with
<code>value</code>
@param {String} source
@param {String} value
@returns {String}
512155
function replaceOutputPlaceholders(source, value) {
		var ranges = locateOutputPlaceholder(source);
		
		ranges.reverse().forEach(function(r) {
			source = utils.replaceSubstring(source, value, r);
		});
		
		return source;
	}
991409
function replaceInString(string, variables) {
    const model = createModel(string);
    let offset = 0;
    let output = '';

    for (let i = 0, il = model.variables.length; i < il; i++) {
        const v = model.variables[i];
        let value = v.name in variables ? variables[v.name] : v.name;
        if (typeof value === 'function') {
            value = value(model.string, v, offset + v.location);
        }

        output += model.string.slice(offset, v.location) + value;
        offset = v.location + v.length;
    }

    return output + model.string.slice(offset);
}
785044
function _keySourceHintFrom( method, source, environment ){
		var hints = [];
		if( method ) hints.push( method );
		if( source ) hints.push( source );
		if( environment ) hints.push( "WHEN " + environment );

		return hints.join(' ');
	}
156686
public void put(Object name, Object value) {
		this.source.put((name != null) ? name.toString() : null, value);
	}
33970
function placeholder (input, property) {
  return ( input === undefined || input === '' || input === null ) ? property : input;
}
319792
function(value)
	{
		var result = null;
		value = this.trim(value);

		if ( 0 == value.length )
		{
			return '';
		}

		switch ( value.charAt(0) )
		{
			case '[':
				result = this.parseSequence(value);
				break;
			case '{':
				result = this.parseMapping(value);
				break;
			default:
				result = this.parseScalar(value);
		}

		// some comment can end the scalar
		if ( value.substr(this.i+1).replace(/^\s*#.*$/, '') != '' ) {
		    console.log("oups "+value.substr(this.i+1));
			throw new YamlParseException('Unexpected characters near "'+value.substr(this.i)+'".');
		}

		return result;
	}
1065161
function processOutputs(outputs) {
  var removeSourceMaps = require('./sourcemaps').removeSourceMaps;

  var offset = 0;

  var outputObj = {};

  var sources = outputObj.sources = [];
  var sourceMapsWithOffsets = outputObj.sourceMapsWithOffsets = [];

  outputs.forEach(function(output) {
    var source;
    if (typeof output == 'object') {
      source = output.source || '';
      var offset_ = output.sourceMapOffset || 0;
      var map = output.sourceMap;
      if (map) {
        sourceMapsWithOffsets.push([offset + offset_, map]);
      }
    }
    // NB perhaps we should enforce output is always an object down the chain?
    else if (typeof output == 'string') {
      source = output;
    }
    else {
      var format = output ? output.toString() : typeof output;
      throw new Error("Unexpected output format: " + format);
    }
    source = removeSourceMaps(source || '');
    offset += countLines(source);
    sources.push(source);
  });

  return outputObj;
}
333229
private Statement handleTranslationWithPlaceholders(
      MsgNode msg,
      ImmutableList<SoyPrintDirective> escapingDirectives,
      Expression soyMsgParts,
      Expression locale,
      MsgPartsAndIds partsAndId) {
    // We need to render placeholders into a buffer and then pack them into a map to pass to
    // Runtime.renderSoyMsgWithPlaceholders.

    Map<String, Function<Expression, Statement>> placeholderNameToPutStatement =
        new LinkedHashMap<>();
    putPlaceholdersIntoMap(msg, partsAndId.parts, placeholderNameToPutStatement);
    // sanity check
    checkState(!placeholderNameToPutStatement.isEmpty());
    ConstructorRef cstruct =
        msg.isPlrselMsg() ? ConstructorRef.PLRSEL_MSG_RENDERER : ConstructorRef.MSG_RENDERER;
    Statement initRendererStatement =
        variables
            .getCurrentRenderee()
            .putInstanceField(
                thisVar,
                cstruct.construct(
                    constant(partsAndId.id),
                    soyMsgParts,
                    locale,
                    constant(placeholderNameToPutStatement.size())));
    List<Statement> initializationStatements = new ArrayList<>();
    initializationStatements.add(initRendererStatement);
    for (Function<Expression, Statement> fn : placeholderNameToPutStatement.values()) {
      initializationStatements.add(fn.apply(variables.getCurrentRenderee().accessor(thisVar)));
    }

    Statement initMsgRenderer = Statement.concat(initializationStatements);
    Statement render;
    if (areAllPrintDirectivesStreamable(escapingDirectives)) {
      AppendableAndOptions wrappedAppendable =
          applyStreamingEscapingDirectives(
              escapingDirectives,
              appendableExpression,
              parameterLookup.getPluginContext(),
              variables);
      FieldRef currentAppendableField = variables.getCurrentAppendable();
      Statement initAppendable =
          currentAppendableField.putInstanceField(thisVar, wrappedAppendable.appendable());
      Expression appendableExpression = currentAppendableField.accessor(thisVar);
      Statement clearAppendable =
          currentAppendableField.putInstanceField(
              thisVar, constantNull(LOGGING_ADVISING_APPENDABLE_TYPE));
      if (wrappedAppendable.closeable()) {
        clearAppendable =
            Statement.concat(
                appendableExpression
                    .checkedCast(BytecodeUtils.CLOSEABLE_TYPE)
                    .invokeVoid(MethodRef.CLOSEABLE_CLOSE),
                clearAppendable);
      }
      render =
          Statement.concat(
              initAppendable,
              detachState.detachForRender(
                  variables
                      .getCurrentRenderee()
                      .accessor(thisVar)
                      .invoke(
                          MethodRef.SOY_VALUE_PROVIDER_RENDER_AND_RESOLVE,
                          appendableExpression,
                          // set the isLast field to true since we know this will only be rendered
                          // once.
                          /* isLast=*/ constant(true))),
              clearAppendable);
    } else {
      Label start = new Label();
      SoyExpression value =
          SoyExpression.forSoyValue(
              StringType.getInstance(),
              detachState
                  .createExpressionDetacher(start)
                  .resolveSoyValueProvider(variables.getCurrentRenderee().accessor(thisVar))
                  .checkedCast(SOY_STRING_TYPE));
      for (SoyPrintDirective directive : escapingDirectives) {
        value = parameterLookup.getRenderContext().applyPrintDirective(directive, value);
      }
      render =
          appendableExpression.appendString(value.unboxAsString()).toStatement().labelStart(start);
    }
    return Statement.concat(
        initMsgRenderer,
        render,
        // clear the field
        variables
            .getCurrentRenderee()
            .putInstanceField(
                thisVar,
                BytecodeUtils.constantNull(ConstructorRef.MSG_RENDERER.instanceClass().type())));
  }
804072
function (e) {
		e.source = e.source.replace(re, function () {
			if (arguments[0] === arguments[2]) {
				return '';
			}

			return arguments[0];
		});
	}
1205870
function _setIn (source, key, value) {
    var result = {};

    for (var prop in source) {
        result[prop] = source[prop];
    }

    result[key] = value;

    return result;
}
240328
function(source){
    if (!source || (typeof source != 'object' && typeof source != 'function'))
    {
      /** @cut */ basis.dev.warn(this.constructor.className + '.addSource: value should be a dataset instance or to be able to resolve in dataset');
      return;
    }

    if (this.hasSource(source))
    {
      /** @cut */ basis.dev.warn(this.constructor.className + '.addSource: value is already in source list');
      return;
    }

    var sourceInfo = {
      owner: this,
      source: source,
      adapter: null,
      dataset: null
    };

    this.sourceValues_.push(sourceInfo);
    this.updateDataset_.call(sourceInfo, source);

    if (this.listen.sourceValue && source instanceof Emitter)
      source.addHandler(this.listen.sourceValue, this);
  }
629540
function setValue(source, keyPath, value) {
        var props = keyPath.split('.');
        for (var i = 0; i < props.length - 1; i++) {
            var prop = props[i];
            source = source[prop] = source[prop] || {};
        }
        source[props[props.length - 1]] = value;
    }
300614
function replacer(key, value) {
        if (!value) {
            return value;
        }

        const type = typeof value;

        if (type === 'object') {
            if (isRegExp(value)) {
                return '@__R-' + UID + '-' + (regexps.push(value) - 1) + '__@';
            }

            return value;
        }

        if (type === 'function') {
            return '@__F-' + UID + '-' + (functions.push(value) - 1) + '__@';
        }

        return value;
    }
501109
public boolean replaceIn(final StringBuffer source) {
        if (source == null) {
            return false;
        }
        return replaceIn(source, 0, source.length());
    }
343658
function stringFormat(source) {
        var args = arguments;
        return source.replace(
            /\{([0-9]+)\}/g,
            function (match, index) {
                return args[index - 0 + 1];
            });
    }
892181
function swap(source, target) {
  // wrap to allow string selectors, arrays etc.
  source = $(source);
  target = $(target);
  source.each(function(el, index) {
    var content = target.get(index);
    if(el.parentNode && content) {
      // deep clone template partial
      content = content.cloneNode(true);
      // replace sourc element with cloned target element
      el.parentNode.replaceChild(content, el);
    }
  })
}
806683
function postToSource()
			{
				// clear unnecessary tags when editor view empty
				var sourceStrings = editor.text()=="" && editor.html().length<12 ? "" : editor.html();
				
				thisElement.val(extractToText(sourceStrings));
			}