ut2
Version:
一个现代 JavaScript 实用工具库。[点击查看在线文档]。
24 lines (23 loc) • 602 B
TypeScript
import { FunctionAny } from './internals/types';
/**
* 创建一个断言函数结果取反的函数。
*
* @alias module:Function.negate
* @since 1.0.0
* @param {function} predicate 需要对结果取反的函数。
* @returns 新的取反函数。
* @example
*
* function isEven(num){
* return num % 2 === 0;
* }
*
* const nums = [1,2,3,4,5];
* nums.filter(isEvent); // [2, 4]
*
* const ne = negate(isEvent);
* nums.filter(ne); // [1, 3, 5]
*
*/
declare function negate<T extends FunctionAny>(this: any, predicate: T): (...args: Parameters<T>) => boolean;
export default negate;