objecture
Version:
❂ Objecture ⏣ Object Watcher, Property Manager ⊚ Capture property changes for object, array mutator methods. ⊚ Schematize and validate object, array properties. ⊚ Browser, NodeJS compatible. ⁘ Uses Core-Plex - Event Listener Manage
20 lines • 594 B
JavaScript
import Validator from '../../validator/index.js'
export default class MatchValidator extends Validator {
constructor($settings = {}, $schema) {
super(Object.assign($settings, {
type: 'match',
validate: ($key, $value) => {
const definition = this.settings
let pass
if(![
'string', 'number', 'boolean'
].includes(typeof $value)) { pass = false}
else {
const match = definition
const valueMatch = (match.value.exec($value) !== null)
}
return pass ? true : false
},
}), $schema)
}
}