Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
}
function returnSelfOrNewMap(obj) {
// returns obj if obj is an Immutable map, else returns a new Map
return Map.isMap(obj) ? obj : new Map()
}
it('should return an immutable map', () => {
const state = store.getInitialState();
return expect(Map.isMap(state)).to.be.true;
});
});
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')
})
it('should have an immutable initial state', () => {
expect(Map.isMap(initialState)).toBe(true);
});
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;
},
/*
export const isOAS3 = (ori, system) => () => {
const spec = system.getSystem().specSelectors.specJson()
return isOAS3Helper(Map.isMap(spec) ? spec : Map())
}
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;
}
render() {
const { collections } = this.props;
return (
<div>
{Map.isMap(collections)
? this.renderCardsForSingleCollection()
: this.renderCardsForMultipleCollections()}
{this.hasMore() && }
</div>
);
}
}