UNPKG

396 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.rpop = rpop;
7function rpop(key) {
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 list = this.data.get(key) || [];
12
13 var item = list.length > 0 ? list.pop() : null;
14
15 this.data.set(key, list);
16
17 return item;
18}
\No newline at end of file