Skip to content

Instantly share code, notes, and snippets.

@RobinDev
Last active August 29, 2015 14:09
Show Gist options
  • Save RobinDev/2daf78dc72035a4a332f to your computer and use it in GitHub Desktop.
Save RobinDev/2daf78dc72035a4a332f to your computer and use it in GitHub Desktop.
CasperJS : check if params are correctly set
/**
* Check if the params exist
*
* @param array $params
*
* @return bool
*/
function checkParams($params) {
$params.forEach(function(param){
if(typeof casper.cli.options[param] == 'undefined') {
casper.echo('`' + param + '` not define (Use --' + param + ')');
casper.exit();
}
});
}
checkParams(['url', 'login', 'password']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment