Complete the JavaScript function to convert an absolute file path in a Unix-style file system to a simplified canonical path.
In Unix-style file system context, a single period . signifies the current directory, a double period .. denotes moving up one directory level, and multiple slashes such as // are interpreted as a single slash. In this problem, treat sequences of periods not covered by the previous rules (like ...) as valid names for files or directories.
For example: