- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我有一个具有这种结构的 map :
{
1: {},
2: {}
}
我想从中删除 2: {}(当然 - 返回没有这个的新集合)。我该怎么做?我试过了,但出了点问题:
theFormerMap.deleteIn([],2) //[] should mean that it's right in the root of the map, and 2 is the name of the object I want to get rid of
最佳答案
只需使用delete方法和双引号中的属性:
theFormerMap = theFormerMap.delete("2")
关于javascript - ImmutableJS - 从 map 中删除元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31128425/
我正在探索这两个库,对我来说 ImmutableJS具有(主要)不可变的数据结构,而 Ramda有瑞士军刀套装FP实用程序。 当我谷歌时,我看到类似 Ramda 的文章对比 ImmutableJS推荐
在原始 JS 对象上使用 Immutable.fromJS() 可以按预期工作并返回一个 Map,但尝试使用相同的 Immutable.fromJS()从构造函数获取的自定义对象不起作用。 含义: {
我导入了一条不可变记录,并希望在将其用作应用程序的默认状态之前向其中添加一个新属性。但是,尽管尝试了 merge、mergeDeep、mergeWith 和 mergeDeepWith,但我根本无法添
我正在设置这样的 map : import { Map } from 'immutable'; const initialState = { a: "test", b: { ins
我有这个不可变映射,我需要获取属性名称: 如果我这样做 retrospective.get('users') 我可以进入用户内部,但是如果我这样做 retrospective.getIn(['user
我正在研究 Immutable.js 代码,发现了一些奇怪的东西。Immutable.js 会跳过保存到不会使用的变量的代码吗? const Immutable = require('immutabl
是否可以使用 immutablejs像这样: 模态 class PeriodModel { constructor( id, title, ) {
我的 reducer 中最初有以下不可变状态: const firstState = Map({ "1": {title: "Hello 1", content: "Content 1"}, "2"
我有以下代码: Immutable.Set(['valor1', 'valor2', 'valor2', 'valor3', ['valor4', 'valor5']]).flatten().toJS
我有这个矩阵: const initialState = Immutable.fromJS({ board: [ ['','',''], ['','',''
const List = Immutable.List; const items = [ { id: 1, subList: [] }, { id: 2, subList: [] }, {
我有这个 immutableJs map : event: { days: [ { date: 1, sessions: [
我有一个这样的 map (在 ImmutableJS 中): {arrayOfValues: [ {one: {inside: 'first in array'}}, {one: {insid
我正在学习使用 ImmutableJS,但我有点困惑。我查看了文档,发现有对象的映射和数组的列表。 所以我构建了一个像这样的对象: sampleTodo = Immutable.Map({text:
如果我有一个像这样的对象: var fruitList = Immutable.map ({ fruits: [apples, oranges, mangoes]}); 如何在保持不变性的同时删除数组
我正在使用 ImmutableJS与 Redux和 redux-immutable .假设我有一个初始状态,它是一个空的项目数组: const initialState = fromJS({ it
我有以下格式的数据:action.places。 我只想将其与传入的新数据结合起来,并返回更新地点的新 map 。如果我得到一个地点对象,并且其中一个地点与前一个地点具有相同的纬度/经度,我不想附加该
我很难理解 immutablejs 的文档。我想更新名为 Sanskar 的列表。为此,我首先尝试使用 findIndex 来查找其索引并使用 update() 更新它。但我收到 item.get()
我在不可变的js中有一个像这样的结构的 map : myMap = { a: { b: { c: [ { d: "som
如果我使用 Immutable.js,react-redux 仍然可以使用 shouldComponentUpdate 吗? connect()方法在shouldComponentUpdate()中使
我是一名优秀的程序员,十分优秀!