dirname = (path) => {
	let idx = path.length - 1;
	while (idx >= 0) {
		const char = path.charCodeAt(idx);
		// slash or backslash
		if (char === 47 || char === 92) break;
		idx--;
	}
	if (idx < 0) return "";
	return path.slice(0, idx);
}
@param {string} path path
@returns {string} dirname