isJobInList-1.js 670 B

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.isJobInList = void 0;
  4. const content = `--[[
  5. Checks if job is in a given list.
  6. Input:
  7. KEYS[1]
  8. ARGV[1]
  9. Output:
  10. 1 if element found in the list.
  11. ]]
  12. -- Includes
  13. --[[
  14. Functions to check if a item belongs to a list.
  15. ]]
  16. local function checkItemInList(list, item)
  17. for _, v in pairs(list) do
  18. if v == item then
  19. return 1
  20. end
  21. end
  22. return nil
  23. end
  24. local items = redis.call("LRANGE", KEYS[1] , 0, -1)
  25. return checkItemInList(items, ARGV[1])
  26. `;
  27. exports.isJobInList = {
  28. name: 'isJobInList',
  29. content,
  30. keys: 1,
  31. };
  32. //# sourceMappingURL=isJobInList-1.js.map