Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Commit

Permalink
clear code
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Mar 25, 2018
1 parent 8a62fd6 commit 7dd578f
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 34 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
@@ -1,9 +1,8 @@
language: node_js
node_js:
- "4.5.0"
- "4"
- "6"
- "8"
- "9"
cache:
directories:
- node_modules
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2017 thunks
Copyright (c) 2015-2018 thunks

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 10 additions & 10 deletions check-commands
Expand Up @@ -5,12 +5,11 @@ const cli = redis.createClient(6379)

cli.info()(function * (err, info) {
if (err) throw err
console.log('Version:', info.redis_version)

var add = []
var discard = []
var commandsInfo = {}
var commands = yield cli.command()
const add = []
const discard = []
const commandsInfo = {}
let commands = yield cli.command()

commands = commands.map(function (command) {
commandsInfo[command[0]] = command.slice(1)
Expand All @@ -21,19 +20,20 @@ cli.info()(function * (err, info) {
if (cli.clientCommands.indexOf(command) === -1) add.push(command)
return add
}, add)
console.log('Add:', add)

cli.clientCommands.reduce(function (discard, command) {
if (commands.indexOf(command) === -1) discard.push(command)
return discard
}, discard)
console.log('Discard:', discard)

info = {}
const all = {}
Object.keys(commandsInfo).sort().forEach(function (command) {
info[command] = commandsInfo[command]
all[command] = commandsInfo[command]
})
console.log(info)

console.log(all)
console.log('Add:', add)
console.log('Discard:', discard)
console.log('Version:', info.redis_version)
process.exit()
})()
11 changes: 5 additions & 6 deletions package.json
Expand Up @@ -31,14 +31,13 @@
"node": ">= 4.5.0"
},
"dependencies": {
"respjs": "^4.1.2",
"thunks": "^4.9.0"
"respjs": "^4.1.4",
"thunks": "^4.9.2"
},
"devDependencies": {
"jsonkit": "^0.3.2",
"should": "^13.1.2",
"standard": "^10.0.3",
"tman": "^1.7.2"
"should": "^13.2.1",
"standard": "^11.0.1",
"tman": "^1.7.4"
},
"license": "MIT",
"bugs": {
Expand Down
7 changes: 3 additions & 4 deletions test/commands-hash.js
Expand Up @@ -2,7 +2,6 @@

const tman = require('tman')
const should = require('should')
const JSONKit = require('jsonkit')
const redis = require('..')

module.exports = function () {
Expand Down Expand Up @@ -247,10 +246,10 @@ module.exports = function () {
})(function (error, res) {
should(error).be.equal(null)
should(scanKeys.length).be.equal(200)
JSONKit.each(data, function (value, key) {
should(scanKeys).be.containEql(value + '')
for (let key of Object.keys(data)) {
should(scanKeys).be.containEql(data[key] + '')
should(scanKeys).be.containEql(key)
})
}
return this.hscan('hash', '0', 'count', 20)
})(function (error, res) {
should(error).be.equal(null)
Expand Down
5 changes: 2 additions & 3 deletions test/commands-key.js
Expand Up @@ -3,7 +3,6 @@
const tman = require('tman')
const should = require('should')
const thunk = require('thunks')()
const JSONKit = require('jsonkit')
const redis = require('..')

module.exports = function () {
Expand Down Expand Up @@ -617,9 +616,9 @@ module.exports = function () {
return fullScan(0)
})(function (error, res) {
should(error).be.equal(null)
JSONKit.each(data, function (value, key) {
for (let key of Object.keys(data)) {
should(scanKeys.indexOf(key) >= 0).be.equal(true)
})
}
return this.scan('0', 'count', 20)
})(function (error, res) {
should(error).be.equal(null)
Expand Down
7 changes: 3 additions & 4 deletions test/commands-set.js
Expand Up @@ -3,7 +3,6 @@
const tman = require('tman')
const should = require('should')
const thunk = require('thunks')()
const JSONKit = require('jsonkit')
const redis = require('..')

module.exports = function () {
Expand Down Expand Up @@ -239,9 +238,9 @@ module.exports = function () {
})(function (error, res) {
should(error).be.equal(null)
should(scanKeys.length).be.equal(100)
JSONKit.each(data, function (value) {
should(scanKeys).be.containEql(value)
})
for (let key of Object.keys(data)) {
should(scanKeys).be.containEql(data[key])
}
return this.sscan('set', 0, 'count', 20)
})(function (error, res) {
should(error).be.equal(null)
Expand Down
7 changes: 3 additions & 4 deletions test/commands-sorted-set.js
Expand Up @@ -3,7 +3,6 @@
const tman = require('tman')
const should = require('should')
const thunk = require('thunks')()
const JSONKit = require('jsonkit')
const redis = require('..')

module.exports = function () {
Expand Down Expand Up @@ -214,9 +213,9 @@ module.exports = function () {
})(function (error, res) {
should(error).be.equal(null)
should(scanKeys.length).be.equal(200)
JSONKit.each(data, function (value) {
should(scanKeys).be.containEql(value + '')
})
for (let key of Object.keys(data)) {
should(scanKeys).be.containEql(data[key] + '')
}
return this.zscan('zset', 0, 'match', '*0', 'COUNT', 200)
})(function (error, res) {
should(error).be.equal(null)
Expand Down

0 comments on commit 7dd578f

Please sign in to comment.