text: /**
   *              XEUtils.isMatch({ aa: 11, bb: 22 }, { bb: 22 })  // true
                  XEUtils.isMatch({ aa: 11, bb: 22 }, { bb: 33 })  // false
  
   */
  var keys = require('./keys')
  var findIndexOf = require('./findIndexOf')
  var isEqual = require('./isEqual')
  
  var some = require('./some')
  var includeArrays = require('./includeArrays')
  
  /**
   * 判断属性中的键和值是否包含在对象中
   *
   * @param {Object/Array} obj 对象
   * @param {Object} source 值
   * @return {Boolean}
   */
  function isMatch (obj, source) {
    var objKeys = keys(obj)
    var sourceKeys = keys(source)
    if (sourceKeys.length) {
      if (includeArrays(objKeys, sourceKeys)) {
        return some(sourceKeys, function (key2) {
          return findIndexOf(objKeys, function (key1) {
            return key1 === key2 && isEqual(obj[key1], source[key2])
          }) > -1
        })
      }
    } else {
      return true
    }
    return isEqual(obj, source)
  }
  
  module.exports = isMatch
  