factoryValidator.js 439 B

12345678910111213141516
  1. module.exports = function(factory) {
  2. if (typeof factory.create !== "function") {
  3. throw new TypeError("factory.create must be a function");
  4. }
  5. if (typeof factory.destroy !== "function") {
  6. throw new TypeError("factory.destroy must be a function");
  7. }
  8. if (
  9. typeof factory.validate !== "undefined" &&
  10. typeof factory.validate !== "function"
  11. ) {
  12. throw new TypeError("factory.validate must be a function");
  13. }
  14. };