vk-api-util
v1.1.1
Published
Utility methods for working with VK API
Downloads
4
Maintainers
Readme
vk-api-util
Utility methods for working with VK API
Install
$ npm install --save vk-api-util
Usage
var vkUtil = require('vk-api-util');
vkUtil.bitMask(['friends', 'photos']);
//=> 6
API
vkUtil.isMethod(method) → boolean
Returns true if given metod is mentioned in VK API docs.
method
Required
Type: string
vkUtil.isOpenMethod(method) → boolean
Returns true if given method doesn't require authentication.
method
Required
Type: string
vkUtil.bitMask(scope) → number
Returns bit mask for given scope.
scope
Required
Type: string
, array
or number
Pass a string of scopes divided by comma (,
) or array of scopes. If number is passed it assumed to be a bit mask itself and returned without changes.
vkUtil.checkScope(area, scope) → boolean
Returns true if given area is visible within given scope.
vkApiUtil.checkScope(['friends', 'video'], 4456466);
//=> true
area
Required
Type: string
, array
or number
scope
Required
Type: string
, array
or number
area
and scope
arguments are same as scope
in aforementioned vkUtil.bitMask()
method.
vkUtil.isMethodInScope(method, [scope]) → boolean
Returns true if given method is reachable within given scope.
method
Required
Type: string
scope
Type: string
, array
or number
Default: 0
Related
- vk-api-all-methods — List of all VK API methods
- vk-api-open-methods — List of VK API methods that don't require authentication
- vk-api-scoped-methods — Hash of VK API methods that require correct scope and scopes they require
- vk-api-scopes — Hash of VK API access permission codes
License
MIT © Dmitriy Sobolev