I don't think it was simplified much, but the comment definitely helps :)
```
// Remove the extension name.
ext  = libpath.extname(name);                                                  
name = name && ext && name.slice(0, -ext.length);
```