packageDocumentation module import { BooruError , sites , SMap } from './Constants' ; import { deprecate } from 'util' ; import Booru , { BooruCredentials } from './boorus/Booru' ; import Derpibooru from './boorus/Derpibooru' ; import XmlBooru from './boorus/XmlBooru' ; import Post from './structures/Post' ; import SearchParameters from './structures/SearchParameters' ; import SearchResults from './structures/SearchResults' ; import Site from './structures/Site' ; import { resolveSite } from './Utils' ; const BooruTypes = { derpi : Derpibooru , xml : XmlBooru , } ; const booruCache = { } ; param booruSite param credentials return function booruFrom ( booruSite , credentials ? ) { return new ( booruSite . type !== undefined && BooruTypes [ booruSite . type ] ? BooruTypes [ booruSite . type ] : Booru ) ( booruSite , credentials ) ; } constructor param { String } site The  Site domain (or alias of it) to create a booru from
 *  param { * } credentials return { Booru } function booruForSite ( site , credentials = null ) { const rSite = resolveSite ( site ) ; if ( ! rSite ) throw new BooruError ( 'Site not supported' ) ; const booruSite = new Site ( sites [ rSite ] ) ; return booruFrom ( booruSite , credentials ) ; } export { booruForSite as forSite } ; export default booruForSite ; param { String } site param { String [ ] | String } tags param { SearchParameters } searchOptions return { Promise < SearchResults > } example export function search ( site , tags = [ ] , { limit = 1 , random = false , page = 0 , credentials } = { } ) { const rSite = resolveSite ( site ) ; if ( typeof limit === 'string' ) { limit = parseInt ( limit , 10 ) ; } if ( rSite === null ) { throw new BooruError ( 'Site not supported' ) ; } if ( ! Array . isArray ( tags ) && typeof tags !== 'string' ) { throw new BooruError ( '`tags` should be an array or string' ) ; } if ( typeof limit !== 'number' || Number . isNaN ( limit ) ) { throw new BooruError ( '`limit` should be an int' ) ; } const booruSite = new Site ( sites [ rSite ] ) ; if ( ! booruCache [ rSite ] ) { booruCache [ rSite ] = booruFrom ( booruSite ) ; } return booruCache [ rSite ] . search ( tags , { limit , random , page , credentials } ) ; } const deprecatedCommonfy = deprecate ( ( ) => { } , 'Common is now deprecated, just access the properties directly' ) ; /**
 * Deprecated, now a noop
 * <p>This will be removed *soon* please stop using it</p>
 * <p>Just access <code>&lt; Post &gt;.prop</code>, no need to commonfy anymore
 *
 *  deprecated Just use <code>&lt; Post &gt;.prop</code> instead
 *  param { Post [ ] } images Array of  Post objects
 *  return { Promise < Post [ ] > } Array of  Post objects
  export function commonfy ( images ) { deprecatedCommonfy ( ) ; return Promise . resolve ( images ) ; } export { Booru as BooruClass } from './boorus/Booru' ; export { sites } from './Constants' ; export { resolveSite } from './Utils' ; export { BooruError } from './Constants' ;