Remove non-standard "type annotations"

Since we're not actually using Flow.
This commit is contained in:
Nick Farina
2015-07-17 08:57:56 -07:00
parent 94ad9eddcb
commit bf5fc50fa6
8 changed files with 44 additions and 44 deletions

View File

@@ -2,18 +2,18 @@ import fs from 'fs';
export class Config {
constructor(path:string, data:object = {}) {
constructor(path, data = {}) {
this.path = path;
this.data = data;
}
get(key:string) {
get(key) {
this.validateKey(key);
let [providerName, keyName] = key.split(".");
return this.data[providerName] && this.data[providerName][keyName];
}
set(key:string, value:object) {
set(key, value) {
this.validateKey(key);
let [providerName, keyName] = key.split(".");
this.data[providerName] = this.data[providerName] || {};
@@ -21,12 +21,12 @@ export class Config {
this.save();
}
validateKey(key:string) {
validateKey(key) {
if (key.split(".").length != 2)
throw new Error(`The config key '${key}' is invalid. Configuration keys must be in the form [my-provider].[myKey]`);
}
static load(configPath: string): Config {
static load(configPath) {
// load up the previous config if found
if (fs.existsSync(configPath))
return new Config(configPath, JSON.parse(fs.readFileSync(configPath)));