From 4358a46ac47eda2c78e56d1f4e346fef34f35672 Mon Sep 17 00:00:00 2001 From: lilia Date: Fri, 20 Nov 2015 14:17:58 -0800 Subject: [PATCH] Remove unused file // FREEBIE --- Gruntfile.js | 1 - js/bimap.js | 61 ---------------------------------------------------- 2 files changed, 62 deletions(-) delete mode 100644 js/bimap.js diff --git a/Gruntfile.js b/Gruntfile.js index ad071b5ec71..39613197ada 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -87,7 +87,6 @@ module.exports = function(grunt) { 'Gruntfile.js', 'js/background.js', 'js/chromium.js', - 'js/bimap.js', 'js/conversation_panel.js', 'js/database.js', 'js/inbox_controller.js', diff --git a/js/bimap.js b/js/bimap.js deleted file mode 100644 index 8ae367e52dc..00000000000 --- a/js/bimap.js +++ /dev/null @@ -1,61 +0,0 @@ -/*global $, Whisper, Backbone, textsecure, extension*/ -/* - * vim: ts=4:sw=4:expandtab - */ -// A bidirectional hash that allows constant-time lookup for -// key -> value and value -> key -(function () { - 'use strict'; - - window.Whisper = window.Whisper || {}; - - function Bimap (map1, map2) { - if (typeof map1 !== 'string' || typeof map2 !== 'string') { - throw 'Expected two map name strings as arguments'; - } - - this.bijection = {}; - this.bijection[map1] = map2; - this.bijection[map2] = map1; - - // makes accessing the maps clearer - this[map1] = {}; - this[map2] = {}; - - this[map1 + 'From'] = function (key) { return this[map2][key]; }; - this[map2 + 'From'] = function (key) { return this[map1][key]; }; - } - - Bimap.prototype.add = function (obj) { - if (typeof obj !== 'object') { - throw 'Expected an object as an argument'; - } - - var keys = Object.keys(obj); - var map1 = keys[0]; - var map2 = keys[1]; - - if (this.bijection[map1] !== map2) { - throw 'Expected the argument\'s keys to correspond to the Bimap\'s two map names'; - } - - this[map1][obj[map1]] = obj[map2]; - this[map2][obj[map2]] = obj[map1]; - }; - - Bimap.prototype.remove = function remove (map, key) { - var bijection = this.bijection[map]; - var correspondingKey = this[map][key]; - - // delete from the bijection - delete this[bijection][correspondingKey]; - - // delete from the specified map - delete this[map][key]; - - return correspondingKey; - }; - - // export - Whisper.Bimap = Bimap; -})();