Last active
August 29, 2015 14:09
-
-
Save RobinDev/2daf78dc72035a4a332f to your computer and use it in GitHub Desktop.
CasperJS : check if params are correctly set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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