本文整理汇总了TypeScript中Immutable.Map.remove方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Map.remove方法的具体用法?TypeScript Map.remove怎么用?TypeScript Map.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Immutable.Map
的用法示例。
在下文中一共展示了Map.remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: removeNode
removeNode(node: any) {
var nodesAll = this.nodes.filter(n => n !== node).toList();
var parentsAll: Map<number, List<Node>> = this.parents;
var childrenAll: Map<number, List<Node>> = this.children;
var parents = parentsAll.get(node.id);
parents.forEach((parent) => {
var children = childrenAll.get(parent.id);
children = children.filter((child) => child !== node).toList();
childrenAll = childrenAll.set(parent.id, children);
});
parentsAll = parentsAll.set(node.id, List<any>());
var children = childrenAll.get(node.id);
children.forEach((child) => {
var parents = parentsAll.get(child.id);
parents = parents.filter((ancestor) => ancestor !== node).toList();
parentsAll = parentsAll.set(child.id, parents);
});
childrenAll = childrenAll.remove(node.id);
return new Graph(nodesAll, childrenAll, parentsAll);
}