Validator
Install
npm i --save @darkwolf/validator
Using
import validator from '@darkwolf/validator'
import isUnixTimestamp from '@darkwolf/validator/isUnixTimestamp'
validator
.define('isUnixTimestamp', isUnixTimestamp)
.define('isIntegerUnixTimestamp', value =>
validator.isInteger(value) &&
validator.isUnixTimestamp(value)
)
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')
validator.has(obj, 'ave.user.username')
validator.has(obj, 'ave.user.email')
validator.exists(false)
validator.exists(obj, 'ave.user.username')
validator.exists(obj, 'ave.user.email')
validator.exists(obj, ['ave', 'darkwolf', 'arr', '[0]'])
validator.exists(obj, ['ave.darkwolf.arr[10]'])
Donate
You can contribute to the development of open source projects by making your donation
Bitcoin (BTC): 15sjjAUtJdB1ncsxKK7KtyJPtF46UhXWo4
Ethereum (ETH): 0xF02F68eb33E9eC73b8E9c3c0953E6782E2376867
Bitcoin Cash (BCH): qq6h3a78h3wlt04eyp9ydht94r6guzjdps9hqwgfzw
Contact Me