@di-zed/yandex-smart-home
Version:
The Yandex Smart Home skills for the different device types.
61 lines (60 loc) • 1.05 kB
JavaScript
;
/**
* @author DiZed Team
* @copyright Copyright (c) DiZed Team (https://github.com/di-zed/)
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Registry Interface.
*/
class Registry {
constructor() {
/**
* The cached data.
*/
this.data = {};
}
/**
* Set the value.
*
* @param key
* @param value
* @returns boolean
*/
set(key, value) {
this.data[key] = value;
return true;
}
/**
* Get the value.
*
* @param key
* @returns any
*/
get(key) {
return this.data[key];
}
/**
* Delete the value.
*
* @param key
* @returns boolean
*/
delete(key) {
if (this.get(key)) {
delete this.data[key];
return true;
}
return false;
}
/**
* Delete all values.
*
* @returns boolean
*/
deleteAll() {
this.data = {};
return true;
}
}
exports.default = Registry;