Skip to content

Instantly share code, notes, and snippets.

@mpautasso
Created June 29, 2012 05:09
Show Gist options
  • Save mpautasso/3015898 to your computer and use it in GitHub Desktop.
Save mpautasso/3015898 to your computer and use it in GitHub Desktop.
Review
Application.Hashtable
jQuery ->
class HashTable
constructor: (@obj) ->
@length = 0
@items = {}
for p of @obj
if @obj.hasOwnProperty(p)
@items[p] = @obj[p]
@length++
getItem: (key) ->
if @hasItem(key)
value = @items[key]
else
value = 'Field undefined'
return value
hasItem: (key) ->
return @items.hasOwnProperty key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment