aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/helpers/custom-validators/misc.js
blob: 13904ea1b1faa5d1c1998be0e539942bda5704cf (plain) (tree)
1
2
3
4
5
6
7
8

            

                                                        

                        

                      









                                              





                                    


                                                                              
'use strict'

const validator = require('express-validator').validator

const miscValidators = {
  exists: exists,
  isArray: isArray,
  isEachUrl: isEachUrl
}

function exists (value) {
  return value !== undefined && value !== null
}

function isArray (value) {
  return Array.isArray(value)
}

function isEachUrl (urls) {
  return urls.every(function (url) {
    return validator.isURL(url)
  })
}

// ---------------------------------------------------------------------------

module.exports = miscValidators