extras.js 634 B

123456789101112131415161718192021
  1. /*
  2. Copyright (c) 2014 Google Inc. All rights reserved.
  3. Use of this source code is governed by the MIT License, available in this package's LICENSE file
  4. or at http://opensource.org/licenses/MIT.
  5. */
  6. function callFunction(targetPath, parentModule, func) {
  7. if (!func) {
  8. return '';
  9. }
  10. return func(targetPath, parentModule);
  11. }
  12. exports.before = function before(targetPath, parentModule, options) {
  13. return callFunction(targetPath, parentModule, options.before);
  14. };
  15. exports.after = function after(targetPath, parentModule, options) {
  16. return callFunction(targetPath, parentModule, options.after);
  17. };