Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Oct 16, 2015
1 parent 9048efe commit 7ec8421
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .jshint
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"nonew": true,
"curly": true,
"forin": true,
"freeze": true,
"freeze": false,
"undef": true,
"unused": "vars"
}
6 changes: 3 additions & 3 deletions lib/models/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Room.prototype.addEvents = function(events, duplicateStrategy) {
this.currentState.setTypingEvent(events[i]);
}
else if (events[i].getType() === "m.receipt") {
addReceipt(this, events[i]);
this.addReceipt(events[i]);
}
else {
if (duplicateStrategy) {
Expand Down Expand Up @@ -284,15 +284,15 @@ Room.prototype.addReceipt = function(event) {
var self = this;
utils.keys(event.getContent()).forEach(function(eventId) {
utils.keys(event.getContent()[eventId]).forEach(function(receiptType) {
utils.keys(event.getContent()[eventId][receiptType]).forEach(function(userId) {
utils.keys(event.getContent()[eventId][receiptType]).forEach(
function(userId) {
var receipt = event.getContent()[eventId][receiptType][userId];
if (!self._receipts[receiptType]) {
self._receipts[receiptType] = {};
}
if (!self._receipts[receiptType][userId]) {
self._receipts[receiptType][userId] = {};
}
var oldEventId = self._receipts[receiptType][userId].eventId;
self._receipts[receiptType][userId] = {
eventId: eventId,
data: receipt
Expand Down
21 changes: 10 additions & 11 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ module.exports.runPolyfills = function() {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
if (!Array.prototype.filter) {
Array.prototype.filter = function(fun/*, thisArg*/) {
'use strict';

if (this === void 0 || this === null) {
throw new TypeError();
Expand Down Expand Up @@ -282,15 +281,15 @@ module.exports.runPolyfills = function() {

var T, A, k;

if (this == null) {
if (this === null || this === undefined) {
throw new TypeError(' this is null or not defined');
}

// 1. Let O be the result of calling ToObject passing the |this|
// 1. Let O be the result of calling ToObject passing the |this|
// value as the argument.
var O = Object(this);

// 2. Let lenValue be the result of calling the Get internal
// 2. Let lenValue be the result of calling the Get internal
// method of O with the argument "length".
// 3. Let len be ToUint32(lenValue).
var len = O.length >>> 0;
Expand All @@ -306,8 +305,8 @@ module.exports.runPolyfills = function() {
T = thisArg;
}

// 6. Let A be a new array created as if by the expression new Array(len)
// where Array is the standard built-in constructor with that name and
// 6. Let A be a new array created as if by the expression new Array(len)
// where Array is the standard built-in constructor with that name and
// len is the value of len.
A = new Array(len);

Expand All @@ -321,18 +320,18 @@ module.exports.runPolyfills = function() {

// a. Let Pk be ToString(k).
// This is implicit for LHS operands of the in operator
// b. Let kPresent be the result of calling the HasProperty internal
// b. Let kPresent be the result of calling the HasProperty internal
// method of O with argument Pk.
// This step can be combined with c
// c. If kPresent is true, then
if (k in O) {

// i. Let kValue be the result of calling the Get internal
// i. Let kValue be the result of calling the Get internal
// method of O with argument Pk.
kValue = O[k];

// ii. Let mappedValue be the result of calling the Call internal
// method of callback with T as the this value and argument
// ii. Let mappedValue be the result of calling the Call internal
// method of callback with T as the this value and argument
// list containing kValue, k, and O.
mappedValue = callback.call(T, kValue, k, O);

Expand Down Expand Up @@ -363,7 +362,7 @@ module.exports.runPolyfills = function() {
return A;
};
}
}
};

/**
* Inherit the prototype methods from one constructor into another. This is a
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/room.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,5 +623,5 @@ describe("Room", function() {

});

})
});
});

0 comments on commit 7ec8421

Please sign in to comment.