GithubHelp home page GithubHelp logo

doowb / npm-api-dependents Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 2.0 16 KB

npm-api plugin for streaming an npm module's dependents information

Home Page: https://github.com/doowb

License: MIT License

JavaScript 100.00%
npm npm-api api dependents download-stats repos modules nodejs javascript streams

npm-api-dependents's Introduction

npm-api-dependents NPM version NPM monthly downloads NPM total downloads Linux Build Status Windows Build Status

npm-api plugin for getting module dependents.

Install

Install with npm:

$ npm install --save npm-api-dependents

Install with yarn:

$ yarn add npm-api-dependents

Usage

var npm = require('npm-api')();
var dependents = require('npm-api-dependents');
npm.use(dependents());

var repo = npm.repo('micromatch');

// returns a readable stream
repo.dependents()
  .on('data', function(repo) {
    console.log(repo);
  });

API

Get the dependents for the current repo.

Params

  • options {Object}: Options to handle returned results
  • options.raw {Boolean}: Optional. Set to true to receive objects of the form { name: 'module' } instead of Repo objects.
  • returns {Stream}: Returns a readable stream (object mode).

Example

var repo = npm.repo('micromatch');

// returns a readable stream
repo.dependents()
  .on('data', function(repo) {
    console.log(repo);
  });

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Contributors

Commits Contributor
6 doowb
1 ralphtheninja

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Brian Woodward

License

Copyright © 2017, Brian Woodward. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on December 27, 2017.

npm-api-dependents's People

Contributors

doowb avatar ralphtheninja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

npm-api-dependents's Issues

No longer works?

Trying to run this example from the docs:

var npm = require('npm-api')();
var dependents = require('npm-api-dependents');
npm.use(dependents());

var repo = npm.repo('micromatch');

// returns a readable stream
repo.dependents()
  .on('data', function(repo) {
    console.log(repo);
  });

Gives me this:

TypeError: Class constructor NpmApi cannot be invoked without 'new'

Node 8.9.3 and 12.4.0.

Refactor `dependents` method

I'd like to refactor this library, which is mainly the main dependents method, so it's easier to use downstream as a streaming module instead of batching reads.

  • Remove generator syntax and use promises directly when necessary
  • use view.stream instead of view.query
  • options.mapFn won't be necessary. Since this is an npm-api plugin, values can be transformed directly into Repo objects using app.repo(name) then pushed onto the stream.
  • options.raw consider adding options.raw to push data directly through the stream without initializing new Repo instances.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.