删除键

可以使用Map.deleteMap.deleteIn方法从Maps中删除键。

  1. let movie = Immutable.fromJS({
  2. name: 'Star Wars',
  3. episode: 7,
  4. actors: [
  5. { name: 'Daisy Ridley', character: 'Rey'},
  6. { name: 'Harrison Ford', character: 'Han Solo' }
  7. ],
  8. mpaa: {
  9. rating: 'PG-13',
  10. reason: 'sci-fi action violence'
  11. }
  12. });
  13. movie = movie.delete('mpaa');
  14. console.log(movie.toObject());
  15. /* writes
  16. { name: 'Star Wars',
  17. episode: 7,
  18. actors: List [ Map { "name": "Daisy Ridley", "character": "Rey" }, Map { "name": "Harrison Ford", "character": "Han Solo" } ] }
  19. */