How to use the isAscii function from validator

Find comprehensive JavaScript validator.isAscii code examples handpicked from public code repositorys.

21
22
23
24
25
26
27
28
29
30
this.isAlphanumeric = (subject) =>  {
    return StringValidator.isAlphanumeric(subject) ? null : subject + ' is not alphanumeric';
}

this.isAscii = (subject) => {
    return StringValidator.isAscii(subject) ? null : subject + ' is not ascii';
}

this.isBase32 = (subject) => {
    return StringValidator.isBase32(subject) ? null : subject + ' is not base32';
fork icon1
star icon4
watch icon2

+ 3 other calls in file

179
180
181
182
183
184
185
186
187
188
  }
  return true;
},
isAscii: function(rule, value) {
  if (rule) {
    return validator.isAscii(value);
  }
  return true;
},
isFullWidth: function(rule, value) {
fork icon0
star icon2
watch icon2

+ 5 other calls in file

14
15
16
17
18
19
20
    'uppercase': validator.isUppercase,
    'int': validator.isInt,
    'float': validator.isFloat,
    'uuid': validator.isUUID,
    'json': validator.isJSON,
    'ascii': validator.isAscii
};
fork icon0
star icon2
watch icon2

+ 3 other calls in file

92
93
94
95
96
97
98
99
100
101
if (validator.isEmail(profile.email, { allow_display_name: true })
  // allow_display_name allows us to receive input as:
  // Display Name <email-address>
  // which we consider valid too
  && validator.isMobilePhone(profile.phone, 'he-IL')
  && validator.isAscii(profile.firstname)
  && validator.isAscii(profile.lastname)
  && validator.isAscii(profile.country)
) {
  // trim any extra spaces on the right of the name
fork icon0
star icon0
watch icon1

+ 11 other calls in file

82
83
84
85
86
87
88
89
90
91
    validator.isEmpty(passwd) || passwd === '{passwd}' || passwd === 'undefined' ||
    id_type === '{id_type}' || id_type === 'undefined') {
    return res.status(400).send({success:0,data: "Bad request, veuillez remplir tous les champs."});

} else if (validator.isAscii(nom) && validator.isEmail(email) && validator.isAscii(telephone)
    && validator.isAscii(site_web) && validator.isAscii(passwd)) {
    services.createPrestataire(nom, email, telephone, site_web, passwd,id_type, (error, results) => {
        if (error) {
            console.log(error);
            return res.status(400).send({success: 0, data: error});
fork icon0
star icon0
watch icon0

+ 5 other calls in file

62
63
64
65
66
67
68
69
70
71
    id_age === '{id_age}' || id_age === 'undefined' ||
    id_sexe === '{id_sexe}' || id_sexe === 'undefined' ||
    id_pays === '{id_pays}' || id_pays === 'undefined') {
    return res.status(400).send({success:0,data: "Bad request, veuillez remplir tous les champs."});

} else if (validator.isAscii(prenom) && validator.isAscii(nom) && validator.isEmail(email)
    && validator.isAscii(passwd)) {
    services.createPublic(prenom, nom, email, passwd, id_langue, id_age, id_sexe, id_pays,  (error, results) => {
        if (error) {
            console.log(error);
fork icon0
star icon0
watch icon0

+ 7 other calls in file