From: Arkadiusz Pietraszek Date: Tue, 14 Jul 2020 15:25:28 +0000 (+0200) Subject: [utils] Remove of unused functions ValidateMethod and ValidateArguments X-Git-Tag: submit/tizen/20200715.055037~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F06%2F238506%2F1;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [utils] Remove of unused functions ValidateMethod and ValidateArguments ValidateMethod and ValidateArguments functions located in utils_api.js are not used anywhere in Web API code. [Verification] Grep search does not find any occurences of those functions. Change-Id: Ifad5f7005e82fb31e1c44c73dbed3a363d25d4ad Signed-off-by: Arkadiusz Pietraszek --- diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js index 21241f12..5fb53765 100644 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js @@ -17,17 +17,6 @@ if (typeof window != 'undefined') { _global = global; } -/** - * @deprecated Used only by validateArguments() - */ -var signature_to_type = { - n: 'number', - f: 'function', - b: 'boolean', - s: 'string', - o: 'object' -}; - /** * @brief CommonListenerManager constructor function. * @param nativeMgr NativeManager handle. @@ -263,52 +252,6 @@ Utils.prototype.repackFilter = function(filter) { return null; }; -/** - * @deprecated You should use xwalk.utils.validator.validateMethod() instead. - */ -Utils.prototype.validateArguments = function(signature, args) { - var full_args = Array.prototype.slice.call(args); - - // After '?' everything is optional. - var mandatory_len = - signature.indexOf('?') === -1 ? signature.length : signature.indexOf('?'); - - if (full_args.length < mandatory_len) return false; - - // Mandatory arguments. - for (var i = 0; i < mandatory_len; i++) { - if ( - typeof full_args[i] !== signature_to_type[signature[i]] || - full_args[i] === null - ) - return false; - } - - // Optional args may be null. - for (var i = mandatory_len; i < full_args.length && i < signature.length - 1; i++) { - if ( - full_args[i] !== null && - typeof full_args[i] !== signature_to_type[signature[i + 1]] - ) - return false; - } - - return true; -}; - -Utils.prototype.validateObject = function(object, signature, attributes) { - for (var i = 0; i < signature.length; i++) { - if ( - object.hasOwnProperty(attributes[i]) && - typeof object[attributes[i]] !== signature_to_type[signature[i]] - ) { - return false; - } - } - - return true; -}; - Utils.prototype.getPkgApiVersion = function() { var result = native_.callSync('UtilsGetPkgApiVersion'); if (native_.isFailure(result)) { @@ -1083,13 +1026,6 @@ Validator.prototype.validateArgs = function(a, d) { return args; }; -/** - * @deprecated Use validateArgs() instead. - */ -Validator.prototype.validateMethod = function(a, d) { - return this.validateArgs(a, d); -}; - /** * Use this helper to ensure that constructor is invoked by "new" operator. *