Requires

Provides

FastArray.js

Array with fast lookup (based on object)

License:
MIT-style license.
  1. 19
  2. 20
  3. 21
  4. 22
  5. 23
  6. 24
  7. 25
  8. 26
  9. 27
  10. 28
  11. 29
  12. 30
  13. 31
  14. 32
  15. 33
  16. 34
  17. 35
  18. 36
  19. 37
  20. 38
  21. 39
  22. 40
  23. 41
  24. 42
  25. 43
  26. 44
  27. 45
  28. 46
  29. 47
  30. 48
  31. 49
  32. 50
  33. 51
  34. 52
  35. 53
  36. 54
  37. 55
  38. 56
  39. 57
  40. 58
  41. 59
  42. 60
  43. 61
  44. 62
  45. 63
FastArray = function() { this.push.apply(this, arguments); } FastArray.from = function(ary) { var array = new FastArray; FastArray.prototype.push.apply(array, ary) return array; } FastArray.prototype = { push: function() { Array.each(arguments, function(argument) { this[argument] = true; }, this); }, contains: function(argument) { return this[argument]; }, concat: function(array) { this.push.apply(this, array); return this; }, each: function(callback, bound) { for (var key in this) { if (this.hasOwnProperty(key)) callback.call(bound || this, key, this[key]); } }, include: function(value) { this[value] = true; }, erase: function(value) { delete this[value]; }, join: function(delimeter) { var bits = []; for (var key in this) if (this.hasOwnProperty(key)) bits.push(key); return bits.join(delimeter) } };