本文整理匯總了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)));