JSFiddle - React, Tailwind, and code Playground

by Adam Boduch

HTML

<script src="https://cdn.jsdelivr.net/immutable.js/3.6.4/immutable.min.js"></script>

JavaScript

const list = Immutable.fromJS([
	{ a: '1a', c: '2a', d: '3a' },
  { a: '1b', c: '2b', d: '3b' },
]);

const mapped = list.map(i => i.set('e', 4));
const filtered = mapped
	.filter(i => i.get('d') === '3a')
	.map(i => i.set('d', 5));
const result = mapped.merge(filtered);

console.log(result.toJS());