Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. function naiveHashing()
  2. {
  3.     var keys = [];
  4.     var values = [];
  5.     this.save = function (key, value) {
  6.         var existingIndex = ko.utils.arrayIndexOf(keys, key);
  7.         if (existingIndex >= 0) values[existingIndex] = value;
  8.         else {
  9.             keys.push(key);
  10.             values.push(value);
  11.         }
  12.     };
  13.     this.get = function (key) {
  14.         var existingIndex = ko.utils.arrayIndexOf(keys, key);
  15.         return (existingIndex >= 0) ? values[existingIndex] : undefined;
  16.     };
  17. }