You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
266 B

4 years ago
  1. 'use strict';
  2. module.exports = function pop() {
  3. if (Array.isArray(this.items)) {
  4. return this.items.pop();
  5. }
  6. var keys = Object.keys(this.items);
  7. var key = keys[keys.length - 1];
  8. var last = this.items[key];
  9. delete this.items[key];
  10. return last;
  11. };