mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-25 14:57:31 +00:00
eec5c6fd64
Search commands start withs slash and includes: action, rest, ask
23 lines
607 B
JavaScript
23 lines
607 B
JavaScript
const searchClientsData = require( './searchClients/searchClients.json' );
|
|
|
|
function searchClient( config ) {
|
|
return {
|
|
active: null,
|
|
getData: function ( key, value ) {
|
|
const data = Object.values( searchClientsData ).find( ( item ) => item[ key ] === value );
|
|
return data;
|
|
},
|
|
setActive: function ( id ) {
|
|
const data = this.getData( 'id', id );
|
|
if ( data && data !== this.active ) {
|
|
const client = require( `./searchClients/${data.id}.js` );
|
|
this.active = data;
|
|
this.active.client = client( config );
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
/** @module searchClient */
|
|
module.exports = searchClient;
|