chai-untab.js
function doUntab(input, depth = undefined, trim = undefined){
	
	/** Not a string? Leave it. */
	if("[object String]" !== Object.prototype.toString.call(input))
		return input;
	
	if(trim === undefined)  trim  = _trim;
	if(depth === undefined) depth = _depth;
	
	/** Strip leading and trailing lines if told to */
	if(trim)
		input = input.replace(/^(?:[\x20\t]*\n)*|(?:\n[\x20\t]*)*$/gi, "");
	
	const untabPatt = new RegExp("^(?:" + untabChar + "){0," + depth + "}", "gm");
	return input.replace(untabPatt, "");
}
function doUntab(input, depth = undefined, trim = undefined){
	
	/** Not a string? Leave it. */
	if("[object String]" !== Object.prototype.toString.call(input))
		return input;
	
	if(trim === undefined)  trim  = _trim;
	if(depth === undefined) depth = _depth;
	
	/** Strip leading and trailing lines if told to */
	if(trim)
		input = input.replace(/^(?:[\x20\t]*\n)*|(?:\n[\x20\t]*)*$/gi, "");
	
	const untabPatt = new RegExp("^(?:" + untabChar + "){0," + depth + "}", "gm");
	return input.replace(untabPatt, "");
}
function doUntab ( input , depth = undefined , trim = undefined ) { /** Not a string? Leave it. */ if ( "[object String]" !== Object . prototype . toString . call ( input ) ) return input ; if ( trim === undefined ) trim = _trim ; if ( depth === undefined ) depth = _depth ; /** Strip leading and trailing lines if told to */ if ( trim ) input = input . replace ( / ^(?:[\x20\t]*\n)*|(?:\n[\x20\t]*)*$ / gi , "" ) ; const untabPatt = new RegExp ( "^(?:" + untabChar + "){0," + depth + "}" , "gm" ) ; return input . replace ( untabPatt , "" ) ; }
Remove leading indentation using Chai's current untab- settings.

Called automatically, but exposed for external use. If the supplied
argument isn't a string, it's returned untouched without further ado.

Arguments beyond the first are optional: if either depth or trim are
omitted, they default to those set for the current suite level.

@param {Mixed} input
@param {Number} depth
@param {Boolean} trim
@return {Mixed|String}
@public
Remove leading indentation using Chai s current untab - settings .