Skip to content

NotPhantomX/jikan4.js

 
 

Repository files navigation

Jikan4.js

A Node.js wrapper for Jikan API v4. Supports data caching and rate-limit handling.

Installation

Important:

  • The minimum Node.js version requirement for Jikan4.js is v12.0.0
$ npm i jikan4.js

Usage

This is how to import the module. It depends on the type of your project.

ESModule import

import Jikan from 'jikan4.js'

CommonJS require

const Jikan = require('jikan4.js')

This is how to get a resource. It returns undefined if the requested resource does not exist.

Example

const client = new Jikan.Client()
async function printAnime (id) {
  const anime = await client.anime.get(id)

  console.log(anime ? `${anime.title} (#${anime.id})` : `Anime with ID ${id} does not exist.`)
}

printAnime(4)
printAnime(5)

Search for anime.

const client = new Jikan.Client()
async function printSearch (searchString) {
  const result = (await client.anime.search(searchString)).map((anime) => {
    return {
      title: anime.title.default,
      year: anime.year
    }
  })

  console.table(result)
}

printSearch('naruto')

Links

About

A Jikan API wrapper for Node.js

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.9%
  • JavaScript 0.1%