1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.ltrim = ltrim;
|
7 | function ltrim(key, s, e) {
|
8 | if (this.data.has(key) && !(this.data.get(key) instanceof Array)) {
|
9 | throw new Error('Key ' + key + ' does not contain a list');
|
10 | }
|
11 | var start = parseInt(s, 10);
|
12 | var end = parseInt(e, 10);
|
13 |
|
14 | var list = this.data.get(key) || [];
|
15 |
|
16 | if (start < 0) {
|
17 | start = list.length + start;
|
18 | }
|
19 | if (end < 0) {
|
20 | end = list.length + end;
|
21 | }
|
22 |
|
23 | this.data.set(key, list.slice(start, end + 1));
|
24 | return 'OK';
|
25 | } |
\ | No newline at end of file |