[Immutable,js] Iterating Over an Immutable.js Map()
2024-10-18 11:34:53
Immutable.js provides several methods to iterate over an Immutable.Map(). These also apply to the other immutable structures found within the Immutable.js family, such as Set and List. The primary methods are map and forEach, but we will also cover filter and groupBy.
// map()
return todos.map(todo => {
return todo.text
}); // filter()
return todos.filter(todo => {
return todo.completed;
}) // groupBy() --> return new Immtuable Map
return todos.groupBy(todo => {
return todo.completed
})
Notice, only forEach method will actually change its value!
// forEach()
function markAllTodosAsComplete(todos) {
return todos.forEach(todo => {
todo.completed = true
});
}
最新文章
- Android调用系统相机功能
- git一些常用的操作(转载)
- redis使用watch完成秒杀抢购功能(转)
- 2.AngularJS MVC
- top free综合监控工具
- Hive history date mapping
- spark mllib k-means算法实现
- Brush、Color、String相互转换
- PHP Cookie处理函数
- ZZTHX-注意点
- dedecms自定义函数(二次开发)
- win7 64 安装Oracle 11G 、使用PLSQL进行连接 标准实践
- hdu 素数环
- Android应用程序资源的查找过程分析
- 如何更快速加载你的JS页面
- leetcode day7
- C# 读取PDF多级书签
- BurpSuite使用笔记
- 磁盘挂载问题:Fdisk最大只能创建2T分区的盘,超过2T使用parted
- .Net Standard HttpClient封装Htt请求常用操作整理