How to use the isBase64 function from validator
Find comprehensive JavaScript validator.isBase64 code examples handpicked from public code repositorys.
15 16 17 18 19 20 21 22 23 24
const imagedata = req.body.image const country_code = (req.body.country_code) ? validator.escape(req.body.country_code) : 'eu' const pattern_code = (req.body.pattern_code) ? '-p ' + validator.escape(req.body.pattern_code) : '' /* Validate input */ if (!imagedata || validator.isBase64(imagedata)) { return res.status(500).json({ error: 'No image sent', version: version })
6
4
2
29 30 31 32 33 34 35 36 37 38
this.isBase32 = (subject) => { return StringValidator.isBase32(subject) ? null : subject + ' is not base32'; } this.isBase64 = (subject) => { return StringValidator.isBase64(subject) ? null : subject + ' is not base64'; } this.isBefore = (date) => (subject) => { return StringValidator.isBefore(subject, date) ? null : subject + ' is not before' + date;
1
4
2
+ 3 other calls in file
19 20 21 22 23 24 25 26 27 28
console.log('6b3a2b30-f2ee-11e4-b939-0800200c9a66\n', 'isUUID', validator.isUUID('6b3a2b30-f2ee-11e4-b939-0800200c9a66')); console.log('6b3a2b30-f2ee-11e4-b939\n', 'isUUID', validator.isUUID('6b3a2b30-f2ee-11e4-b939')); 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'));
15
3
4
+ 3 other calls in file
GitHub: AgID/spid-oidc-check-op
95 96 97 98 99 100 101 102 103 104
if (len < 5 || len > 5) { return false; } } return dotSplit.reduce((acc, currElem) => acc && validator.isBase64(currElem, { urlSafe: true }), true); } catch(error) { console.log(error.message); }
2
3
0
+ 4 other calls in file
68 69 70 71 72 73 74 75 76 77
} return true; }, isBase64: function(rule, value) { if (rule) { return validator.isBase64(value); } return true; }, isHexadecimal: function(rule, value) {
0
2
2
+ 5 other calls in file
GitHub: iamstarkov/renovate
78 79 80 81 82 83 84 85 86 87
'Detected localhost registry - rejecting npmrc file' ); npmrc = existingNpmrc; return; } if (key !== '_auth' && key.endsWith('_auth') && isBase64(val)) { logger.debug('Massaging _auth to _authToken'); npmrc[key + 'Token'] = val; npmrc.massagedAuth = true; delete npmrc[key];
0
2
8
+ 3 other calls in file
GitHub: steedos/steedos-platform
28 29 30 31 32 33 34 35 36 37
console.error('Error: Please run command, steedos source:config'); }else{ console.error(body); } }else{ const isBase64 = validator.isBase64(body); // console.log("isBase64",isBase64); if(!isBase64){ console.error('Error: metadata-api not detected, enable metadata-api first'); }else{
312
0
41
validator.escape is the most popular function in validator (548 examples)