Socket
Socket
Sign inDemoInstall

rickmortyapi

Package Overview
Dependencies
5
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.2.0

12

package.json
{
"name": "rickmortyapi",
"version": "0.1.1",
"version": "0.2.0",
"description": "A Rick and Morty API Node wrapper",

@@ -11,3 +11,3 @@ "main": "src/index.js",

"dev": "nodemon src",
"test": "nyc ava --verbose",
"test": "nyc ava --verbose && nyc report --reporter=text-lcov | coveralls",
"test:watch": "ava --watch --verbose"

@@ -21,9 +21,9 @@ },

"devDependencies": {
"ava": "^1.0.0-beta.3",
"ava": "1.0.0-beta.4",
"coveralls": "^3.0.0",
"eslint": "^4.19.1",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-prettier": "^2.6.0",
"nodemon": "^1.17.2",
"nyc": "^11.6.0",
"prettier": "^1.11.1"
"nodemon": "^1.17.3",
"nyc": "^11.7.1"
},

@@ -30,0 +30,0 @@ "repository": {

@@ -6,3 +6,3 @@ [![Build Status](https://travis-ci.org/afuh/rick-and-morty-api-node.svg?branch=master)](https://travis-ci.org/afuh/rick-and-morty-api-node)

# The Rick and Morty API Node client
# The Rick and Morty API JavaScript client

@@ -50,3 +50,9 @@ > Hey, did you ever want to hold a terry fold?,

const episodeOne = await getEpisode(1)
// You can also use an array of IDs.
const theSmiths = await getCharacter([ 2, 3, 4, 5 ])
const [ earth, citadel ] = await getLocation([ 1, 3 ])
const s01 = await getEpisode(Array.from({ length: 11 }, (v, i) => i + 1))
```
### Filter

@@ -53,0 +59,0 @@ Pass an object with the queries.

@@ -10,3 +10,3 @@ const axios = require('axios')

const validate = qry => {
if (typeof qry === 'number' && Number.isInteger(qry)) {
if (typeof qry === 'number' && Number.isInteger(qry) || Array.isArray(qry)) {
return `/${qry}`

@@ -21,3 +21,3 @@ }

throw new Error(`As argument use an object, integer or nothing`)
throw new Error(`As argument use an object, an array, an integer or leave it blank`)
}

@@ -24,0 +24,0 @@

@@ -42,2 +42,11 @@ const test = require('ava')

test(`${name}([1,2,3]) | Check get by array`, async t => {
const arr = [1,2,3]
const res = await method(arr)
t.plan(arr.length + 1)
t.is(typeof res === 'object' && Array.isArray(res), true)
res.forEach(r => t.is(arr.includes(r.id), true))
})
test(`${name}(6000) | Check 404`, async t => {

@@ -50,3 +59,3 @@ const res = await method(6000)

const error = await t.throws(getCharacter('wubba lubba dub dub'))
t.is(error.message, 'As argument use an object, integer or nothing')
t.is(error.message, `As argument use an object, an array, an integer or leave it blank`)
})

@@ -53,0 +62,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc