planet-earth
Version:
Library to find any location in the planet
53 lines (46 loc) • 773 B
JavaScript
/**
*
* @type {LocationFinder}
*/
exports.LocationFinder = class LocationFinder {
static validateFilterLength(filter) {
return Object.keys(filter).length !== 0;
}
/**
*
* @param {object} filter
*/
constructor(filter) {
this.filter = filter;
}
/**
*
* @param {function} callback
*/
then(callback) {
if (!LocationFinder.validateFilterLength(this.filter)) {
callback('Parameters not found', null);
}
if (this.filter) {
callback(null, []);
}
}
/**
*
* @param {function} callback
*/
success(callback) {
if (this.filter) {
callback([]);
}
}
/**
*
* @param {function} callback
*/
error(callback) {
if (this.filter) {
callback('error');
}
}
};