本文整理汇总了TypeScript中angular2/src/core/facade/collection.ListWrapper.map方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ListWrapper.map方法的具体用法?TypeScript ListWrapper.map怎么用?TypeScript ListWrapper.map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/src/core/facade/collection.ListWrapper
的用法示例。
在下文中一共展示了ListWrapper.map方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: array
array(controlsConfig: any[], validator: Function = null): modelModule.ControlArray {
var controls = ListWrapper.map(controlsConfig, (c) => this._createControl(c));
if (isPresent(validator)) {
return new modelModule.ControlArray(controls, validator);
} else {
return new modelModule.ControlArray(controls);
}
}
示例2: _replaceIndices
function _replaceIndices(r: ProtoRecord, selfIndex: number, indexMap: Map<any, any>) {
var args = ListWrapper.map(r.args, (a) => _map(indexMap, a));
var contextIndex = _map(indexMap, r.contextIndex);
return new ProtoRecord(r.mode, r.name, r.funcOrValue, args, r.fixedArgs, contextIndex,
r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding,
r.lastInDirective, r.argumentToPureFunction, r.referencedBySelf,
r.propertyBindingIndex);
}
示例3: _getElementId
function _getElementId(element): number[] {
var elId = DOM.getData(element, NG_ID_PROPERTY);
if (isPresent(elId)) {
return ListWrapper.map(elId.split(NG_ID_SEPARATOR),
(partStr) => NumberWrapper.parseInt(partStr, 10));
} else {
return null;
}
}
示例4: constructResolvingPath
function constructResolvingPath(keys: any[]): string {
if (keys.length > 1) {
var reversed = findFirstClosedCycle(ListWrapper.reversed(keys));
var tokenStrs = ListWrapper.map(reversed, (k) => stringify(k.token));
return " (" + tokenStrs.join(' -> ') + ")";
} else {
return "";
}
}
示例5: _genMessage
private static _genMessage(typeOrFunc, params: any[][]) {
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(' '));
}
}
return "Cannot resolve all parameters for " + stringify(typeOrFunc) + "(" +
signature.join(', ') + "). " + 'Make sure they all have valid type or annotations.';
}
示例6: execute
/**
* Returns the value of the executed function.
*/
execute(injector: Injector): any {
var params = ListWrapper.map(this._tokens, (t) => injector.get(t));
return FunctionWrapper.apply(this._fn, params);
}
示例7: _mapPrimitiveName
function _mapPrimitiveName(keys: any[]) {
var stringifiedKeys =
ListWrapper.join(ListWrapper.map(keys, (k) => isString(k) ? `"${k}"` : `${k}`), ", ");
return `mapFn([${stringifiedKeys}])`;
}
示例8: _genEvalValue
private _genEvalValue(protoRec: ProtoRecord, getLocalName: Function,
localsAccessor: string): string {
var context = (protoRec.contextIndex == -1) ?
this._names.getDirectiveName(protoRec.directiveIndex) :
getLocalName(protoRec.contextIndex);
var argString = ListWrapper.map(protoRec.args, (arg) => getLocalName(arg)).join(", ");
var rhs: string;
switch (protoRec.mode) {
case RecordType.Self:
rhs = context;
break;
case RecordType.Const:
rhs = codify(protoRec.funcOrValue);
break;
case RecordType.PropertyRead:
rhs = this._observe(`${context}.${protoRec.name}`, protoRec);
break;
case RecordType.SafeProperty:
var read = this._observe(`${context}.${protoRec.name}`, protoRec);
rhs =
`${this._utilName}.isValueBlank(${context}) ? null : ${this._observe(read, protoRec)}`;
break;
case RecordType.PropertyWrite:
rhs = `${context}.${protoRec.name} = ${getLocalName(protoRec.args[0])}`;
break;
case RecordType.Local:
rhs = this._observe(`${localsAccessor}.get(${rawString(protoRec.name)})`, protoRec);
break;
case RecordType.InvokeMethod:
rhs = this._observe(`${context}.${protoRec.name}(${argString})`, protoRec);
break;
case RecordType.SafeMethodInvoke:
var invoke = `${context}.${protoRec.name}(${argString})`;
rhs =
`${this._utilName}.isValueBlank(${context}) ? null : ${this._observe(invoke, protoRec)}`;
break;
case RecordType.InvokeClosure:
rhs = `${context}(${argString})`;
break;
case RecordType.PrimitiveOp:
rhs = `${this._utilName}.${protoRec.name}(${argString})`;
break;
case RecordType.CollectionLiteral:
rhs = `${this._utilName}.${protoRec.name}(${argString})`;
break;
case RecordType.Interpolate:
rhs = this._genInterpolation(protoRec);
break;
case RecordType.KeyedRead:
rhs = this._observe(`${context}[${getLocalName(protoRec.args[0])}]`, protoRec);
break;
case RecordType.KeyedWrite:
rhs = `${context}[${getLocalName(protoRec.args[0])}] = ${getLocalName(protoRec.args[1])}`;
break;
case RecordType.Chain:
rhs = 'null';
break;
default:
throw new BaseException(`Unknown operation ${protoRec.mode}`);
}
return `${getLocalName(protoRec.selfIndex)} = ${rhs};`;
}