Closed drobnikj closed 4 years ago
I got it now. Because you can globally register validator using ow.create(), it doesn't make sense to mix two instances of ow.
I solve it to export ow from utils modules. Updated code: This is the code in utils module
const ow = require('ow')
const checkWithtFriendlyError(value, argName, pattern) => {
try {
ow(value, argName, pattern);
} catch (err) {
// do some stuff
}
return true;
}
module.exports = {
checkWithFriendlyError,
check: ow,
};
The other npm module
const { checkWithtFriendlyError, check } = require('my_utils_module');
const test = 'string';
checkWithtFriendlyError(test, 'test', check.string)
Hi, thank you for this amazing tool!
I found an issue that I can not use ow across npm modules. This is the code in my utils module
The other npm module
The code ends with error
TypeError: n[a.testSymbol] is not a function
Any idea how to avoid this issue?