Skip to content

Commit c4f7e4d

Browse files
Remove dead code (#2510)
1 parent 9a6dccb commit c4f7e4d

File tree

4 files changed

+0
-109
lines changed

4 files changed

+0
-109
lines changed

spec/unit/utils.spec.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,6 @@ describe("utils", function() {
109109
});
110110
});
111111

112-
describe("checkObjectHasNoAdditionalKeys", function() {
113-
it("should throw for extra keys", function() {
114-
expect(function() {
115-
utils.checkObjectHasNoAdditionalKeys({ foo: "bar", baz: 4 }, ["foo"]);
116-
}).toThrow();
117-
118-
expect(function() {
119-
utils.checkObjectHasNoAdditionalKeys({ foo: "bar" }, ["foo"]);
120-
}).not.toThrow();
121-
});
122-
});
123-
124112
describe("deepCompare", function() {
125113
const assert = {
126114
isTrue: function(x: any) {

src/crypto/api.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ export interface ISecretStorageKeyInfo {
109109
passphrase: IPassphraseInfo;
110110
}
111111

112-
export interface ISecretStorageKey {
113-
keyId: string;
114-
keyInfo: ISecretStorageKeyInfo;
115-
}
116-
117112
export interface IPassphraseInfo {
118113
algorithm: "m.pbkdf2";
119114
iterations: number;

src/crypto/verification/Error.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@ export const newUserCancelledError = errorFactory("m.user", "Cancelled by user")
4646
*/
4747
export const newTimeoutError = errorFactory("m.timeout", "Timed out");
4848

49-
/**
50-
* The transaction is unknown.
51-
*/
52-
export const newUnknownTransactionError = errorFactory(
53-
"m.unknown_transaction", "Unknown transaction",
54-
);
55-
5649
/**
5750
* An unknown method was selected.
5851
*/
@@ -72,11 +65,6 @@ export const newKeyMismatchError = errorFactory(
7265
"m.key_mismatch", "Key mismatch",
7366
);
7467

75-
/**
76-
* The user does not match.
77-
*/
78-
export const newUserMismatchError = errorFactory("m.user_error", "User mismatch");
79-
8068
/**
8169
* An invalid message was sent.
8270
*/

src/utils.ts

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -144,23 +144,6 @@ export function checkObjectHasKeys(obj: object, keys: string[]) {
144144
}
145145
}
146146

147-
/**
148-
* Checks that the given object has no extra keys other than the specified ones.
149-
* @param {Object} obj The object to check.
150-
* @param {string[]} allowedKeys The list of allowed key names.
151-
* @throws If there are extra keys.
152-
*/
153-
export function checkObjectHasNoAdditionalKeys(obj: object, allowedKeys: string[]): void {
154-
for (const key in obj) {
155-
if (!obj.hasOwnProperty(key)) {
156-
continue;
157-
}
158-
if (allowedKeys.indexOf(key) === -1) {
159-
throw new Error("Unknown key: " + key);
160-
}
161-
}
162-
}
163-
164147
/**
165148
* Deep copy the given object. The object MUST NOT have circular references and
166149
* MUST NOT have functions.
@@ -283,69 +266,6 @@ export function deepSortedObjectEntries(obj: any): [string, any][] {
283266
return pairs;
284267
}
285268

286-
/**
287-
* Inherit the prototype methods from one constructor into another. This is a
288-
* port of the Node.js implementation with an Object.create polyfill.
289-
*
290-
* @param {function} ctor Constructor function which needs to inherit the
291-
* prototype.
292-
* @param {function} superCtor Constructor function to inherit prototype from.
293-
*/
294-
export function inherits(ctor: Function, superCtor: Function) {
295-
// Add util.inherits from Node.js
296-
// Source:
297-
// https://github.com/joyent/node/blob/master/lib/util.js
298-
// Copyright Joyent, Inc. and other Node contributors.
299-
//
300-
// Permission is hereby granted, free of charge, to any person obtaining a
301-
// copy of this software and associated documentation files (the
302-
// "Software"), to deal in the Software without restriction, including
303-
// without limitation the rights to use, copy, modify, merge, publish,
304-
// distribute, sublicense, and/or sell copies of the Software, and to permit
305-
// persons to whom the Software is furnished to do so, subject to the
306-
// following conditions:
307-
//
308-
// The above copyright notice and this permission notice shall be included
309-
// in all copies or substantial portions of the Software.
310-
//
311-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
312-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
313-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
314-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
315-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
316-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
317-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
318-
(ctor as any).super_ = superCtor;
319-
ctor.prototype = Object.create(superCtor.prototype, {
320-
constructor: {
321-
value: ctor,
322-
enumerable: false,
323-
writable: true,
324-
configurable: true,
325-
},
326-
});
327-
}
328-
329-
/**
330-
* Polyfills inheritance for prototypes by allowing different kinds of
331-
* super types. Typically prototypes would use `SuperType.call(this, params)`
332-
* though this doesn't always work in some environments - this function
333-
* falls back to using `Object.assign()` to clone a constructed copy
334-
* of the super type onto `thisArg`.
335-
* @param {any} thisArg The child instance. Modified in place.
336-
* @param {any} SuperType The type to act as a super instance
337-
* @param {any} params Arguments to supply to the super type's constructor
338-
*/
339-
export function polyfillSuper(thisArg: any, SuperType: any, ...params: any[]) {
340-
try {
341-
SuperType.call(thisArg, ...params);
342-
} catch (e) {
343-
// fall back to Object.assign to just clone the thing
344-
const fakeSuper = new SuperType(...params);
345-
Object.assign(thisArg, fakeSuper);
346-
}
347-
}
348-
349269
/**
350270
* Returns whether the given value is a finite number without type-coercion
351271
*

0 commit comments

Comments
 (0)