本文整理汇总了TypeScript中angular2/src/facade/collection.ListWrapper.map方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ListWrapper.map方法的具体用法?TypeScript ListWrapper.map怎么用?TypeScript ListWrapper.map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/src/facade/collection.ListWrapper
的用法示例。
在下文中一共展示了ListWrapper.map方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructResolvingPath
function constructResolvingPath(keys) {
if (keys.length > 1) {
var reversed = findFirstClosedCycle(ListWrapper.reversed(keys));
var tokenStrs = ListWrapper.map(reversed, (k) => stringify(k.token));
return " (" + tokenStrs.join(' -> ') + ")";
} else {
return "";
}
}
示例2: genPipeOnDestroy
/**
* Generates statements destroying all pipe variables.
*/
genPipeOnDestroy(): string {
return ListWrapper.join(
ListWrapper.map(
ListWrapper.filter(this.records, (r) => { return r.isPipeRecord(); }),
(r) => {
return `${this.utilName}.callPipeOnDestroy(${this.getPipeName(r.selfIndex)});`;
}),
'\n');
}
示例3: _getElementId
function _getElementId(element): List<number> {
var elId = DOM.getData(element, NG_ID_PROPERTY);
if (isPresent(elId)) {
return ListWrapper.map(StringWrapper.split(elId, NG_ID_SEPARATOR_RE),
(partStr) => NumberWrapper.parseInt(partStr, 10));
} else {
return null;
}
}
示例4: keyValues
function keyValues(templateBindings) {
return ListWrapper.map(templateBindings, (binding) => {
if (binding.keyIsVar) {
return '#' + binding.key + (isBlank(binding.name) ? '' : '=' + binding.name);
} else {
return binding.key + (isBlank(binding.expression) ? '' : `=${binding.expression}`);
}
});
}
示例5: _resolveDependencies
_resolveDependencies(key: Key, binding: ResolvedBinding, forceAsync: boolean): List<any> {
try {
var getDependency = d => this._getByKey(d.key, forceAsync || d.asPromise, d.lazy, d.optional);
return ListWrapper.map(binding.dependencies, getDependency);
} catch (e) {
this._clear(key);
if (e instanceof AbstractBindingError) e.addKey(key);
throw e;
}
}
示例6: _resolveDependencies
_resolveDependencies(key, binding, forceAsync) {
try {
var getDependency = (d) => this._getByKey(d.key, forceAsync || d.asPromise, d.lazy, d.optional);
return ListWrapper.map(binding.dependencies, getDependency);
} catch (e) {
this._clear(key);
if (e instanceof ProviderError)
e.addKey(key);
throw e;
}
}
示例7:
this._printStringRow(ListWrapper.map(this._metricNames, (metricName) => {
var sample =
ListWrapper.map(validSample, (measureValues) => measureValues.values[metricName]);
var mean = Statistic.calculateMean(sample);
var cv = Statistic.calculateCoefficientOfVariation(sample, mean);
var formattedMean = ConsoleReporter._formatNum(mean)
// Note: Don't use the unicode character for +- as it might cause
// hickups for consoles...
return NumberWrapper.isNaN(cv) ?
formattedMean :
`${formattedMean}+-${Math.floor(cv)}%`;
}));
示例8: BaseException
result = this.renderer.compile(template).then((pv) => {
var childComponentPromises = ListWrapper.map(this._findNestedComponentIds(template, pv), (componentId) => {
var childTemplate = MapWrapper.get(this._templates, componentId);
if (isBlank(childTemplate)) {
throw new BaseException(`Could not find template for ${componentId}!`);
}
return this._compileRecurse(childTemplate);
});
return PromiseWrapper.all(childComponentPromises).then((protoViewRefsWithChildren) => {
var protoViewRefs = ListWrapper.map(protoViewRefsWithChildren, (arr) => arr[0]);
return this._flattenList([this.renderer.mergeChildComponentProtoViews(pv.render, protoViewRefs), protoViewRefsWithChildren]);
});
});
示例9: constructor
constructor(typeOrFunc, params: List<List<any>>) {
super();
var signature = [];
for (var i = 0, ii = params.length; i < ii; i++) {
var parameter = params[i];
if (isBlank(parameter) || parameter.length == 0) {
signature.push('?');
} else {
signature.push(ListWrapper.map(parameter, stringify).join(' '));
}
}
this.message = "Cannot resolve all parameters for " + stringify(typeOrFunc) + "(" +
signature.join(', ') + "). " +
'Make sure they all have valid type or annotations.';
}
示例10: commit
/**
*
*/
commit(instruction: Instruction): Promise<List<any>> {
this._currentInstruction = instruction;
// collect all outlets that do not have a corresponding child instruction
// and remove them from the internal map of child outlets
var toDeactivate = ListWrapper.create();
MapWrapper.forEach(this._outlets, (outlet, outletName) => {
if (!instruction.hasChild(outletName)) {
MapWrapper.delete(this._outlets, outletName);
ListWrapper.push(toDeactivate, outlet);
}
});
return PromiseWrapper.all(ListWrapper.map(toDeactivate, (outlet) => outlet.deactivate()))
.then((_) => this.activate(instruction));
}