From 4c5c0235f6258858be278bf2800fcede570dc42f Mon Sep 17 00:00:00 2001 From: Angelo Calvo A Date: Mon, 6 Aug 2018 11:37:27 -0400 Subject: [PATCH 1/2] Add return statement to all methods with void return statement except forEach --- src/lib/angular-hashtable.class.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lib/angular-hashtable.class.ts b/src/lib/angular-hashtable.class.ts index a8e929b..837c76e 100644 --- a/src/lib/angular-hashtable.class.ts +++ b/src/lib/angular-hashtable.class.ts @@ -9,8 +9,9 @@ export class HashTable { this.table = {}; } - public put(key: T, value: L): void { + public put(key: T, value: L): HashTable { this.table['v_' + key] = value; + return this; } public get(key: T): L { @@ -34,15 +35,17 @@ export class HashTable { return false; } - public remove(key: T): void { + public remove(key: T): HashTable { delete this.table['v_' + key]; + return this; } - public putArray(key: T, value: L): void { + public putArray(key: T, value: L): HashTable { if (typeof this.table['a_' + key] === 'undefined') { this.table['a_' + key] = []; } this.table['a_' + key].push(value); + return this; } public getArray(key: T): L { @@ -52,10 +55,11 @@ export class HashTable { return this.table['a_' + key]; } - public removeArray(key: T, value: L): void { + public removeArray(key: T, value: L): HashTable { if (typeof this.table['a_' + key] !== 'undefined') { this.table['a_' + key].splice(this.table['a_' + key].indexOf(value), 1); } + return this; } public hasArray(key: T): boolean { @@ -89,7 +93,7 @@ export class HashTable { // Iterate all objects Hashtable // A used like arguments in the callback function /***************************************************/ - public forEach(callback) { + public forEach(callback): void { for (let key in this.table) { callback(key.substring(2), this.table[key]); } From 53f3ae46bb98dedd59f7778a530386ebeb495019 Mon Sep 17 00:00:00 2001 From: Angelo Calvo A Date: Mon, 6 Aug 2018 12:31:04 -0400 Subject: [PATCH 2/2] update npm version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5e23208..0533f1d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-hashtable", - "version": "0.0.6", + "version": "0.0.7", "description": "An HashTable for Angular", "main": "./dist/angular-hashtable/bundles/angular-hashtable.umd.js", "typings": "./dist/angular-hashtable.d.ts",