How to use the immutable.Map.isMap function in immutable

To help you get started, we’ve selected a few immutable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PacktPublishing / Building-Enterprise-JavaScript-Applications / Chapter10 / hobnob / docs / src / core / plugins / spec / selectors.js View on Github external
const mergerFn = (oldVal, newVal) => {
  if(Map.isMap(oldVal) && Map.isMap(newVal)) {
    if(newVal.get("$$ref")) {
      // resolver artifacts indicated that this key was directly resolved
      // so we should drop the old value entirely
      return newVal
    }

    return OrderedMap().mergeWith(
      mergerFn,
      oldVal,
      newVal
    )
  }

  return newVal
}
github OpenLiberty / open-liberty / dev / com.ibm.ws.openapi.ui / swagger-ui / src / core / plugins / spec / selectors.js View on Github external
function returnSelfOrNewMap(obj) {
  // returns obj if obj is an Immutable map, else returns a new Map
  return Map.isMap(obj) ? obj : new Map()
}
github nitrogenlabs / arkhamjs / test / Store.spec.js View on Github external
it('should return an immutable map', () => {
      const state = store.getInitialState();
      return expect(Map.isMap(state)).to.be.true;
    });
  });
github kitten / extendable-immutable / test / extendable.spec.js View on Github external
it('yields another custom Extendable.Map on operations', () => {
    const obj = new Item()
      .set('a', 'a')

    expect(ImmutableMap.isMap(obj)).toBeTruthy()
    expect(Map.isMap(obj)).toBeTruthy()
    expect(obj.get('a')).toBe('a')
  })
github projectSHAI / GOATstack / client / store / time-of-day / time-of-day.reducer.spec.ts View on Github external
it('should have an immutable initial state', () => {
    expect(Map.isMap(initialState)).toBe(true);
  });
github OpusCapita / react-grid / src / datagrid / datagrid.utils.js View on Github external
normalizeFilteringData: (filteringData) => {
    let newFilteringData = Map({ isFiltering: false });
    if (!filteringData) return newFilteringData;

    const oldFilteringData = Map.isMap(filteringData) ? filteringData : fromJS(filteringData);
    const isFiltering = oldFilteringData.get('isFiltering', false);
    const filterData = oldFilteringData.get('filterData', null);

    if (isFiltering && filterData && Map.isMap(filterData)) {
      newFilteringData = newFilteringData.set('isFiltering', true).set('filterData', filterData);
    }

    return newFilteringData;
  },
  /*
github OpenLiberty / open-liberty / dev / com.ibm.ws.openapi.ui / swagger-ui / src / core / plugins / oas3 / spec-extensions / wrap-selectors.js View on Github external
export const isOAS3 = (ori, system) => () => {
  const spec = system.getSystem().specSelectors.specJson()
  return isOAS3Helper(Map.isMap(spec) ? spec : Map())
}
github Talend / ui / packages / containers / src / List / selector.js View on Github external
function contains(listItem, query, columns) {
	let item = listItem;
	if (Map.isMap(listItem)) {
		item = listItem.toJS();
	}
	for (const column of columns) {
		if (typeof item[column.key] === 'string') {
			if (item[column.key].toLowerCase().indexOf(query.toLowerCase()) !== -1) {
				return true;
			}
		}
	}
	return false;
}
github netlify / netlify-cms / packages / netlify-cms-core / src / components / Collection / Entries / EntryListing.js View on Github external
render() {
    const { collections } = this.props;

    return (
      <div>
        
          {Map.isMap(collections)
            ? this.renderCardsForSingleCollection()
            : this.renderCardsForMultipleCollections()}
          {this.hasMore() &amp;&amp; }
        
      </div>
    );
  }
}