How to use node-w3capi - 2 common examples

To help you get started, we’ve selected a few node-w3capi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github w3c / validate-repos / list-unconnected-contributors.js View on Github external
/* eslint-env node */

const config = require("./config.json");
const github = require("./lib/github.js");
const w3c = require('node-w3capi');

// based on a downloaded a local copy from https://labs.w3.org/hatchery/repo-manager/api/users when logged in there, filtered to leave only list of ghID
const ashnazgusers = require('./ashnazg-users.json');

w3c.apiKey = config.w3capikey;

if (!process.argv[2] || process.argv[2].indexOf('/') === -1) {
  console.error("Required: name of repo to check, e.g. w3c/webrtc-pc");
  process.exit(2);
}

const [owner, repo] = process.argv[2].split('/');

github.listRepoContributors(owner, repo).then(contributors => {
  Promise.all(contributors.map(contributor => {
    return new Promise(function(res, rej) {
      w3c.user({type: 'github', id: contributor.id}).fetch(function(err, /* w3cuser */) {
        if (err) {
          if (err.status === 404) {
            // is the user known in ahsnazg local db?
            if (ashnazgusers.indexOf(contributor.id) !== -1) {
github w3c / validate-repos / list-unconnected-contributors.js View on Github external
return new Promise(function(res, rej) {
      w3c.user({type: 'github', id: contributor.id}).fetch(function(err, /* w3cuser */) {
        if (err) {
          if (err.status === 404) {
            // is the user known in ahsnazg local db?
            if (ashnazgusers.indexOf(contributor.id) !== -1) {
              return res(null);
            } else {
              return res({login: contributor.login, contributions: contributor.contributions});
            }
          } else {
            return rej(err);
          }
        }
        return res(null);
      });
    });
  })).then(results => {

node-w3capi

A JavaScript client for the W3C API

MIT
Latest version published 1 month ago

Package Health Score

68 / 100
Full package analysis

Popular node-w3capi functions