What is cordova / argscheck used for?

I am trying to understand what cordova / argscheck does. I could not find the documentation that describes what it is used for and how to use it.

I managed to find git repo , however there are no comments in the code. I also looked at a few plugins, and they seem to use it like this:

Device.prototype.getInfo = function(successCallback, errorCallback) { argscheck.checkArgs('fF', 'Device.getInfo', arguments); exec(successCallback, errorCallback, "Device", "getDeviceInfo", []); }; 

This code was taken from the Device plugin. Find here git repo here .

+6
source share
1 answer

I realized it looks like the function is used to check the parameters to make sure that they are one of the following:

 'A'=> 'Array' 'D'=> 'Date' 'N'=> 'Number' 'S'=> 'String' 'F'=> 'Function' 'O'=> 'Object' '*'=> 'Anything goes' 

This check is performed to ensure that java calls that are made using the exec function will not cause errors due to invalid parameter types.

+4
source

Source: https://habr.com/ru/post/983357/


All Articles