Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const deepEqualValues = (a: any, b: any) => {
if (Iterable.isIterable(a)) {
return (
Iterable.isIterable(b) &&
a.count() === b.count() &&
a.every((value, key) => deepEqualValues(value, b.get(key)))
)
}
return deepEqual(a, b) // neither are immutable collections
}
const deepEqualValues = (a: any, b: any) => {
if (Iterable.isIterable(a)) {
return (
Iterable.isIterable(b) &&
a.count() === b.count() &&
a.every((value, key) => deepEqualValues(value, b.get(key)))
)
}
return deepEqual(a, b) // neither are immutable collections
}
render: function() {
const editorData = this.props.editorData;
const viewMode = this.props.editorData.get('viewMode');
const isReader = this.props.editorData.getIn(['pubEditData', 'isReader']);
// const showBottomLeftMenu = this.props.editorData.get('showBottomLeftMenu');
// const showBottomRightMenu = this.props.editorData.get('showBottomRightMenu');
const loadStatus = this.props.editorData.get('status');
const darkMode = this.props.loginData.getIn(['userData', 'settings', 'editorColor']) === 'dark';
const isLivePreview = (Iterable.isIterable(this.props.editorData)) ? (this.props.editorData.get('viewMode') === 'preview') : false;
const referencesList = [];
for ( const key in this.state.firepadData.references ) {
if (this.state.firepadData.references.hasOwnProperty(key)) {
referencesList.push(this.state.firepadData.references[key]);
}
}
// Set metadata for the page.
const metaData = {
title: 'Edit - ' + this.props.editorData.getIn(['pubEditData', 'title'])
};
const editorMenuItems = [
const stateTransformer = (state) => (
// pure JS is easier to read than Immutable objects
Iterable.isIterable(state) ? state.toJS() : state
);
const { createLogger } = require('redux-logger'); // eslint-disable-line global-require
const stateTransformer = (state) =>
// pure JS is easier to read than Immutable objects
Iterable.isIterable(state) ? state.toJS() : state
// eslint-disable-next-line global-require
const toJS = o => (Iterable.isIterable(o) ? o.toJS() : o)
const getConditions = (query) => {
if (!query) return new Map();
const conditions = query.get('conditions', new Map());
try {
if (isString(conditions)) return fromJS(JSON.parse(conditions));
} catch (err) {
return new Map();
}
return Iterable.isIterable(conditions)
? conditions
: fromJS(conditions);
};
return Object.keys(state).reduce((newState, key) => {
const val = state[key];
newState[key] = Iterable.isIterable(val) ? val.toJS() : val;
return newState;
}, {});
}
function isImmutable(value) {
return (
Iterable.isKeyed(value) ||
Iterable.isIndexed(value) ||
Iterable.isIterable(value)
);
}
function mapKeys(keyMapper, subject) {
const isIterable = Iterable.isIterable(subject);
if (
(isIterable && !Iterable.isKeyed(subject)) ||
(!isIterable && subject.constructor !== Object)
) {
throw new Error(
`expected an Object or other Keyed Collection but got \`${subject}\``
);
}
return _reduce(
clear(subject),
(acc, value, key) => _set(keyMapper(key, value, subject), value, acc),
subject
);
}