Skip to content

Commit

Permalink
Merge pull request #2 from brutalchrist/add_foreach
Browse files Browse the repository at this point in the history
Add foreach function
  • Loading branch information
brutalchrist committed Aug 3, 2018
2 parents 21ccbf3 + 95e5921 commit cbaa0d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-hashtable",
"version": "0.0.5",
"version": "0.0.6",
"description": "An HashTable for Angular",
"main": "./dist/angular-hashtable/bundles/angular-hashtable.umd.js",
"typings": "./dist/angular-hashtable.d.ts",
Expand Down
14 changes: 14 additions & 0 deletions src/lib/angular-hashtable.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,18 @@ export class HashTable<T, L> {
public size(): number {
return Object.keys(this.table).length;
}

/***************************************************/
// ForEach Function
// forEach(callback: function(key,value) )
// @callback: A Callback function use to iterate the Object
//
// Iterate all objects Hashtable
// A used like arguments in the callback function
/***************************************************/
public forEach(callback) {
for (let key in this.table) {
callback(key.substring(2), this.table[key]);
}
}
}

0 comments on commit cbaa0d5

Please sign in to comment.