mvrilo / urban

Command line tool and API for the Urban Dictionary
https://mvrilo.github.io/urban/
MIT License
134 stars 20 forks source link

How to get an array of search results #15

Open Ravenwulf opened 4 years ago

Ravenwulf commented 4 years ago

The npm description does not explain too much about how to use this package so Im going to ask here.

If I wanted to get an array of search results for a search term, how would i go about doing that?

SatvikR commented 4 years ago

Here's how I would do it:


const urban = require("urban")

urban("some_word").res((json) => {
    console.log("List response:");
    for (const i in json) {
        console.log(`Result ${i}:`);
        console.log(json[i]);
    }
});