How to use the immutable.List.isList 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 EightShapes / contrast-grid / node_modules / browser-sync / lib / server / utils.js View on Github external
function getCa (options) {
    var caOption = options.getIn(["https", "ca"]);
    // if not provided, use Browsersync self-signed
    if (typeof caOption === "undefined") {
        return fs.readFileSync(join(__dirname, "certs", "server.csr"));
    }
    // if a string was given, read that file from disk
    if (typeof caOption === "string") {
        return fs.readFileSync(caOption);
    }
    // if an array was given, read all
    if (List.isList(caOption)) {
        return caOption.toArray().map(function (x) {
            return fs.readFileSync(x);
        });
    }
}
github invisible-college / democracy / tests / link.spec.js View on Github external
demo.link('TestLibrary', 'test', 'account0', 'linkLib').then((output) => {
      assert(Map.isMap(output), "Linking should produce a map")
      const output2 = demo.getLink(networkId, "TestLibrary-linkLib")
      assert(List.isList(output.get('abi')))
      assert(List.isList(output2.get('abi')))
      assert(output2.equals(output), 'Link output should equal the map read from link file.')
      done()
    }).catch((error) => {
      assert.fail(error)
github nick121212 / fx-schema-form / packages / fx-schema-form-react / dist / dts / reducers / schema.form.js View on Github external
for (let i = 0, n = keys.length; i < n; i++) {
            let mKeys = [...keys].splice(0, i + 1);
            if (!state.hasIn(mKeys)) {
                mKeys.pop();
                if (!state.hasIn(mKeys)) {
                    if (keys[i].constructor === Number) {
                        state = state.setIn(mKeys, List());
                    }
                    else {
                        state = state.setIn(mKeys, Map());
                    }
                }
            }
            else if (i < n) {
                let data = state.getIn(mKeys);
                if (!Map.isMap(data) && !List.isList(data)) {
                    if (keys[i + 1].constructor === Number) {
                        state = state.setIn(mKeys, List());
                    }
                    else {
                        state = state.setIn(mKeys, Map());
                    }
                }
            }
        }
        return state;
    }
    createFormHandle(state, { key, data }) {
github connexta / admin-console / ui / src / main / webapp / client.js View on Github external
const stripTypename = (obj) => {
  if (Map.isMap(obj)) {
    return obj.remove('__typename').map(stripTypename)
  } else if (List.isList(obj)) {
    return obj.map(stripTypename)
  } else {
    return obj
  }
}
github brianneisler / mudash / src / core / isImmutableList.js View on Github external
export default function isImmutableList(data) {
  return List.isList(data)
}
github ianstormtaylor / slate / packages / slate / src / models / text.js View on Github external
static isTextList(any) {
    return List.isList(any) && any.every(item => Text.isText(item))
  }
github strapi / strapi / packages / strapi-plugin-content-manager / admin / src / containers / EditView / reducer.js View on Github external
return obj.keySeq().reduce((acc, current) => {
            if (defaultGroupValues[current] && List.isList(obj.get(current))) {
              const formatted = obj.get(current).reduce((acc2, curr, index) => {
                return acc2.set(index, curr.set('_temp__id', index));
              }, List([]));

              return acc.set(current, formatted);
            }

            return acc;
          }, obj);
        }
github PacktPublishing / Building-Enterprise-JavaScript-Applications / Chapter10 / hobnob / docs / src / core / components / object-model.jsx View on Github external
([key, value]) => {
                      let isDeprecated = isOAS3() && value.get("deprecated")
                      let isRequired = List.isList(requiredProperties) && requiredProperties.contains(key)
                      let propertyStyle = { verticalAlign: "top", paddingRight: "0.2em" }
                      if ( isRequired ) {
                        propertyStyle.fontWeight = "bold"
                      }

                      return (
                        
                          { key }{ isRequired &amp;&amp; <span style="{{">*</span> }
github nick121212 / fx-schema-form / packages / fx-schema-form-react / dts / reducers / schema.form.js View on Github external
for (let i = 0, n = keys.length; i &lt; n; i++) {
            let mKeys = [].concat(keys).splice(0, i + 1);
            if (!state.hasIn(mKeys)) {
                mKeys.pop();
                if (!state.hasIn(mKeys)) {
                    if (keys[i].constructor === Number) {
                        state = state.setIn(mKeys, List());
                    }
                    else {
                        state = state.setIn(mKeys, Map());
                    }
                }
            }
            else if (i &lt; n) {
                let data = state.getIn(mKeys);
                if (!Map.isMap(data) &amp;&amp; !List.isList(data)) {
                    if (keys[i + 1].constructor === Number) {
                        state = state.setIn(mKeys, List());
                    }
                    else {
                        state = state.setIn(mKeys, Map());
                    }
                }
            }
        }
        return state;
    }
    createFormHandle(state, { key, data }) {
github bcrumbs / booben / app / src / utils / misc.js View on Github external
export const isArrayOrList = value =>
  Array.isArray(value) || List.isList(value);