本文整理汇总了TypeScript中@phosphor/algorithm.filter函数的典型用法代码示例。如果您正苦于以下问题:TypeScript filter函数的具体用法?TypeScript filter怎么用?TypeScript filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filter函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: filterRows
filterRows(evalFn?: Function) {
const columns = this.columnManager.columns;
this.createFilterExpression();
if (!this.filterExpression) {
this.rows = toArray(this.rowsIterator.clone());
this.columnManager.dataGrid.resize();
return;
}
const formatFns = {};
formatFns[COLUMN_TYPES.index] = columns[COLUMN_TYPES.index].map(column => column.formatFn);
formatFns[COLUMN_TYPES.body] = columns[COLUMN_TYPES.body].map(column => column.formatFn);
try {
this.rows = toArray(filter(
this.rowsIterator.clone(),
(row) => evalFn ? evalFn(row, formatFns) : this.evaluateFilterExpression(row, formatFns)
));
this.sortedBy && this.sortByColumn(this.sortedBy);
this.columnManager.dataGrid.resize();
} catch (e) {}
}
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:25,代码来源:RowManager.ts
示例2: addMinMaxValues
addMinMaxValues() {
let stringMinMax;
let minMax;
let dataType = this.getDataType();
let displayType = this.getDisplayType();
let valuesIterator = this.dataGrid.model.getColumnValuesIterator(this);
let valueResolver = this.dataGrid.model.getColumnValueResolver(
displayType === ALL_TYPES.html ? displayType : dataType
);
if (dataType === ALL_TYPES.html || displayType === ALL_TYPES.html) {
this.resizeHTMLRows(valuesIterator);
} else if (dataType === ALL_TYPES.string || dataType === ALL_TYPES['formatted integer']) {
stringMinMax = minmax(valuesIterator, ColumnValuesIterator.longestString(valueResolver));
} else {
minMax = minmax(
filter(valuesIterator, (value) => !Number.isNaN(valueResolver(value))),
ColumnValuesIterator.minMax(valueResolver)
);
}
this.minValue = minMax ? minMax[0] : null;
this.maxValue = minMax ? minMax[1] : null;
if (stringMinMax) {
this.longestStringValue = stringMinMax[1];
}
}
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:28,代码来源:DataGridColumn.ts
示例3: outputViews
/**
* Iterate through all matching linked output views
*/
function* outputViews(app: JupyterFrontEnd, path: string) {
let linkedViews = filter(
app.shell.widgets(),
w => w.id.startsWith('LinkedOutputView-') && (w as any).path === path
);
for (let view of toArray(linkedViews)) {
for (let outputs of toArray(view.children())) {
for (let output of toArray(outputs.children())) {
if (output instanceof WidgetRenderer) {
yield output;
}
}
}
}
}
开发者ID:SylvainCorlay,项目名称:ipywidgets,代码行数:18,代码来源:plugin.ts
示例4: testIterator
testIterator(() => {
let expected = [0, 2, 4];
let data = [0, 1, 2, 3, 4, 5];
let it = filter(data, n => n % 2 === 0);
return [it, expected];
});
开发者ID:afshin,项目名称:phosphor,代码行数:6,代码来源:filter.spec.ts
注:本文中的@phosphor/algorithm.filter函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论