How to use the immutable.List 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 graphprotocol / graph-cli / src / subgraph.js View on Github external
// Validate whether the address is valid
        let pattern = /^(0x)?[0-9a-fA-F]{40}$/
        if (pattern.test(address)) {
          return errors
        } else {
          return errors.push(
            immutable.fromJS({
              path,
              message: `\
Contract address is invalid: ${address}
Must be 40 hexadecimal characters, with an optional '0x' prefix.`,
            }),
          )
        }
      }, immutable.List())
  }
github LearningLocker / learninglocker / ui / src / components / ColorPicker / CustomColorPicker.js View on Github external
const CustomColorPickerInner = ColorWrap((props) => {
  const styles = buildStyles(props);

  // To fill space when customColors is less than 7.
  const dummySwatchListLength = Math.max(MAX_CUSTOM_COLORS - props.customColors.size, 0);
  const dummySwatchList = new List(Array(dummySwatchListLength)).map((_, i) => (
    <span>
      <div style="{styles.swatch}">
    
  ));

  return (
    <div style="{styles.picker}">
      <div style="{styles.saturation}">
        
      </div>
</div></div></span>
github bitshares / bitshares-ui / app / components / Wallet / BalanceClaimSelector.jsx View on Github external
let names = "";
                    let pubkey = address_to_pubkey.get(v.owner);
                    let private_key_object = private_keys.get(pubkey);
                    // Imported Account Names (just a visual aid, helps to auto select a real account)
                    if (
                        private_key_object &&
                        private_key_object.import_account_names
                    )
                        names = private_key_object.import_account_names.join(
                            ", "
                        );

                    // Signing is very slow, further divide the groups based on the number of signatures required
                    let batch_number = Math.ceil(
                        groupCount(
                            Immutable.List([names, v.balance.asset_id]),
                            v.owner
                        ) / 60
                    );
                    let name_asset_key = Immutable.List([
                        names,
                        v.balance.asset_id,
                        batch_number
                    ]);
                    return name_asset_key;
                })
                .map(l =>
github kalmhq / kalm / frontend / src / convertors / Application.ts View on Github external
export const convertFromCRDApplication = (c: V1alpha1Application): Application =&gt; {
  const spec = c.spec!;
  const metadata = c.metadata!;

  const sharedEnv = spec.sharedEnv
    ? List(
        spec.sharedEnv.map(x =&gt;
          Map({
            name: x.name,
            value: x.value
          })
        )
      )
    : List([]);

  const components: List = spec.components
    ? List(spec.components.map(convertFromCRDApplicationComponent))
    : List();

  const res: Application = Map({
    id: metadata.name!,
    isActive: c.status?.isActive,
github PacktPublishing / Building-Enterprise-JavaScript-Applications / Chapter10 / hobnob / docs / src / core / plugins / spec / selectors.js View on Github external
export function contentTypeValues(state, pathMethod) {
  pathMethod = pathMethod || []
  let op = specJsonWithResolvedSubtrees(state).getIn(["paths", ...pathMethod], fromJS({}))
  let meta = state.getIn(["meta", "paths", ...pathMethod], fromJS({}))
  let producesValue = currentProducesFor(state, pathMethod)

  const parameters = op.get("parameters") || new List()

  const requestContentType = (
    meta.get("consumes_value") ? meta.get("consumes_value")
      : parametersIncludeType(parameters, "file") ? "multipart/form-data"
      : parametersIncludeType(parameters, "formData") ? "application/x-www-form-urlencoded"
      : undefined
  )

  return fromJS({
    requestContentType,
    responseContentType: producesValue
  })
}
github bjjenson / react-useForm / src / form / reducer / generateDefaultListState.js View on Github external
export const getCurrentValues = (fields = [], initialListValues, options, fieldPath, parentPath) => {
  return (initialListValues || List()).map((item, index) => {
    return getFields(fields, item, options, fieldPath, index, parentPath)
  })
}
github luckymarmot / API-Flow / src / parsers / postman / v2 / Parser.js View on Github external
for (const headerLine of headerLines) {
      const match = headerLine.match(/^([^\s\:]*)\s*\:\s*(.*)$/)
      if (match) {
        headerSet = headerSet.set(match[1],
                    this._referenceEnvironmentVariable(match[2])
                )
      }
    }

    headerSet.forEach((value, key) => {
      const param = this._extractParam(key, value)
      headers.push(param)
    })

    return new Immutable.List(headers)
  }
github cvdlab / react-planner / src / class / line.js View on Github external
let layerID = state.getIn(['drawingSupport', 'layerID']);
    let layer = state.getIn(['scene','layers', layerID]);

    let lineID = state.getIn(['scene', 'layers', layerID, 'selected', 'lines']).first();
    let line = state.getIn(['scene', 'layers', layerID, 'lines', lineID]);

    let v0 = layer.vertices.get(line.vertices.get(0));

    state = Line.remove( state, layerID, lineID ).updatedState;
    state = Line.createAvoidingIntersections( state, layerID, line.type, v0.x, v0.y, x, y ).updatedState;
    state = Layer.detectAndUpdateAreas( state, layerID ).updatedState;

    state = state.merge({
      mode: MODE_WAITING_DRAWING_LINE,
      snapElements: new List(),
      activeSnapElement: null
    });

    return { updatedState: state };
  }
github Autodesk / molecular-simulation-tools / client / public / js / components / status.jsx View on Github external
const runCompleted = props.app.run.status === statusConstants.COMPLETED;

  let selection;
  if (!props.hideContent) {
    if (props.selection.taskIndex === props.app.tasks.size) {
      const outputResultsIndex = ioUtils.getIndexByExtension(
        props.app.run.outputs, 'results.json',
      );
      let resultValues;

      if (outputResultsIndex !== -1) {
        const outputResults = props.app.run.outputs.get(outputResultsIndex)
          .fetchedValue;

        if (outputResults.output_values) {
          resultValues = new IList(outputResults.output_values);
        }
      }

      const pdbIndex = ioUtils.getIndexByExtension(
        props.app.run.outputs, '.pdb',
      );
      const outputPdbUrl = props.app.run.outputs.get(pdbIndex).value;

      selection = (