dist/yaml.legacy.js
function(value)
	{
		value = value.split("\r\n").join("\n").split("\r").join("\n");

		if ( !/\n$/.test(value) )
		{
			value += "\n";
		}

		// strip YAML header
		var count = 0;
		var regex = /^\%YAML[: ][\d\.]+.*\n/;
		while ( regex.test(value) )
		{
			value = value.replace(regex, '');
			count++;
		}
		this.offset += count;

		// remove leading comments
		regex = /^(#.*?\n)+/;
		if ( regex.test(value) )
		{
			var trimmedValue = value.replace(regex, '');
			
			// items have been removed, update the offset
			this.offset += this.subStrCount(value, "\n") - this.subStrCount(trimmedValue, "\n");
			value = trimmedValue;
		}

		// remove start of the document marker (---)
		regex = /^\-\-\-.*?\n/;
		if ( regex.test(value) )
		{
			trimmedValue = value.replace(regex, '');
			
			// items have been removed, update the offset
			this.offset += this.subStrCount(value, "\n") - this.subStrCount(trimmedValue, "\n");
			value = trimmedValue;

			// remove end of the document marker (...)
			value = value.replace(/\.\.\.\s*$/g, '');
		}

		return value;
	}
function(value)
	{
		value = value.split("\r\n").join("\n").split("\r").join("\n");

		if ( !/\n$/.test(value) )
		{
			value += "\n";
		}

		// strip YAML header
		var count = 0;
		var regex = /^\%YAML[: ][\d\.]+.*\n/;
		while ( regex.test(value) )
		{
			value = value.replace(regex, '');
			count++;
		}
		this.offset += count;

		// remove leading comments
		regex = /^(#.*?\n)+/;
		if ( regex.test(value) )
		{
			var trimmedValue = value.replace(regex, '');
			
			// items have been removed, update the offset
			this.offset += this.subStrCount(value, "\n") - this.subStrCount(trimmedValue, "\n");
			value = trimmedValue;
		}

		// remove start of the document marker (---)
		regex = /^\-\-\-.*?\n/;
		if ( regex.test(value) )
		{
			trimmedValue = value.replace(regex, '');
			
			// items have been removed, update the offset
			this.offset += this.subStrCount(value, "\n") - this.subStrCount(trimmedValue, "\n");
			value = trimmedValue;

			// remove end of the document marker (...)
			value = value.replace(/\.\.\.\s*$/g, '');
		}

		return value;
	}
function ( value ) { value = value . split ( "\r\n" ) . join ( "\n" ) . split ( "\r" ) . join ( "\n" ) ; if ( ! / \n$ / . test ( value ) ) { value += "\n" ; } // strip YAML header var count = 0 ; var regex = / ^\%YAML[: ][\d\.]+.*\n / ; while ( regex . test ( value ) ) { value = value . replace ( regex , '' ) ; count ++ ; } this . offset += count ; // remove leading comments regex = / ^(#.*?\n)+ / ; if ( regex . test ( value ) ) { var trimmedValue = value . replace ( regex , '' ) ; // items have been removed, update the offset this . offset += this . subStrCount ( value , "\n" ) - this . subStrCount ( trimmedValue , "\n" ) ; value = trimmedValue ; } // remove start of the document marker (---) regex = / ^\-\-\-.*?\n / ; if ( regex . test ( value ) ) { trimmedValue = value . replace ( regex , '' ) ; // items have been removed, update the offset this . offset += this . subStrCount ( value , "\n" ) - this . subStrCount ( trimmedValue , "\n" ) ; value = trimmedValue ; // remove end of the document marker (...) value = value . replace ( / \.\.\.\s*$ / g , '' ) ; } return value ; }
Cleanups a YAML string to be parsed.

@param string value The input YAML string

@return string A cleaned up YAML string
Cleanups a YAML string to be parsed .