fixed eslint formatting

This commit is contained in:
zneix 2020-08-28 23:57:50 +02:00
parent 9255094ec4
commit d303416dba
5 changed files with 36 additions and 35 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
node_modules
.vscode
data
data-test
*.swp
*.swo

View File

@ -10,6 +10,11 @@ const HasteUtils = require('./lib/util');
const utils = new HasteUtils();
//load config and set some defaults
const config = require('./config');
config.port = config.port || 7777;
config.host = config.host || '127.0.0.1';
//set up logger
winston.add(new winston.transports.Console({
level: config.logging.level,
@ -19,11 +24,6 @@ winston.add(new winston.transports.Console({
),
}));
//load config and set some defaults
const config = require('./config');
config.port = config.port || 7777;
config.host = config.host || '127.0.0.1';
//defaulting storage type to file
if (!config.storage){
config.storage = {

View File

@ -28,13 +28,13 @@ haste_document.prototype.load = function(key, callback, lang){
let high;
try {
if (lang == 'txt'){
high = { value: _this.htmlEscape(res.data) };
high = { value: _this.htmlEscape(res.data) };
}
else if (lang){
high = hljs.highlight(lang, res.data);
high = hljs.highlight(lang, res.data);
}
else {
high = hljs.highlightAuto(res.data);
high = hljs.highlightAuto(res.data);
}
}
catch(err){
@ -68,7 +68,7 @@ haste_document.prototype.save = function(data, callback){
_this.locked = true;
_this.key = res.key;
let high = hljs.highlightAuto(data);
callback(null, {
callback(null, {
value: high.value,
key: res.key,
language: high.language,
@ -130,7 +130,7 @@ haste.prototype.configureKey = enable => {
let $this;
$('#box2 .function').each(function(){
$this = $(this);
for (el of enable){
for (const el of enable){
if ($this.hasClass(el)){
$this.addClass('enabled');
return true;
@ -315,7 +315,7 @@ haste.prototype.configureButtons = function(){
}
}
];
for (button of this.buttons){
for (const button of this.buttons){
this.configureButton(button);
}
};
@ -346,7 +346,7 @@ haste.prototype.configureButton = function(options){
haste.prototype.configureShortcuts = function(){
let _this = this;
$(document.body).keydown(function(evt){
for (button of _this.buttons){
for (const button of _this.buttons){
if (button.shortcut && button.shortcut(evt)){
evt.preventDefault();
button.action();

View File

@ -8,20 +8,20 @@ const vowels = 'aeiou';
const consonants = 'bcdfghjklmnpqrstvwxyz';
describe('RandomKeyGenerator', () => {
describe('randomKey', () => {
it('should return a key of the proper length', () => {
const gen = new Generator();
assert.equal(6, gen.createKey(6).length);
});
describe('randomKey', () => {
it('should return a key of the proper length', () => {
const gen = new Generator();
assert.equal(6, gen.createKey(6).length);
});
it('should alternate consonants and vowels', () => {
const gen = new Generator();
it('should alternate consonants and vowels', () => {
const gen = new Generator();
const key = gen.createKey(3);
const key = gen.createKey(3);
assert.ok(consonants.includes(key[0]));
assert.ok(consonants.includes(key[2]));
assert.ok(vowels.includes(key[1]));
});
});
assert.ok(consonants.includes(key[0]));
assert.ok(consonants.includes(key[2]));
assert.ok(vowels.includes(key[1]));
});
});
});

View File

@ -5,15 +5,15 @@ const assert = require('assert');
const Generator = require('../../lib/key_generators/random');
describe('RandomKeyGenerator', () => {
describe('randomKey', () => {
it('should return a key of the proper length', () => {
const gen = new Generator();
assert.equal(6, gen.createKey(6).length);
});
describe('randomKey', () => {
it('should return a key of the proper length', () => {
const gen = new Generator();
assert.equal(6, gen.createKey(6).length);
});
it('should use a key from the given keyset if given', () => {
const gen = new Generator({keyspace: 'A'});
assert.equal('AAAAAA', gen.createKey(6));
});
});
it('should use a key from the given keyset if given', () => {
const gen = new Generator({keyspace: 'A'});
assert.equal('AAAAAA', gen.createKey(6));
});
});
});