merge.js 400 B

12345678910111213141516171819
  1. 'use strict';
  2. module.exports = function merge(s1, s2) {
  3. s1.add(s2.obj);
  4. s1.callQueue = s1.callQueue.concat(s2.callQueue);
  5. s1.method(s2.methods);
  6. s1.static(s2.statics);
  7. for (const query in s2.query) {
  8. s1.query[query] = s2.query[query];
  9. }
  10. for (const virtual in s2.virtuals) {
  11. s1.virtuals[virtual] = s2.virtuals[virtual].clone();
  12. }
  13. s1.s.hooks.merge(s2.s.hooks, false);
  14. };