normalize-package-data icon indicating copy to clipboard operation
normalize-package-data copied to clipboard

[QUESTION] Is it correct to "throw" on invalid name and/or invalid version?

Open myrne opened this issue 11 years ago • 0 comments

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).

myrne avatar Apr 08 '13 18:04 myrne