本文整理汇总了TypeScript中external/gs_tools/src/immutable.ImmutableMap.of方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ImmutableMap.of方法的具体用法?TypeScript ImmutableMap.of怎么用?TypeScript ImmutableMap.of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类external/gs_tools/src/immutable.ImmutableMap
的用法示例。
在下文中一共展示了ImmutableMap.of方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
export function providesRouteFactoryMap<T>(
routeFactories: Iterable<RouteFactory<T>>): RouteFactoryMap<T> {
return ImmutableMap.of(
ImmutableSet.of([...routeFactories])
.mapItem((factory: RouteFactory<T>) => {
return [factory.getType(), factory] as [T, RouteFactory<T>];
}));
}
示例2: addBundle
/**
* @param files The bundle of files to add.
* @return Object containing the bundle ID and a function to delete the bundle.
*/
addBundle(files: File[]): {deleteFn: () => void, id: string} {
const id = this.idGenerator_.generate([...ImmutableMap.of(this.bundles_).keys()]);
this.bundles_.set(id, files);
return {
deleteFn: function(this: FileService): void {
this.bundles_.delete(id);
}.bind(this),
id: id,
};
}
示例3: FakeRouteFactory
static create<T>(factoryMap: Iterable<[string, T]>): FakeRouteFactoryService<T> {
const factories = ImmutableMap.of([...factoryMap])
.map((type: T) => new FakeRouteFactory(type));
const service = new FakeRouteFactoryService(factories.values());
for (const [key] of factoryMap) {
service[key] = () => factories.get(key);
}
return service;
}
示例4: it
it(`should return null if none of the route factory maps produces any routes`, () => {
const path = 'path';
const mockFactory = jasmine.createSpyObj('Factory', ['createFromPath']);
mockFactory.createFromPath.and.returnValue(null);
const map = ImmutableMap.of([
[Mocks.object('view'), mockFactory],
]);
assert(providesMatch(path, map)).to.beNull();
assert(mockFactory.createFromPath).to.haveBeenCalledWith(path);
});
示例5: it
it('should return empty object', () => {
assert(factory['getRelativeMatchParams_'](ImmutableMap.of<string, string>([]))).to.equal({});
});