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.

16 lines
327 B

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