How to use the equals function from validator
Find comprehensive JavaScript validator.equals code examples handpicked from public code repositorys.
5 6 7 8 9 10 11 12 13 14
this.contains = (seed) => (subject) => { return StringValidator.contains(subject, seed) ? null : 'Does not contain ' + seed; } this.equals = (comparison) => (subject) => { return StringValidator.equals(subject, comparison) ? null : 'Does not equal ' + comparison; } this.isAfter = (date) => (subject) => { return StringValidator.isAfter(subject, date) ? null: subject + ' is not after ' + date;
1
4
2
+ 3 other calls in file
19 20 21 22 23 24 25 26 27 28
return false; } return value.length <= rule; }, equals: function(rule, value) { return validator.equals(value, rule); }, contains: function(rule, value) { return validator.contains(value, rule); },
0
2
2
+ 5 other calls in file
62 63 64 65 66 67 68 69 70 71
const user = await User.findOne({ email: email }).populate("role"); if (user === null || undefined) { return res.status(400).send("Wrong user") } const isSame = await validator.equals(email, user.email); const isMatch = await bcrypt.compare(password, user.password); if (isMatch && isSame) {
0
1
1
+ 3 other calls in file
20 21 22 23 24 25 26 27 28 29
try { if (validator.equals(typeof req.body.infoOrder.name, 'string') && validator.matches(req.body.infoOrder.phone, /^(?:(?:\+|00)33|0)\s*[1-9](?:[\s.-]*\d{2}){4}$/) && validator.toDate(req.body.infoOrder.orderDate) && validator.equals(typeof req.body.infoOrder.totalPrice, 'number') && validator.equals(typeof req.body.userInfo, 'number')) { const newOrder = new OrderModel({ number_order: escape(req.body.infoOrder.orderDate + new Date().valueOf()), name: escape(req.body.infoOrder.name), phone: escape(req.body.infoOrder.phone),
0
0
1
+ 11 other calls in file
51 52 53 54 55 56 57 58 59 60
* @return {String} - A text in json informing of the BDD input of a new user. */ creatUser: async (req, res) => { try { if ((validator.equals(req.body.gender, "mr") || validator.equals(req.body.gender, "mrs")) && validator.isAlpha(req.body.name) && validator.isAlpha(req.body.firstname) && req.body.cookie) { if (!validator.isEmail(req.body.email)) {
0
0
1
validator.escape is the most popular function in validator (548 examples)