Skip to content

Commit

Permalink
Merge pull request allegro#4 from xor-xor/undefined
Browse files Browse the repository at this point in the history
"typeof(x) === 'undefined'" instead of "x === void 0"
  • Loading branch information
xliiv committed Sep 5, 2014
2 parents 378b570 + bec15b2 commit 234d52a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tipboard/static/js/tipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RendererFactory.prototype.rendererName2renderObj = {
RendererFactory.prototype.createRenderer = function (rendererName) {
var lower = rendererName.toLowerCase();
var rendererClass = RendererFactory.prototype.rendererName2renderObj[lower];
if (rendererClass === void 0) {
if (typeof(rendererClass) === 'undefined') {
throw new RendererFactory.prototype.UnknownRenderer(rendererName);
}
return rendererClass;
Expand Down Expand Up @@ -413,7 +413,7 @@ var renderersSwapper = new RenderersSwapper();
return false; // break
}
});
if (typeof nextFlipIdx !== void 0) {
if (typeof(nextFlipIdx) !== 'undefined') {
var tileToFlip = containerFlips[nextFlipIdx];
$(tileToFlip).addClass("flippedforward");
}
Expand Down Expand Up @@ -517,7 +517,7 @@ var renderersSwapper = new RenderersSwapper();
},

init: function() {
if ((this.websocket !== void 0) && !(this.websocket.readyState === WebSocket.CLOSED || this.websocket.readyState === WebSocket.CLOSING)) {
if ((typeof(this.websocket) !== 'undefined') && !(this.websocket.readyState === WebSocket.CLOSED || this.websocket.readyState === WebSocket.CLOSING)) {
console.log("Closing outdated Web socket.");
this.websocket.close();
return; // the rest will be handled in onClose()
Expand Down Expand Up @@ -604,7 +604,7 @@ var renderersSwapper = new RenderersSwapper();
var tile = Tipboard.Dashboard.id2node(tileId);
$.each(keysToUse, function(idx, key) {
var value = dataToPut[key];
if (value === void 0) {
if (typeof(value) === 'undefined') {
var msg = 'WARN: No key "' + key + '" in data'
console.log(msg, dataToPut);
} else {
Expand Down
2 changes: 1 addition & 1 deletion tipboard/tiles/big_value.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ BigValueTile = {
setBigValueColor: function(tileId, meta) {
// DEPRECATED function, Tipboard.DisplayUtils.applyHighlighterConfig
var color = meta['big_value_color'];
if (color !== void 0) {
if (typeof(color) !== 'undefined') {
color = Tipboard.DisplayUtils.replaceFromPalette(color)
var tile = Tipboard.Dashboard.id2node(tileId);
var bigValue = $(tile).find('#' + tileId + '-big-value')[0]
Expand Down
4 changes: 2 additions & 2 deletions tipboard/tiles/fancy_listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
function updateTileFancyListing(tileId, data, config, tipboard) {
var tile = Tipboard.Dashboard.id2node(tileId);
var nodeToClone = FancyListing.initContainer(tile);
if (nodeToClone === void 0) {
if (typeof(nodeToClone) === 'undefined') {
return false;
}
FancyListing.populateItems(tile, nodeToClone, data);
Expand All @@ -20,7 +20,7 @@ Tipboard.Dashboard.registerUpdateFunction('fancy_listing', updateTileFancyListin
FancyListing = {
initContainer: function(tile) {
var nodeToClone = $(tile).find('.fancy-listing-item')[0];
if (nodeToClone === void 0) {
if (typeof(nodeToClone) === 'undefined') {
console.log('ABORTING - no node to clone');
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion tipboard/tiles/just_value.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ JustValue = {
setJustValueColor: function(tileId, meta) {
// DEPRECATED function, Tipboard.DisplayUtils.applyHighlighterConfig
var color = meta['just-value-color'];
if (color !== void 0) {
if (typeof(color) !== 'undefined') {
color = Tipboard.DisplayUtils.replaceFromPalette(color);
var dst = $('#' + tileId + '-just-value').parent();
$(dst).css('background-color', color);
Expand Down

0 comments on commit 234d52a

Please sign in to comment.