mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-10-02 18:00:44 +01:00
Remove unused function
This is now used only internally in libaxolotl, which provides its own definition. // FREEBIE
This commit is contained in:
1 parent
6445581594
commit
52b039a900
3 files changed
-47
No files matched your search
@@ -36024,18 +36024,6 @@ function getStringable(thing) {
|
||||
thing.__proto__ == StaticByteBufferProto)));
|
||||
}
|
||||
|
||||
function isEqual(a, b, mayBeShort) {
|
||||
// TODO: Special-case arraybuffers, etc
|
||||
if (a === undefined || b === undefined)
|
||||
return false;
|
||||
a = getString(a);
|
||||
b = getString(b);
|
||||
var maxLength = mayBeShort ? Math.min(a.length, b.length) : Math.max(a.length, b.length);
|
||||
if (maxLength < 5)
|
||||
throw new Error("a/b compare too short");
|
||||
return a.substring(0, Math.min(maxLength, a.length)) == b.substring(0, Math.min(maxLength, b.length));
|
||||
}
|
||||
|
||||
function toArrayBuffer(thing) {
|
||||
//TODO: Optimize this for specific cases
|
||||
if (thing === undefined)
|
||||
|
||||
@@ -33,18 +33,6 @@ function getStringable(thing) {
|
||||
thing.__proto__ == StaticByteBufferProto)));
|
||||
}
|
||||
|
||||
function isEqual(a, b, mayBeShort) {
|
||||
// TODO: Special-case arraybuffers, etc
|
||||
if (a === undefined || b === undefined)
|
||||
return false;
|
||||
a = getString(a);
|
||||
b = getString(b);
|
||||
var maxLength = mayBeShort ? Math.min(a.length, b.length) : Math.max(a.length, b.length);
|
||||
if (maxLength < 5)
|
||||
throw new Error("a/b compare too short");
|
||||
return a.substring(0, Math.min(maxLength, a.length)) == b.substring(0, Math.min(maxLength, b.length));
|
||||
}
|
||||
|
||||
function toArrayBuffer(thing) {
|
||||
//TODO: Optimize this for specific cases
|
||||
if (thing === undefined)
|
||||
|
||||
@@ -32,27 +32,4 @@ describe("Helpers", function() {
|
||||
Error, /Tried to convert a non-stringable thing/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("isEqual", function(){
|
||||
it('returns false when a or b is undefined', function(){
|
||||
assert.isFalse(isEqual("defined value", undefined, false));
|
||||
assert.isFalse(isEqual(undefined, "defined value", false));
|
||||
});
|
||||
it('returns true when a and b are equal', function(){
|
||||
var a = "same value";
|
||||
var b = "same value";
|
||||
assert.isTrue(isEqual(a, b, false));
|
||||
});
|
||||
it('returns false when a and b are not equal', function(){
|
||||
var a = "same value";
|
||||
var b = "diferent value";
|
||||
assert.isFalse(isEqual(a, b, false));
|
||||
});
|
||||
it('throws an error when a/b compare is too short', function(){
|
||||
var a = "1234";
|
||||
var b = "1234";
|
||||
assert.throw(function() { isEqual(a, b, true) },
|
||||
Error, /a\/b compare too short/);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user