How to use the immutable.Iterable.isIterable 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 redux-form / redux-form / src / structure / immutable / __tests__ / expectations.js View on Github external
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
}
github redux-form / redux-form / src / structure / immutable / __tests__ / expectations.js View on Github external
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
}
github pubpub / pubpub / src / containers / Editor2 / Editor.jsx View on Github external
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 = [
github quiltdata / quilt / catalog / app / store.js View on Github external
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
github quiltdata / quilt / catalog / app / utils / Store.js View on Github external
const stateTransformer = (state) =>
          // pure JS is easier to read than Immutable objects
          Iterable.isIterable(state) ? state.toJS() : state
        // eslint-disable-next-line global-require
github LearningLocker / learninglocker / ui / src / containers / QueryBuilder / SavedQueries.js View on Github external
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);
};
github andrewdamelio / react-redux-boilerplate / src / utils / immutableToJS.js View on Github external
return Object.keys(state).reduce((newState, key) => {
    const val = state[key];
    newState[key] = Iterable.isIterable(val) ? val.toJS() : val;
    return newState;
  }, {});
}
github reduxjs / redux-devtools / packages / redux-devtools-inspector / src / tabs / getItemString.js View on Github external
function isImmutable(value) {
  return (
    Iterable.isKeyed(value) ||
    Iterable.isIndexed(value) ||
    Iterable.isIterable(value)
  );
}
github HubSpot / transmute / src / mapKeys.js View on Github external
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
  );
}