本文整理汇总了TypeScript中lodash.isFunction函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isFunction函数的具体用法?TypeScript isFunction怎么用?TypeScript isFunction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isFunction函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: prepareConfig
prepareConfig (ns: string = '', defaultConfig: any = {}): any {
if (isFunction(defaultConfig)) {
defaultConfig = defaultConfig(this.app)
}
if (ns) {
return Object.assign(defaultConfig, this.app.config[ns], this.options)
} else {
return Object.assign(defaultConfig, this.options)
}
}
示例2: validate
static validate(filter, value): any {
if (!_.isFunction(filter)) {
throw new Error('The `filter` property must be set.');
}
if (_.isNil(value)) {
return value;
}
return filter(value);
}
示例3:
router.use(wsConfigs.API.GET_CLIENT_BEFOREUNLOAD, (req: express.Request, res: express.Response, next: express.NextFunction) => {
if (_.isFunction(this.onDriverEvent)) {
this.onDriverEvent("beforeunload", req);
this.onEventInvoker("beforeunload", req);
}
routesEvents.beforeUnload(req, res, next);
});
示例4: function
data: function(data:any){
if(output.data){
output.data += data.toString()
}else{
output.data = data.toString()
}
if(_.isFunction(options.events.log)){
var logs:string = data.toString().toLowerCase().trim();
options.events.log.call(output, logs);
}
},
示例5: simulateBeforeSend
function simulateBeforeSend(url: string, settings: any) {
const xhrMockInBeforeSend = {
setRequestHeader(key: string, value: string) {
_set(settings, ['headers', key], value);
}
};
if (isFunction(settings.beforeSend)) {
settings.beforeSend(xhrMockInBeforeSend, url);
}
}
示例6: handleCellSelect
private handleCellSelect(state:GigaState, action:ToggleCellSelectAction):GigaState {
if (_.isFunction(this.props.onCellClick)) {
if (!this.props.onCellClick(action.row, action.column))
return state; // will not emit state mutation event
else
return _.clone(state); // will emit state mutation event
} else
return state;
}
示例7: return
return (control: AbstractControl): ValidationErrors | null => {
// Check if all prerequisites matches.
if (!Object.keys(prerequisites).every((key) => {
return (control.parent && control.parent.get(key).value === prerequisites[key]);
})) {
return null;
}
const success = _.isFunction(condition) ? condition.call(condition, control.value) :
isEmptyInputValue(control.value);
return success ? {'required': true} : null;
};
示例8: Controller
export function Controller(strOrFunc) {
if (_.isString(strOrFunc)) {
return function (target) {
app.controller(strOrFunc, target);
}
} else if (_.isFunction(strOrFunc)) {
app.controller(strOrFunc.name, strOrFunc);
} else {
throw Error("@Controller 必须标注在 function or Class");
}
}
示例9:
.forEach(key => {
const v = mapping;
if (_.isUndefined(v) || _.isFunction(v)) {
throw `
Class: '${target.name}'
[ng2rest] Bad mapping value for path: ${key} , please use type: <string> or [<string>]
`;
}
});
示例10:
_.each(filters, (filter: any /* filters.IFilterWithCounts */): void => {
if (_.isFunction(filter.updateOptionCounts)) {
var otherFiltersApplied: IWrappedItem<TDataType>[] = _.filter(wrappedData, (item: IWrappedItem<TDataType>): boolean => {
// Omit the true or false of the current filter an
// only filter out items removed by other filters
var filterData: any = _.omit(item.filterData, filter.type); //*filterData
return _.every(_.values(filterData));
});
filter.updateOptionCounts(this.unwrapData(otherFiltersApplied));
}
});