import { exists, isArray, isSafePath } from './misc'
-import * as validator from 'validator'
+import validator from 'validator'
import { PluginType } from '../../../shared/models/plugins/plugin.type'
import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
import { PluginPackageJson } from '../../../shared/models/plugins/plugin-package-json.model'
function isPluginNameValid (value: string) {
return exists(value) &&
validator.isLength(value, PLUGINS_CONSTRAINTS_FIELDS.NAME) &&
- validator.matches(value, /^[a-z\-]+$/)
+ validator.matches(value, /^[a-z-]+$/)
}
function isNpmPluginNameValid (value: string) {
}
function isLibraryCodeValid (library: any) {
- return typeof library.register === 'function'
- && typeof library.unregister === 'function'
+ return typeof library.register === 'function' &&
+ typeof library.unregister === 'function'
}
export {