ctor.js 701 B

123456789101112131415161718192021222324252627282930313233
  1. 'use strict'
  2. var setupDefaults = require('./setupDefaults')
  3. var arrayEach = require('./arrayEach')
  4. var each = require('./each')
  5. var isFunction = require('./isFunction')
  6. var assign = require('./assign')
  7. var XEUtils = function () {}
  8. function mixin () {
  9. arrayEach(arguments, function (methods) {
  10. each(methods, function (fn, name) {
  11. XEUtils[name] = isFunction(fn) ? function () {
  12. var result = fn.apply(XEUtils.$context, arguments)
  13. XEUtils.$context = null
  14. return result
  15. } : fn
  16. })
  17. })
  18. }
  19. function setup (options) {
  20. return assign(setupDefaults, options)
  21. }
  22. XEUtils.VERSION = '3.1.13'
  23. XEUtils.mixin = mixin
  24. XEUtils.setup = setup
  25. module.exports = XEUtils