INNER CODE UNIT · JavaScript
getCustomUpdaterFromPath
conventional-changelog/standard-version · lib/updaters/index.js:29
function getCustomUpdaterFromPath (updater) {
if (typeof updater === 'string') {
return require(path.resolve(process.cwd(), updater))
}
if (
typeof updater.readVersion === 'function' &&
typeof updater.writeVersion === 'function'
) {
return updater
}
throw new Error('Updater must be a string path or an object with readVersion and writeVersion methods')
}
/**
* Simple check to determine if the object provided is a compatible updater.
*/
function isValidUpdater (obj) {
return (