fcs
2025-04-10 0163870d662dc5b7d69ceff977490ede594f7d82
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* extend start */
var extend
var _extend
var _isObject
 
_isObject = function (o) {
  return Object.prototype.toString.call(o) === '[object Object]'
}
 
_extend = function self (destination, source) {
  var property
  for (property in destination) {
    if (destination.hasOwnProperty(property)) {
      // 若 destination[property] 和 source[property] 都是对象,则递归。
      if (_isObject(destination[property]) && _isObject(source[property])) {
        self(destination[property], source[property])
      }
 
      // 若 source[property] 已存在,则跳过。
      if (!source.hasOwnProperty(property)) {
        source[property] = destination[property]
      }
    }
  }
}
 
extend = function () {
  var arr = arguments
  var result = {}
  var i
 
  if (!arr.length) {
    return {}
  }
 
  for (i = arr.length - 1; i >= 0; i--) {
    if (_isObject(arr[i])) {
      _extend(arr[i], result)
    }
  }
 
  arr[0] = result
  return result
}
 
exports.extend = extend
 
/* extend end */
 
exports.isEmptyObject = function (obj) {
    for (var t in obj) {
      return !1
    }
    return !0
  }