npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

marvel-wrapper

v1.0.9

Published

Wrapper to work with the Marvel Web API

Downloads

23

Readme

Marvel Wrapper

Build Status Coverage Status License: MIT

A wrapper to work with the Marvel Web API.

Browser Support

This library relies on Fetch API. And this API is supported in the following browsers.

Chrome | Firefox | Opera | Safari | IE | --- | --- | --- | --- | --- | 39+ ✔ | 42+ ✔ | 29+ ✔ | 10.1+ ✔ | Nope ✘ |

Dependencies

This library depends on fetch to make requests to the Marvel Web API. For environments that don't support fetch, you'll need to provide a polyfill to browser or polyfill to Node.

Installation

$ npm install marvel-wrapper --save

How to use

ES6

// to import a specific method
import MarvelWrapper from 'marvel-wrapper';

const marvel = new MarvelWrapper({
  privateKey: 'YOUR_PRIVATEKEY_HERE',
  publicKey: 'YOUR_PUBLICKEY_HERE',
  limit: 'OPTIONAL_LIMIT'
});

// using  method
marvel.comic.getComics();

CommonJS

const MarvelWrapper = require('marvel-wrapper').default;

const marvel = new MarvelWrapper({
  privateKey: 'YOUR_PRIVATEKEY_HERE',
  publicKey: 'YOUR_PUBLICKEY_HERE',
  limit: 'OPTIONAL_LIMIT'
});

UMD in Browser

<!-- to import non-minified version -->
<script src="marvel-wrapper.js"></script>

<!-- to import minified version -->
<script src="marvel-wrapper.min.js"></script>

After that the library will be available to the Global as MarvelWrapper. Follow an example:


const marvel = new MarvelWrapper({
  privateKey: 'YOUR_PRIVATEKEY_HERE',
  publicKey: 'YOUR_PUBLICKEY_HERE',
  limit: 'OPTIONAL_LIMIT'
});

const comics = marvel.comic.getComics();

Methods

Follow the methods that the library provides.

COMICS

comic.getComics()

Fetches lists of comics. Test in Marvel Web Console.

--

Example

marvel.comic.getComics()
  .then(reponse => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

comic.getComic(id)

Fetch one comic by id. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.comic.getComic('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

comic.getCharacters(id)

Fetched list characters by id references comic. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.comic.getCharacters('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

comic.getEvents(id)

Fetched list events by id references comic. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.comic.getEvents('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

comic.getCreators(id)

Fetched list creators by id references comic. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.comic.getCreators('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

comic.getStories(id)

Fetched list stories by id references comic. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.comic.search('spider')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

comic.getStories(id)

Fetched list stories by id references comic. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.comic.getStories('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

comic.search(startname)

Fetched list comics by start name of search. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |-----------|---------|--------------------| |startname|string |'Any search letter' |

Example

marvel.comic.search('spider')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

CHARACTERS

character.getCharacters()

Fetches lists of characters. Test in Marvel Web Console.

--

Example

marvel.character.getCharacters()
  .then(reponse => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

character.getCharacter(id)

Fetch one character by id. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.character.getCharacter('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

character.getComics(id)

Fetched list comics by id references character. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.character.getComics('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

character.getEvents(id)

Fetched list events by id references character. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.character.getEvents('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

character.getSeries(id)

Fetched list creators by id references character. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.character.getSeries('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

character.getStories(id)

Fetched list stories by id references character. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.character.getStories('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

character.search(startname)

Fetched list characters by start name of search. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |-----------|---------|--------------------| |startname|string |'Any search letter' |

Example

marvel.character.search('spider')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

CREATORS

creator.getCreators()

Fetches lists of creators. Test in Marvel Web Console.

--

Example

marvel.creator.getCreators()
  .then(reponse => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

creator.getCreator(id)

Fetch one creator by id. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.creator.getCreator('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

creator.getComics(id)

Fetched list comics by id references creator. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.creator.getComics('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

creator.getEvents(id)

Fetched list events by id references creator. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.creator.getEvents('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

creator.getSeries(id)

Fetched list creators by id references creator. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.creator.getSeries('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

creator.getStories(id)

Fetched list stories by id references creator. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.creator.getStories('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

creator.search(startname)

Fetched list creators by start name of search. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |-----------|---------|--------------------| |startname|string |'Any search letter' |

Example

marvel.creator.search('spider')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

EVENTS

event.getEvents()

Fetches lists of Events. Test in Marvel Web Console.

--

Example

marvel.event.getEvents()
  .then(reponse => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

event.getEvent(id)

Fetch one event by id. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.event.getEvent('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

event.getCharacters(id)

Fetched list characters by id references event. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.event.getCharacters('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

event.getComics(id)

Fetched list comics by id references event. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.event.getComics('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

event.getCreators(id)

Fetched list creators by id references event. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.event.getCreators('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

event.getSeries(id)

Fetched list events by id references event. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.event.getSeries('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

event.getStories(id)

Fetched list stories by id references event. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.event.getStories('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

event.search(startname)

Fetched list events by start name of search. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |-----------|---------|--------------------| |startname|string |'Any search letter' |

Example

marvel.event.search('spider')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

SERIES

serie.getSeries()

Fetches lists of series. Test in Marvel Web Console.

--

Example

marvel.serie.getSeries()
  .then(reponse => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

serie.getSerie(id)

Fetch one serie by id. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.serie.getSerie('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

serie.getCharacters(id)

Fetched list characters by id references serie. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.serie.getCharacters('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

serie.getComics(id)

Fetched list comics by id references serie. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.serie.getComics('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

serie.getCreators(id)

Fetched list creators by id references serie. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.serie.getCreators('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

serie.getEvents(id)

Fetched list events by id references serie. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.serie.getEvents('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

serie.getStories(id)

Fetched list stories by id references serie. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.serie.getStories('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

serie.search(startname)

Fetched list series by start name of search. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |-----------|---------|--------------------| |startname|string |'Any search letter' |

Example

marvel.serie.search('spider')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

STORIES

storie.getStories()

Fetches lists of stories. Test in Marvel Web Console.

--

Example

marvel.storie.getStories()
  .then(reponse => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

storie.getStorie(id)

Fetch one storie by id. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.storie.getStorie('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

storie.getCharacters(id)

Fetched list characters by id references storie. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.storie.getCharacters('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

storie.getComics(id)

Fetched list comics by id references storie. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.storie.getComics('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

storie.getCreators(id)

Fetched list creators by id references storie. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.storie.getCreators('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

storie.getEvents(id)

Fetched list events by id references storie. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.storie.getEvents('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

storie.getSeries(id)

Fetched list series by id references storie. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |----------|---------|-------------------| |id |string | 'Any search id' |

Example

marvel.storie.getStories('37504')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item.name))
  })

storie.search(startname)

Fetched list stories by start name of search. Test in Marvel Web Console.

Arguments

| Argument | Type | Options | |-----------|---------|--------------------| |startname|string |'Any search letter' |

Example

marvel.storie.search('spider')
  .then(response => {
    // do what you want with the response
    response => response.data.results.map(item => console.log(item))
  })

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

| Jhones Gonçalves| |:---------------------:| | Jhones Gonçalves |

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details