Skip to content

Commit

Permalink
fix some lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
killmenot committed Jul 24, 2018
1 parent 09d06a4 commit dcb113d
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"node": true,
"jasmine": true,
"bitwise": true,
"camelcase": true,
"camelcase": false,
"curly": true,
"esversion": 6,
"forin": true,
Expand Down
2 changes: 1 addition & 1 deletion lib/apis/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ function data(node) {
return {
ok: 0
};
};
}

module.exports = data;
2 changes: 1 addition & 1 deletion lib/apis/deleteNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function deleteNode(glob, subscripts) {
result = commands.getMatchingKeys.call(this, wildCard);

// now delete all these keys
result = commands.deleteKeys.call(this, keys.concat(result))
result = commands.deleteKeys.call(this, keys.concat(result));

// now remove leaf item records
// match all the lower-level leaf nodes that start with the specified flattened subscripts
Expand Down
2 changes: 1 addition & 1 deletion lib/apis/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function get(node) {
data: result.value || '',
defined: parseInt(result.data, 10),
subscripts: node.subscripts
}
};
}

return {
Expand Down
4 changes: 2 additions & 2 deletions lib/apis/globalDirectory.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
const debug = require('debug')('ewd-memory-globals:global_directory');
const commands = {
getMatchingKeys: require('../commands/getMatchingKeys')
}
};

function globalDirectory() {
debug('requesting globals');
Expand All @@ -49,6 +49,6 @@ function globalDirectory() {
list.sort();

return list;
};
}

module.exports = globalDirectory;
4 changes: 2 additions & 2 deletions lib/apis/increment.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function increment(node) {
if (currentValue === '') currentValue = 0;
node.data = parseInt(currentValue, 10) + parseInt(by, 10);

const result = this.set(node);
this.set(node);

return {
ok: 1,
Expand All @@ -57,6 +57,6 @@ function increment(node) {
return {
ok: 0
};
};
}

module.exports = increment;
2 changes: 1 addition & 1 deletion lib/apis/kill.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ function kill(node) {
result: 0,
subscripts: node.subscripts || ''
};
};
}

module.exports = kill;
3 changes: 1 addition & 2 deletions lib/apis/leafNodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ function leafNodes(node, direction) {
let member;
let index;
let max;
let min;
let result;
let tempMember;

Expand Down Expand Up @@ -164,6 +163,6 @@ function leafNodes(node, direction) {
return {
ok: 0
};
};
}

module.exports = leafNodes;
4 changes: 2 additions & 2 deletions lib/apis/lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function lock(node) {

return {
ok: 0
}
};
};
}

module.exports = lock;
4 changes: 1 addition & 3 deletions lib/apis/sequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ const commands = {
getMemberByIndex: require('../commands/getMemberByIndex'),
};

const FIELD_MARK = String.fromCharCode(254);

function sequence(node, direction) {
debug('next: %j; direction: %s', node, direction);

Expand Down Expand Up @@ -157,7 +155,7 @@ function sequence(node, direction) {
return {
ok: 0
};
};
}

module.exports = sequence;

2 changes: 1 addition & 1 deletion lib/apis/set.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ function set(node) {
result: 0,
subscripts: subscripts || ''
};
};
}

module.exports = set;
2 changes: 1 addition & 1 deletion lib/apis/unlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ function unlock(node) {
return {
ok: 0
};
};
}

module.exports = unlock;
1 change: 0 additions & 1 deletion lib/commands/addMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
'use strict';

const keyExists = require('./keyExists');
const getMemberIndex = require('./getMemberIndex');

function addMember(key, member) {
const list = keyExists.call(this, key) ?
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/deleteKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const debug = require('debug')('ewd-memory-globals:deleteKeys');

function deleteKeys(keys) {
debug('keys = %j', keys);
keys.forEach(key => this.store.delete(key))
keys.forEach(key => this.store.delete(key));

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/deleteMembersByPrefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function deleteMembersByPrefix(key, prefixValue) {
if (!keyExists.call(this, key)) return false;

const list = this.store.get(key);
const newList = list.filter(it => !it.startsWith(prefixValue))
const newList = list.filter(it => !it.startsWith(prefixValue));

if (newList.length > 0) {
this.store.set(key, newList);
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/getProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function getProperty(key, propertyName) {
debug('key = %s, propertyName = %s', key, propertyName);

if (keyExists.call(this, key)) {
value = this.store.get(key)[propertyName]
value = this.store.get(key)[propertyName];
}

return value;
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/pushOntoList.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
//var lpush = require('./lpush');

function pushOntoList(key, value) {
console.log('pushOntoList', key, value)
console.log('pushOntoList', key, value);
// var args = [key, value];
// var results = lpush.call(this, args);
// return results[0];
Expand Down
28 changes: 14 additions & 14 deletions lib/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,6 @@

'use strict';

function createStore() {
return {
set: storeSet,
get: storeGet,
delete: storeDelete,
exists: storeExists,
reset: storeReset,
keys: storeAllKeys,
createStore: createStore,
_store: {}
}
}

function storeSet(key, value) {
this._store[key] = value;
}
Expand All @@ -64,11 +51,24 @@ function storeExists(key) {
}

function storeReset() {
this._store = {}
this._store = {};
}

function storeAllKeys() {
return Object.keys(this._store);
}

function createStore() {
return {
set: storeSet,
get: storeGet,
delete: storeDelete,
exists: storeExists,
reset: storeReset,
keys: storeAllKeys,
createStore: createStore,
_store: {}
};
}

module.exports = createStore();

0 comments on commit dcb113d

Please sign in to comment.