ioredis-mock
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -8,2 +8,14 @@ # ioredis-mock change log | ||
## [2.3.0] - 2017-02-28 | ||
### Added | ||
* Add event emitter inheritance. (#248 @xsellier) | ||
* Trigger connect & ready events on instantiation. (#280 @rexxars) | ||
### Changed | ||
* Prevent conversion of buffer arguments to strings. (#236 @dpikt) | ||
### Misc | ||
* updated all dependencies to latest stable versions (@greenkeeperio-bot) | ||
## [2.2.0] - 2016-10-31 | ||
@@ -309,2 +321,4 @@ | ||
[Unreleased]: https://github.com/stipsan/ioredis-mock/compare/v2.3.0...HEAD | ||
[2.3.0]: https://github.com/stipsan/ioredis-mock/compare/v2.2.0...v2.3.0 | ||
[2.2.0]: https://github.com/stipsan/ioredis-mock/compare/v2.1.0...v2.2.0 | ||
@@ -311,0 +325,0 @@ [2.1.0]: https://github.com/stipsan/ioredis-mock/compare/v2.0.0...v2.1.0 |
@@ -30,5 +30,7 @@ 'use strict'; | ||
// transform arguments to strings to simulate real ioredis behavior | ||
// transform non-buffer arguments to strings to simulate real ioredis behavior | ||
var stringArgs = args.map(function (arg) { | ||
return arg.toString(); | ||
return (// eslint-disable-line no-confusing-arrow | ||
arg instanceof Buffer ? arg : arg.toString() | ||
); | ||
}); | ||
@@ -35,0 +37,0 @@ |
@@ -12,3 +12,3 @@ 'use strict'; | ||
for (var i = 0; i < arguments.length; i += 2) { | ||
_index.set.call(this, arguments.length <= i + 0 ? undefined : arguments[i + 0], arguments.length <= i + 1 + 0 ? undefined : arguments[i + 1 + 0]); | ||
_index.set.call(this, arguments.length <= i ? undefined : arguments[i], arguments.length <= i + 1 ? undefined : arguments[i + 1]); | ||
} | ||
@@ -15,0 +15,0 @@ |
@@ -12,3 +12,3 @@ 'use strict'; | ||
for (var i = 0; i < arguments.length; i += 2) { | ||
if (this.data.has(arguments.length <= i + 0 ? undefined : arguments[i + 0])) { | ||
if (this.data.has(arguments.length <= i ? undefined : arguments[i])) { | ||
return 0; | ||
@@ -19,3 +19,3 @@ } | ||
for (var _i = 0; _i < arguments.length; _i += 2) { | ||
_index.set.call(this, arguments.length <= _i + 0 ? undefined : arguments[_i + 0], arguments.length <= _i + 1 + 0 ? undefined : arguments[_i + 1 + 0]); | ||
_index.set.call(this, arguments.length <= _i ? undefined : arguments[_i], arguments.length <= _i + 1 ? undefined : arguments[_i + 1]); | ||
} | ||
@@ -22,0 +22,0 @@ |
@@ -9,2 +9,6 @@ 'use strict'; | ||
var _events = require('events'); | ||
var _events2 = _interopRequireDefault(_events); | ||
var _commands = require('./commands'); | ||
@@ -26,6 +30,6 @@ | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
@@ -37,23 +41,34 @@ | ||
var RedisMock = function () { | ||
function RedisMock() { | ||
var _this = this; | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _ref$data = _ref.data; | ||
var data = _ref$data === undefined ? {} : _ref$data; | ||
var RedisMock = function (_EventEmitter) { | ||
_inherits(RedisMock, _EventEmitter); | ||
function RedisMock() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
_ref$data = _ref.data, | ||
data = _ref$data === undefined ? {} : _ref$data; | ||
_classCallCheck(this, RedisMock); | ||
this.channels = {}; | ||
this.batch = []; | ||
var _this = _possibleConstructorReturn(this, (RedisMock.__proto__ || Object.getPrototypeOf(RedisMock)).call(this)); | ||
this.expires = (0, _expires2.default)(); | ||
_this.channels = {}; | ||
_this.batch = []; | ||
this.data = (0, _data2.default)(this.expires, data); | ||
_this.expires = (0, _expires2.default)(); | ||
_this.data = (0, _data2.default)(_this.expires, data); | ||
Object.keys(commands).forEach(function (command) { | ||
_this[command] = (0, _command3.default)(commands[command].bind(_this)); | ||
}); | ||
process.nextTick(function () { | ||
_this.emit('connect'); | ||
_this.emit('ready'); | ||
}); | ||
return _this; | ||
} | ||
@@ -69,8 +84,6 @@ | ||
var _ref3 = _toArray(_ref2); | ||
var _ref3 = _toArray(_ref2), | ||
command = _ref3[0], | ||
options = _ref3.slice(1); | ||
var command = _ref3[0]; | ||
var options = _ref3.slice(1); | ||
return (_command = _this2[command]).bind.apply(_command, [_this2].concat(_toConsumableArray(options))); | ||
@@ -95,4 +108,4 @@ }); | ||
return RedisMock; | ||
}(); | ||
}(_events2.default); | ||
exports.default = RedisMock; |
{ | ||
"name": "ioredis-mock", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "This library emulates ioredis by performing all operations in-memory.", | ||
@@ -54,29 +54,29 @@ "main": "./lib", | ||
"devDependencies": { | ||
"babel-cli": "6.18.0", | ||
"babel-eslint": "7.0.0", | ||
"babel-preset-es2015": "6.18.0", | ||
"babel-register": "6.16.3", | ||
"codeclimate-test-reporter": "0.4.0", | ||
"coveralls": "2.11.14", | ||
"eslint": "3.9.0", | ||
"eslint-config-airbnb-base": "9.0.0", | ||
"eslint-plugin-import": "2.0.1", | ||
"babel-cli": "6.23.0", | ||
"babel-eslint": "7.1.1", | ||
"babel-preset-es2015": "6.22.0", | ||
"babel-register": "6.23.0", | ||
"codeclimate-test-reporter": "0.4.1", | ||
"coveralls": "2.11.16", | ||
"eslint": "3.16.1", | ||
"eslint-config-airbnb-base": "11.1.0", | ||
"eslint-plugin-import": "2.2.0", | ||
"expect": "1.20.2", | ||
"gh-release": "2.1.0", | ||
"gh-release": "2.2.1", | ||
"growl": "1.9.2", | ||
"ioredis": "2.4.0", | ||
"ioredis": "2.5.0", | ||
"istanbul": "1.1.0-alpha.1", | ||
"mkdirp": "0.5.1", | ||
"mocha": "3.1.2", | ||
"rimraf": "2.5.4" | ||
"mocha": "3.2.0", | ||
"rimraf": "2.6.1" | ||
}, | ||
"dependencies": { | ||
"array-from": "^2.1.1", | ||
"bluebird": "3.4.6", | ||
"bluebird": "3.4.7", | ||
"es6-set": "^0.1.4", | ||
"lodash": "4.16.5", | ||
"lodash": "4.17.4", | ||
"minimatch": "3.0.3", | ||
"object-assign": "4.1.0", | ||
"redis-commands": "1.3.0" | ||
"object-assign": "4.1.1", | ||
"redis-commands": "1.3.1" | ||
} | ||
} |
ioredis-mock | ||
============ | ||
[](https://greenkeeper.io/) | ||
[](https://ci.appveyor.com/project/stipsan/ioredis-mock) | ||
@@ -5,0 +7,0 @@ [](https://travis-ci.org/stipsan/ioredis-mock) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2211
62
206392
+ Addedbluebird@3.4.7(transitive)
+ Addedlodash@4.17.4(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedredis-commands@1.3.1(transitive)
- Removedbluebird@3.4.6(transitive)
- Removedlodash@4.16.5(transitive)
- Removedobject-assign@4.1.0(transitive)
- Removedredis-commands@1.3.0(transitive)
Updatedbluebird@3.4.7
Updatedlodash@4.17.4
Updatedobject-assign@4.1.1
Updatedredis-commands@1.3.1