```
function shaism(uri) {
  return uri.hash && uri.hash.slice(1);
}

var fromShaism = shaism(uri);
var resolvedShaism = shaism(url.parse(resolved));
if (fromShaism && resolvedShaism) {
  value = value.replace(fromShaism, resolvedShaism);
}
return value;
```

seems clearer to me...