This package has been deprecated

    Author message:

    This package has been deprecated and is no longer maintained.

    mapbox-data-team

    1.4.11 • Public • Published

    data-team

    Quickly get a list of OSM usernames or OSM user IDs of the Mapbox Data Team using this module.

    You can also get mappings between usernames and user IDs

    Install

    Include npm install mapbox-data-team

    Sample schema of user object

    // sample user object
    {
        'username': 'saikabhi',
        'uid': '3029661',
        'fname': 'Abhishek',
        'lname': 'Saikia',
        'fullname': 'Abhishek Saikia',
        'other_accounts': [
            {'username': 'saikabhi_sfimport', 'uid': '4893098'},
            {'username': 'saikabhi_LA_imports', 'uid': '4221399'}
        ]
    }
     

    API

    Getting everything

    var dataTeam = require('mapbox-data-team');
     
    dataTeam.getEverything();  // [ userObject1, userObject2, userObject3, ... ]

    Searching

    Find one or many entries in the datateam.

    find(searchFilter, resultShape)

    Returns an array of objects matching the specified parameters.

    Parameter Type Description
    searchFilter object or function Optional. Specifies the filter for the result. Omit this parameter to return everything
    resultShape array Optional. Specifies the fields to return for the resulting object /objects. Omit this parameter to return all fields.

    Example:

    // returns an array of objects which return truthy for the input function
    dataTeam.find(u => u.other_accounts.length > 0) // [ {  'username': 'Aaron Lidman', 'uid': '53073', 'fname': 'Aaron', ... }, ... ]
     
    // similar to above example, except only username key is found in result
    dataTeam.find(u => u.other_accounts.length > 0, ['username']); // [{ 'username': 'Aaron Lidman'}, {'username': 'saikabhi'} ...]

    findOne(searchFilter, resultShape)

    Returns only one object matching the specified parameters.

    Parameter Type Description
    searchFilter object or function Optional. Specifies the filter for the result. Omit this parameter to return everything
    resultShape array Optional. Specifies the fields to return for the resulting object /objects. Omit this parameter to return all fields.

    Example:

    // returns a single object matching the `searchFilter` or `undefined` if no match.
    dataTeam.findOne({uid: '53073'}) // { 'username': 'Aaron Lidman', 'uid': '53073', 'fname': 'Aaron', ... }
     
    dataTeam.findOne({osm_user: '53073'}) // undefined
     
    // returns a single object with only username key
    dataTeam.findOne({uid: '53073'}, ['username']) // { 'username': 'Aaron Lidman'}
     

    More examples:

     
    var dataTeam = require('mapbox-data-team');
    dataTeam.find(searchFilter, resultShape);
     
    // do empty search to get everything
    dataTeam.find(); // [ userObject ]
     
    // do an empty search to get only an array of uids
    dataTeam.find(null, ["uid"]); // [ {uid: '3029661'}, {uid: '3057995'}, ...]
     
     
    // search by a particular a field**
    dTeam.find({ 'fName': 'Abhishek' });//  [ abhishekUserObject ]
     
    dTeam.find({ 'uid': '2226712' });//  [ userObject ]
     
    // shaping the result
    dTeam.findOne({ 'uid': '2226712' }, ['github', 'fname']); // { github: 'dannykath', fname: 'Danny Aiquipa Pacheco' }
     
    dTeam.find(null, ['github', 'uid'] ); // [ {github: 'Aaron Lidman', uid: '2985232'}, { github: 'aarthykc', uid: '2985232' }, ... ]
     
    // custom filter function
    dTeam.find( u => u.other_accounts.length > 0); // returns all objects which have u.other_accounts
     
    dTeam.findOne( u => u.other_accounts.length > 0); // returns one item that first returned truth for the input function
     

    Helper functions

    var allUsernames = dataTeam.getUsernames();
    var allUserIds = dataTeam.getUserIds();
    var allNames = dataTeam.getNames();
    
    //Specific information
    var poornimaUserName = dataTeam.getUsernamesFor('fname', 'Poornima'); //OR dataTeam.getUsernamesFor('fname', 'poornima'); OR dataTeam.getUsernamesFor('fname', 'poORnimA');
    
    var poornimaUserId = dataTeam.getUserIdsFor('fname', 'Poornima'); //OR dataTeam.getUserIdsFor('fname', 'poornima'); OR dataTeam.getUserIdsFor('fname', 'PoORniMa');
    
    

    See tests for sample use cases.

    Add yourself to the module

    • Get all your information from http://hdyc.neis-one.org/user/<your-osm-username>
    • Use the following template to create an object that contains details from the http://hdyc.neis-one.org/user/<your-osm-username>
    {
        'username': '<osm-username>',
        'uid': '<uid>',
        'fname': '<fname as on http://mapbox.com/team/>',
        'lname': '<lname as on http://mapbox.com/team/>',
        'fullname': '<fullname as on http://mapbox.com/team/>'
    }
    
    {
        'username': '<osm-username>',
        'uid': '<uid>',
        'fname': '<fname as on http://mapbox.com/team/>',
        'lname': '<lname as on http://mapbox.com/team/>',
        'fullname': '<fullname as on http://mapbox.com/team/>'
    },
    

    Keywords

    none

    Install

    npm i mapbox-data-team

    DownloadsWeekly Downloads

    58

    Version

    1.4.11

    License

    ISC

    Last publish

    Collaborators

    • aarthykc
    • ajithranka
    • amishas157
    • arunasank
    • fa7c0n
    • geohacker
    • ingalls
    • kepta
    • mapbox-admin
    • pratikyadav
    • rub21
    • rumc
    • srividyacb