Have ideas to improve npm?Join in the discussion! »

    vk-api-util

    1.1.1 • Public • Published

    vk-api-util Build Status

    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

    License

    MIT © Dmitriy Sobolev

    Install

    npm i vk-api-util

    DownloadsWeekly Downloads

    3

    Version

    1.1.1

    License

    MIT

    Last publish

    Collaborators

    • avatar