Skip to content

Commit

Permalink
Merge pull request #38 from marques-work/jshint-fixes
Browse files Browse the repository at this point in the history
More jshint fixes
  • Loading branch information
drudru committed May 4, 2017
2 parents 7a138a5 + e9ca8ef commit caa4c41
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 30 deletions.
23 changes: 12 additions & 11 deletions ansi_up.js
Expand Up @@ -4,16 +4,17 @@
* http://github.com/drudru/ansi_up
*/
(function (factory) {
var v;
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
v = factory(require, exports);
if ("undefined" !== typeof v) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
else if ("function" === typeof define && define.amd) {
define(["require", "exports"], factory);
}
else {
var req, exp = {};
var v = factory(req, exp);
v = factory(req, exp);
window.AnsiUp = exp.default;
}
})(function (require, exports) {
Expand Down Expand Up @@ -152,15 +153,15 @@ var AnsiUp = (function () {
for (var r = 0; r < 6; ++r) {
for (var g = 0; g < 6; ++g) {
for (var b = 0; b < 6; ++b) {
var c = { rgb: [levels[r], levels[g], levels[b]], class_name: 'truecolor' };
this.palette_256.push(c);
var col = { rgb: [levels[r], levels[g], levels[b]], class_name: 'truecolor' };
this.palette_256.push(col);
}
}
}
var grey_level = 8;
for (var i = 0; i < 24; ++i, grey_level += 10) {
var c = { rgb: [grey_level, grey_level, grey_level], class_name: 'truecolor' };
this.palette_256.push(c);
var gry = { rgb: [grey_level, grey_level, grey_level], class_name: 'truecolor' };
this.palette_256.push(gry);
}
};
AnsiUp.prototype.old_escape_for_html = function (txt) {
Expand Down Expand Up @@ -242,9 +243,9 @@ var AnsiUp = (function () {
console.log(chunks);
console.log(last_chunk);
}
if ((chunks.length === 2)
&& (chunks[1] === '')
&& (chunks[0].slice(-1) === "\x1B")) {
if (chunks.length === 2 &&
chunks[1] === "" &&
chunks[0].slice(-1) === "\x1B") {
this._buffer = "\x1B";
last_chunk = chunks.shift();
chunks.unshift(last_chunk.substr(0, last_chunk.length - 1));
Expand Down
14 changes: 7 additions & 7 deletions ansi_up.ts
Expand Up @@ -218,17 +218,17 @@ class AnsiUp
for (let r = 0; r < 6; ++r) {
for (let g = 0; g < 6; ++g) {
for (let b = 0; b < 6; ++b) {
let c = {rgb:[levels[r], levels[g], levels[b]], class_name:'truecolor'};
this.palette_256.push(c);
let col = {rgb:[levels[r], levels[g], levels[b]], class_name:'truecolor'};
this.palette_256.push(col);
}
}
}

// Index 232..255 : Grayscale
let grey_level = 8;
for (let i = 0; i < 24; ++i, grey_level += 10) {
let c = {rgb:[grey_level, grey_level, grey_level], class_name:'truecolor'};
this.palette_256.push(c);
let gry = {rgb:[grey_level, grey_level, grey_level], class_name:'truecolor'};
this.palette_256.push(gry);
}
}

Expand Down Expand Up @@ -352,9 +352,9 @@ class AnsiUp
console.log(last_chunk);
}
// - Incomplete ESC, only one packet
if ((chunks.length === 2)
&& (chunks[1] === '')
&& (chunks[0].slice(-1) === "\x1B")) {
if (chunks.length === 2 &&
chunks[1] === "" &&
chunks[0].slice(-1) === "\x1B") {
this._buffer = "\x1B";
last_chunk = chunks.shift();
chunks.unshift(last_chunk.substr(0, last_chunk.length - 1));
Expand Down
14 changes: 7 additions & 7 deletions dist/ansi_up.js.include
Expand Up @@ -132,15 +132,15 @@ var AnsiUp = (function () {
for (var r = 0; r < 6; ++r) {
for (var g = 0; g < 6; ++g) {
for (var b = 0; b < 6; ++b) {
var c = { rgb: [levels[r], levels[g], levels[b]], class_name: 'truecolor' };
this.palette_256.push(c);
var col = { rgb: [levels[r], levels[g], levels[b]], class_name: 'truecolor' };
this.palette_256.push(col);
}
}
}
var grey_level = 8;
for (var i = 0; i < 24; ++i, grey_level += 10) {
var c = { rgb: [grey_level, grey_level, grey_level], class_name: 'truecolor' };
this.palette_256.push(c);
var gry = { rgb: [grey_level, grey_level, grey_level], class_name: 'truecolor' };
this.palette_256.push(gry);
}
};
AnsiUp.prototype.old_escape_for_html = function (txt) {
Expand Down Expand Up @@ -222,9 +222,9 @@ var AnsiUp = (function () {
console.log(chunks);
console.log(last_chunk);
}
if ((chunks.length === 2)
&& (chunks[1] === '')
&& (chunks[0].slice(-1) === "\x1B")) {
if (chunks.length === 2 &&
chunks[1] === "" &&
chunks[0].slice(-1) === "\x1B") {
this._buffer = "\x1B";
last_chunk = chunks.shift();
chunks.unshift(last_chunk.substr(0, last_chunk.length - 1));
Expand Down
2 changes: 1 addition & 1 deletion dist/ansi_up.js.map

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions umd.header
Expand Up @@ -4,16 +4,17 @@
* http://github.com/drudru/ansi_up
*/
(function (factory) {
var v;
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
v = factory(require, exports);
if ("undefined" !== typeof v) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
else if ("function" === typeof define && define.amd) {
define(["require", "exports"], factory);
}
else {
var req, exp = {};
var v = factory(req, exp);
v = factory(req, exp);
window.AnsiUp = exp.default;
}
})(function (require, exports) {
Expand Down

0 comments on commit caa4c41

Please sign in to comment.