Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUSTION] Move value-inference functions into separate module? #14

Open
myrne opened this issue Apr 9, 2013 · 1 comment
Open

[QUSTION] Move value-inference functions into separate module? #14

myrne opened this issue Apr 9, 2013 · 1 comment
Labels

Comments

@myrne
Copy link
Contributor

myrne commented Apr 9, 2013

Currently, there's a local "fixer.js" containing the value-inference code.
If this was put in a separate module, other interfaces to this code could be written.

Normalization of all package data is one application.
Another application could be to make a "class" that takes package data in its constructor, than has methods to get the inferred/fixed value for any field.

pkgData = new PkgData rawPkgData
console.log pkgData.getBugsURL()

Sometimes normalizing all fields isn't needed. For example, in the code for npm bugs command.
I do consider this a "nice to have". Far from critical.

@myrne
Copy link
Contributor Author

myrne commented Apr 9, 2013

This is not as trivial to implement as it may seem, because creating the right value for one field could require having the right value for another beforehand.

For example getBugsURL would have to call getRepositoryField. This in itself is not hard to implement, but it would make the full normalization less efficient. Internally, it wouldn't be one sweep anymore. A potential approach would be to memoize the methods (i.e. cache their return value).

@darcyclarke darcyclarke changed the title Move value-inference functions into separate module? [QUSTION] Move value-inference functions into separate module? Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants