needy.js
function isValidPath(path, allowDots)
	{
		if (typeof path !== 'string')
			return false;
		if (!path)
			return false;
		if (!/^([a-z]:[\/\\])?[a-z0-9_~\/\.\-]+$/i.test(path))
			return false;
		if (!allowDots && /^\.{1,2}$/.test(path))
			return false;

		return true;
	}
function isValidPath(path, allowDots)
	{
		if (typeof path !== 'string')
			return false;
		if (!path)
			return false;
		if (!/^([a-z]:[\/\\])?[a-z0-9_~\/\.\-]+$/i.test(path))
			return false;
		if (!allowDots && /^\.{1,2}$/.test(path))
			return false;

		return true;
	}
function isValidPath ( path , allowDots ) { if ( typeof path !== 'string' ) return false ; if ( ! path ) return false ; if ( ! / ^([a-z]:[\/\\])?[a-z0-9_~\/\.\-]+$ / i . test ( path ) ) return false ; if ( ! allowDots && / ^\.{1,2}$ / . test ( path ) ) return false ; return true ; }
Make sure a path is a string, isn't empty, contains valid characters, and optionally isn't a dot path.
Make sure a path is a string isn t empty contains valid characters and optionally isn t a dot path .