本文整理汇总了TypeScript中underscore.filter函数的典型用法代码示例。如果您正苦于以下问题:TypeScript filter函数的具体用法?TypeScript filter怎么用?TypeScript filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filter函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
return this.getFilteredHistory(pubkey, (res:any) => {
const histo = res.history;
histo.sent = _.filter(histo.sent, function(tx:any){ return tx && tx.block_number >= from && tx.block_number <= to; });
histo.received = _.filter(histo.received, function(tx:any){ return tx && tx.block_number >= from && tx.block_number <= to; });
_.extend(histo, { sending: [], receiving: [] });
return res;
});
开发者ID:duniter,项目名称:duniter,代码行数:7,代码来源:transactions.ts
示例2: UpdateBusVisitItem
UpdateBusVisitItem(model) {
//var lookupResponse = JSON.parse(localStorage.getItem('lookupResponse'));
//debugger;
//var centre = _.filter(lookupResponse.alkhidmatCentre, (p) => { return p.id == model.get("centreId"); });
var selectedCentre = this.paymentView.viewModel.alkhidmatCentreList();
var selectedDriver = this.paymentView.viewModel.driverList();
var selectedBus = this.paymentView.viewModel.busList();
var centre = _.filter(selectedCentre, (p) => { return p.id == model.get("centreId"); });
var driver = _.filter(selectedDriver, (p) => { return p.id == model.get("driverId"); });
//var a = this.paymentView.viewModel.alkhidmatCentreSelected().id;
this.paymentView.viewModel.fuelAmount(model.get("fuelAmount"));
this.paymentView.viewModel.busChangeReason(model.get("busChangeReason"));
this.paymentView.viewModel.driverSelected(driver[0]);
this.paymentView.viewModel.alkhidmatCentreSelected(centre[0]);
//setTimeout(() => {
// this.paymentView.viewModel.busSelected(bus[0]);
//}, 1000);
var currentView = this.paymentView.$el;
currentView.find("#ddlCentre").prop("disabled", true);
currentView.find("#ddlBusDetails").prop("disabled", true);
currentView.find("#lnkAdd").hide();
currentView.find("#lnkUpdate").show();
//this.paymentView.viewModel.alkhidmatCentreSelected(this.paymentView.viewModel.alkhidmatCentreList()[3]);
}
开发者ID:saeed-ahmed,项目名称:CCTracking,代码行数:27,代码来源:PaymentCtrl.ts
示例3: nodeEach
export function nodeEach(
node: TreeNode,
run: (n: TreeNode, p?: TreeNode, level?: number) => boolean,
p = void 0,
level = 1
): boolean {
if (run(node, p, level)) {
return true;
}
for (const c of filter(node.children, (n: TreeNode) => n.nt > NodeType.DEFAULT)) {
if (nodeEach(c, run, node, level)) {
return true;
}
}
for (const c of filter(node.children, (n: TreeNode) => n.nt === NodeType.DEFAULT && n.gender)) {
if (nodeEach(c, run, node, level + 1)) {
return true;
}
}
for (const c of filter(node.children, (n: TreeNode) => n.nt === NodeType.DEFAULT && !n.gender)) {
if (nodeEach(c, run, node, level + 1)) {
return true;
}
}
return false;
}
开发者ID:xuender,项目名称:family,代码行数:26,代码来源:tree-node.ts
示例4: clusterEnrichment
export function clusterEnrichment(enrichmentGroup: Gene[],
enrichmentCluster: number): number[]
{
/**
* In Enrichment Group Not in Enrichment Group
* In Gene Cluster n11 n12
* Not In Gene Cluster n21 n22
*/
let n11 = _.filter(enrichmentGroup, (gene: Gene) => {
return gene.cluster === enrichmentCluster;
}).length,
n21 = _.filter(enrichmentGroup, (gene: Gene) => {
return gene.cluster !== enrichmentCluster;
}).length,
n12 = ClusterTotals[enrichmentCluster-1],
n22 = 0;
ClusterTotals.forEach(function(val, index) {
if (index !== enrichmentCluster-1) n22 += val;
});
if (n11 === 0 || n21 === 0 || n12 === 0 || n22 === 0) {
n11 += 0.5;
n21 += 0.5;
n12 += 0.5;
n22 += 0.5;
}
return enrichment(n11, n12, n21, n22);
}
开发者ID:delosh653,项目名称:SemNExT-Visualizations,代码行数:27,代码来源:analysis.ts
示例5: function
this.us.getUsers().subscribe(users => {
let participants: number [] = [0, 0, 0, 0];
participants[0] = _.size(_.filter(users, function(user){ return +user.job === 1; }));
participants[1] = _.size(_.filter(users, function(user){ return +user.job === 2; }));
participants[2] = _.size(_.filter(users, function(user){ return +user.job === 3; }));
participants[3] = _.size(_.filter(users, function(user){ return +user.job === 4; }));
this.chart.data = participants;
});
开发者ID:achillesimo,项目名称:sondage,代码行数:9,代码来源:doughnut.component.ts
示例6: GetByIdCompleted
GetByIdCompleted(bookingResponse: dto.Models.BookingResponse) {
var lookupResponse = JSON.parse(localStorage.getItem('lookupResponse'));
var model = new Backbone.Model(bookingResponse["bookingModel"]);
model.set("causeOfDeathList", lookupResponse.causeOfDeath);
model.set("landmarkList", lookupResponse.landmark);
model.set("busPointList", lookupResponse.landmark);
model.set("unionCouncilList", lookupResponse.unionCouncil);
model.set("townList", lookupResponse.town);
model.set("graveyardList", lookupResponse.graveyard);
model.set("busDetailsList", lookupResponse.bus);
model.set("pickupTimeSlotList", lookupResponse.timeSlot);
model.set("returnTimeSlotList", lookupResponse.timeSlot);
model.set("prayersList", lookupResponse.prayers);
var causeOfDeath = _.filter(lookupResponse.causeOfDeath, (p) => { return p.id == model.get("causeOfDeath") });
var landmark = _.filter(lookupResponse.landmark, (p) => { return p.id == model.get("landmarkId") });
var busPoint = _.filter(lookupResponse.landmark, (p) => { return p.id == model.get("busPoint") });
var unionCouncil = _.filter(lookupResponse.unionCouncil, (p) => { return p.id == model.get("unionCouncilId") });
var town = _.filter(lookupResponse.town, (p) => { return p.id == model.get("townId") });
var graveyard = _.filter(lookupResponse.graveyard, (p) => { return p.id == model.get("graveyardId") });
var busDetail = _.filter(lookupResponse.bus, (p) => { return p.id == model.get("busDetailId") });
var pickupTime = _.filter(lookupResponse.timeSlot, (p) => { return p.id == model.get("pickupTime") });
var returnTime = _.filter(lookupResponse.timeSlot, (p) => { return p.id == model.get("returnTime") });
var prayer = _.filter(lookupResponse.prayers, (p) => { return p.id == model.get("namazEJanazaHeldIn") });
model.set("causeOfDeathSelected", causeOfDeath[0]);//model.get("causeOfDeath")
//model.set("landmarkIdSelected", landmark[0]);
model.set("busPointSelected", busPoint[0]);
model.set("unionCouncilIdSelected", unionCouncil[0]);
model.set("townIdSelected", town[0]);
model.set("graveyardIdSelected", graveyard[0]);
model.set("busDetailIdSelected", busDetail[0]);
model.set("deseasedGender", model.get("deseasedGender").toString());
model.set("pickupTimeSlotSelected", pickupTime[0]);
model.set("returnTimeSlotSelected", returnTime[0]);
model.set("prayersSelected", prayer[0]);
model.set("pickupDate", helper.FormatDateString(model.get("pickupDate")));
this.bookingViewModel = new views.BookingViewModel(model, this);
this.bookingView = new views.BookingView({ viewModel: this.bookingViewModel });
this.layout = app.AppLayout;
app.MainRegion.show(this.bookingView);
}
开发者ID:kashifjawed,项目名称:CCTracking,代码行数:50,代码来源:BookingCtrl.ts
示例7: getUserById
public getUserById(id: string): User {
return _.filter( Users.USERS, function (u) {
return u.id === id;
})[0];
}
开发者ID:achillesimo,项目名称:sondage,代码行数:7,代码来源:users.service.ts
示例8: checkDod
checkDod() {
if (this.node.dead) {
if (this.node.dod) {
const dod = new Date(this.node.dod);
if (this.node.dob) {
const dob = new Date(this.node.dob);
if (dob > dod) {
this.unknown.push('忌日小于生日');
this.portion(UnknownType.ERROR_DOD);
}
}
if (this.node.children) {
const olds: string[] = [];
for (const o of filter(this.node.children, (c: TreeNode) => c.nt === NodeType.DEFAULT && new Date(c.dob) > dod)){
olds.push(o.name);
}
if (olds.length > 0) {
this.unknown.push(`忌日早于子女生日: ${olds.join(', ')}`);
this.portion(UnknownType.ERROR_DOD);
}
}
} else {
this.unknown.push('忌日未知');
this.portion(UnknownType.NO_DOD);
}
}
}
开发者ID:xuender,项目名称:family,代码行数:27,代码来源:unknown.ts
示例9: isTextPresentInFolder
function isTextPresentInFolder(searchContext: ISearchContext, folder: IFolder): IFolder {
const isTextPresentInTitle = !folder.isRoot && !_.any(searchContext.tags) &&
isTextPresent(searchContext, splitWords(folder.name));
const features = _.filter(_.map(folder.features, f => isTextPresentInFeature(searchContext, f)), f => !!f);
const folders = _.filter(_.map(folder.children, f => isTextPresentInFolder(searchContext, f)), f => !!f);
if (!isTextPresentInTitle && !_.any(features) && !_.any(folders)) {
return null;
}
return {
children: folders,
features: features,
isRoot: folder.isRoot,
name: folder.name
};
}
开发者ID:eugene-sea,项目名称:LivingDocumentation,代码行数:16,代码来源:search.service.ts
示例10: constructor
constructor(
public params: NavParams,
public viewCtrl: ViewController,
public modalCtrl: ModalController,
private alertController: AlertController,
private backService: BackService
) {
this.node = this.params.get('node');
this.title = this.params.get('title');
this.noClose = this.params.get('noClose');
this.others = [];
if (this.node.nt === NodeType.DEFAULT) { // 子女才需要设置父母
const tree = this.params.get('tree');
if (tree) {
const old = this.params.get('old');
this.setParent(tree.root, old);
if (this.parentNode) {
this.otherTitle = this.parentNode.gender ? '母亲' : '父亲';
for (const c of filter(this.parentNode.children, (c) => c.nt > NodeType.DEFAULT)) {
this.others.push(c.name);
}
}
}
}
this.backService.trackView('NodeModal');
}
开发者ID:xuender,项目名称:family,代码行数:26,代码来源:node-modal.ts
注:本文中的underscore.filter函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论