How to use the isHexColor function from validator

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

22
23
24
25
26
27
28
29
30
31

console.log('YXNkYXNkc2R2YWFzbG5rc2FkbnZsc2EnZHY=\n', 'isBase64', validator.isBase64('YXNkYXNkc2R2YWFzbG5rc2FkbnZsc2EnZHY='));
console.log('asdasdsdvaaslnksadnvlsa"dv\n', 'isBase64', validator.isBase64('asdasdsdvaaslnksadnvlsa"dv'));


console.log('ccc\n', 'isHexColor', validator.isHexColor('ccc'));
console.log('ggg0000\n', 'isHexColor', validator.isHexColor('ggg0000'));


console.log('ccc12312asdafas\n', 'isAlphanumeric', validator.isAlphanumeric('ccc12312asdafas'));
fork icon15
star icon3
watch icon4

+ 3 other calls in file

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99


const validHexa = url => validator.isHexadecimal(url) || validator.isHexColor(url);


const validHexadecimal = url => validator.isHexadecimal(url);


const validHexaColor = url => validator.isHexColor(url);


const validUUID = url => validator.isUUID(url);


// unsafe validators
fork icon5
star icon63
watch icon0

80
81
82
83
84
85
86
87
88
89
  }
  return true;
},
isHexColor: function(rule, value) {
  if (rule) {
    return validator.isHexColor(value);
  }
  return true;
},
isLowercase: function(rule, value) {
fork icon0
star icon2
watch icon2

+ 5 other calls in file

44
45
46
47
48
49
50
51
52
53
54
55
56
}


// Validate hexadecimal color


exports.validateHexColor = (hexColor) => {
    return validator.isHexColor(hexColor);
}


// Validate hexadecimal number

fork icon0
star icon0
watch icon0