本文整理汇总了TypeScript中sift.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: sift
export const get: Operation = (req, res) => {
const services = Service.all().map(service => {
const ret: any = service.export();
ret.hasLogoData = service.hasLogoData;
return ret;
});
api.responseJSON(res, sift(req.query, services));
};
示例2: getOrder
export const get: Operation = (req, res) => {
const services = Service.all().map(service => {
const ret: any = service.export();
ret.hasLogoData = service.hasLogoData;
return ret;
});
services.sort((a: ServiceItem, b: ServiceItem) => getOrder(a) - getOrder(b));
api.responseJSON(res, sift(req.query, services));
};
示例3: loadItem
async loadItem(query: any): Promise<T|undefined> {
const test = sift(query) as any;
const loaded = this.find((model) => test(model.source));
if (loaded) return loaded;
const { value, done } = await readOneChunk<any>(this._bus.dispatch(new DSFindRequest(this.collectionName, query, false)));
// item exists, so add and return it. Otherwise return undefined indicating
// that the item does not exist.
if (value) {
const item = this.createActiveRecord(value);
this.push(item);
return item;
}
}
示例4: sift
export const get: Operation = (req, res) => {
const channels = Channel.all().map(channel => {
const ch: any = channel.export();
ch.services = channel.getServices().map(service => ({
id: service.id,
serviceId: service.serviceId,
networkId: service.networkId,
name: service.name
}));
return ch;
});
api.responseJSON(res, sift(req.query, channels));
};
示例5: FilterBus
this._globalMessageObserver = new FilterBus((message: PostDSMessage) => {
return (message.type === DSUpdateRequest.DS_UPDATE || message.type === DSInsertRequest.DS_INSERT || message.type === PostDSMessage.DS_DID_UPDATE || message.type === PostDSMessage.DS_DID_INSERT) && message.collectionName === this.collectionName && sift(this.query)(message.data);
}, new CallbackBus(this.onPostDSMessage.bind(this)));