UNPKG

@taurgis/sfccdx

Version:

SFCCDX is a command line interface (CLI) for Salesforce Commerce Cloud. It can be used to easily manage (meta)data (import/export) in relation to your project.

29 lines (22 loc) 728 B
const validate = require('validate.js'); const validator = require('validator'); module.exports = (hostname) => { const result = { validationResult: true, }; if (validate.isEmpty(hostname)) { result.validationErrors = ['-- hostname should not be null or undefined']; result.validationResult = false; return result; } if (validator.isURL(hostname, { require_protocol: true, require_valid_protocol: true, protocols: ['http', 'https'], })) { result.validationErrors = ['-- hostnames should not begin with protocol declarations (ex. https://)']; result.validationResult = false; return result; } return result; };