Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

order-by-first-call.js 817B

123456789101112131415161718192021222324252627282930313233343536
  1. "use strict";
  2. var sort = require("./prototypes/array").sort;
  3. var slice = require("./prototypes/array").slice;
  4. /**
  5. * @private
  6. */
  7. function comparator(a, b) {
  8. // uuid, won't ever be equal
  9. var aCall = a.getCall(0);
  10. var bCall = b.getCall(0);
  11. var aId = (aCall && aCall.callId) || -1;
  12. var bId = (bCall && bCall.callId) || -1;
  13. return aId < bId ? -1 : 1;
  14. }
  15. /**
  16. * A Sinon proxy object (fake, spy, stub)
  17. *
  18. * @typedef {object} SinonProxy
  19. * @property {Function} getCall - A method that can return the first call
  20. */
  21. /**
  22. * Sorts an array of SinonProxy instances (fake, spy, stub) by their first call
  23. *
  24. * @param {SinonProxy[] | SinonProxy} spies
  25. * @returns {SinonProxy[]}
  26. */
  27. function orderByFirstCall(spies) {
  28. return sort(slice(spies), comparator);
  29. }
  30. module.exports = orderByFirstCall;