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

@@ -7,15 +7,15 @@ import { HOMEBRIDGE_VERSION } from './homebridge';
// This class represents a HomeBridge Provider that may or may not be installed.
export class Provider {
constructor(name:string) {
constructor(name) {
this.name = name;
}
get path():string {
get path() {
return path.join(User.providersPath, this.name);
}
load(options:object = {}):object {
load(options = {}) {
// does this provider exist at all?
if (!fs.existsSync(this.path)) {
@@ -23,8 +23,8 @@ export class Provider {
}
// check for a package.json
let pjsonPath:string = path.join(this.path, "package.json");
let pjson:object = null;
let pjsonPath = path.join(this.path, "package.json");
let pjson = null;
if (!fs.existsSync(pjsonPath)) {
throw new Error(`Provider ${this.name} does not contain a package.json.`);
@@ -43,7 +43,7 @@ export class Provider {
throw new Error(`Provider ${this.name} does not contain a valid HomeBridge version requirement.`);
}
let versionRequired:string = pjson.engines.homebridge;
let versionRequired = pjson.engines.homebridge;
// make sure the version is satisfied by the currently running version of HomeBridge
if (!semver.satisfies(HOMEBRIDGE_VERSION, versionRequired)) {
@@ -51,21 +51,21 @@ export class Provider {
}
// figure out the main module - index.js unless otherwise specified
let main:string = pjson.main || "./index.js";
let main = pjson.main || "./index.js";
let mainPath:string = path.join(this.path, main);
let mainPath = path.join(this.path, main);
// try to require() it
let loadedProvider:object = require(mainPath);
let loadedProvider = require(mainPath);
// pull out the configuration data, if any
let providerConfig = loadedProvider.config;
// verify that all required values are present
if (providerConfig && !options.skipConfigCheck) {
for (let key:string in providerConfig) {
for (let key in providerConfig) {
let configParams:object = providerConfig[key];
let configParams = providerConfig[key];
if (configParams.required && !User.config.get(`${this.name}-${key}`)) {
throw new Error(`Provider ${this.name} requires the config value ${key} to be set.`);
@@ -77,15 +77,15 @@ export class Provider {
}
// Gets all providers installed on the local system
static installed():Array<Provider> {
static installed() {
let providers:Array<Provider> = [];
let names:Array<string> = fs.readdirSync(User.providersPath);
let providers = [];
let names = fs.readdirSync(User.providersPath);
for (let name:string of names) {
for (let name of names) {
// reconstruct full path
let fullPath:string = path.join(User.providersPath, name);
let fullPath = path.join(User.providersPath, name);
// we only care about directories
if (!fs.statSync(fullPath).isDirectory()) continue;