function/negate.jsjavascript
/**
 * 创建返回 predicate 结果相反值的函数。
 * @function negate
 * @memberof module:function
 * @param {Function} predicate 判断函数
 * @returns {Function} 取反后的函数
 * @throws {TypeError} predicate 不是函数时抛出
 */
function negate(predicate) {
  if (typeof predicate !== 'function') throw new TypeError('predicate must be a function')
  return function (...args) {
    return !predicate.apply(this, args)
  }
}

export default negate