sesd
v1.0.2
Published
Search esdiscuss.org
Downloads
4
Readme
sesd
:mag::scroll: API to search esdiscuss.org topics
Made with ❤ at @outlandish
Install
npm install sesd
yarn add sesd
Import
// ES2015
import sesd from 'sesd'
// CommonJS
const sesd = require('sesd')
Usage
sesd(term[, opts]) : Promise
Find topics with term
in topic title or discussion.
- term {String} Search term (give it an empty string to scoop up everything)
- [opts.limit] {Number} Number of pages to search, starting at 1
- [opts.author] {String} Author search term
- [opts.deep] {Boolean} Search topic contents for results (default:
false
)
Returns a Promise that resolves with details of matched topics.
Examples:
// e.g. Get topics about "prototype" on first five pages
sesd('prototype', { limit: 5 }).then((results) => {
console.log(results) //=> [ { author, title, href } ]
})
// e.g. Get all topics by an author
sesd('', { author: 'Sam Gluck' }).then((results) => {
console.log(results)
//=> [{
// author: 'Sam Gluck',
// title: 'Why are ES6 class methods not automatically bound to the instance?',
// href: '/topic/why-are-es6-class-methods-not-automatically-bound-to-the-instance'
// }]
})
Contributing
All pull requests and issues welcome!
If you're not sure how, check out Kent C. Dodds' great video tutorials on egghead.io!