@darkwolf/validator
v21.13.4
Published
Validator
Downloads
94
Maintainers
Readme
Validator
Install
npm i --save @darkwolf/validator
Using
⚠️ Requires Node.js v12.x LTS or higher to use!
import Validator from '@darkwolf/validator'
const obj = {
ave: {
darkwolf: {
arr: [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
},
user: {
username: null,
email: undefined
}
}
}
Validator.has(obj, 'ave.darkwolf') // true
Validator.has(obj, 'ave.user.username') // true
Validator.has(obj, 'ave.user.email') // true
Validator.exists(false) // true
Validator.exists(obj, 'ave.user.username') // false
Validator.exists(obj, 'ave.user.email') // false
Validator.exists(obj, ['ave', 'darkwolf', 'arr', '[0]']) // true
Validator.exists(obj, ['ave.darkwolf.arr[10]']) // false