You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.
Just to poke this issue a bit... @jeanpa@jasongin@arjun-msft what do you guys think? Where does such common code live long term?
My suggestion:
We create a new node module opent2t-translator and put all functionality core to translators inside this module. We start with this argument validator but put other stuff (e.g. common logging methods) in there that all translators will need.
We put this new module under a new top-level repo called opent2t-translator.
What do you guys think? For now we can have lots of code duplication but we need to clean this up as we write more translators.
I'm not opposed to a new repo, but I think that name would be super confusing.
I might be in favor of just putting that kind of common code in the opent2t repo. Translator packages already have a dependency on part of that opent2t package for the schema readers. And just like the schema readers it could be under a separate directory (effectively a sub-package), and it would not necessarily need to be projected in client APIs.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
An example:
function validateArgumentType(arg, argName, expectedType) {
if (typeof arg === 'undefined') {
throw new Error('Missing argument: ' + argName + '. ' +
'Expected type: ' + expectedType + '.');
} else if (typeof arg !== expectedType) {
throw new Error('Invalid argument: ' + argName + '. ' +
'Expected type: ' + expectedType + ', got: ' + (typeof arg));
}
}
The text was updated successfully, but these errors were encountered: