UNPKG

434 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.incrby = incrby;
7function incrby(key) {
8 var increment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
9
10 if (!this.data.has(key)) {
11 this.data.set(key, '0');
12 }
13 var curVal = Number(this.data.get(key));
14 var nextVal = curVal + parseInt(increment, 10);
15 this.data.set(key, nextVal.toString());
16 return nextVal;
17}
\No newline at end of file