normalize-package-data
normalize-package-data copied to clipboard
[QUESTION] Is it correct to "throw" on invalid name and/or invalid version?
In original async code, callback was immediately called with an error object
var ret = validName(file, data)
if (ret !== true) return cb(ret);
ret = validVersion(file, data)
if (ret !== true) return cb(ret);
I wonder if this is desirable if this function would be used inside npm-www for example. If requirements for name or versions get more strict (I admit, maybe far-fetched) the whole normalization process stops. Considering the packageData is modified in-place, the data after the throw is then unnormalized (or half-normalized, depending on where the throw happened).