How to use the ramda.contains function in ramda

To help you get started, we’ve selected a few ramda 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 flow-typed / flow-typed / definitions / npm / ramda_v0.x.x / flow_v0.104.x- / test_ramda_v0.x.x_list.js View on Github external
it('does not allow a mismatched element type to the $ReadOnlyArray', () => {
        const xs: $ReadOnlyArray = ['bar']
        // It is not understood why this fails to be flagged as an error when
        // the 0.26.x libdef passes with the same declaration. The curried form
        // works reliably though.
        //
        // $ShouldExpectErrorButInsteadWorksPleaseFix
        const result: boolean = contains(1, xs)
      })
github iamstarkov / es-deps-deep / index.js View on Github external
function esDepsDeep(files, options = {}) {
  var cache = []; // eslint-disable-line

  const excludeFn = options.excludeFn || R.F;

  // isInCache :: Object -> true
  const isInCache = R.pipe(_resolved, R.contains(R.__, cache));

  // impure void addToCache :: Object
  const addToCache = _ => { cache.push(_.resolved); };

  // walk :: Object -> Array[Object]
  const walk = item => R.ifElse(isInCache, R.always([]), R.pipeP(toPromise,
    R.tap(addToCache),
    deps,
    mapWalk,
    R.unnest,
    R.reject(excludeFn),
    R.prepend(item)
  ))(item);

  // mapWalk :: Array[Object] -> Array[Object]
  const mapWalk = R.pipeP(toPromise,
github pikhovkin / dj-plotly-dash / dash-renderer / src / APIController.react.js View on Github external
layoutRequest,
            layout,
            config,
        } = this.props;

        const {errorLoading} = this.state;

        if (
            layoutRequest.status &&
            !contains(layoutRequest.status, [STATUS.OK, 'loading'])
        ) {
            return <div>Error loading layout</div>;
        } else if (
            errorLoading ||
            (dependenciesRequest.status &amp;&amp;
                !contains(dependenciesRequest.status, [STATUS.OK, 'loading']))
        ) {
            return (
                <div>Error loading dependencies</div>
            );
        } else if (
            appLifecycle === getAppState('HYDRATED') &amp;&amp;
            config.ui === true
        ) {
            return (
                
                    
                
            );
github plotly / dash-table / src / lib / components / Cell.js View on Github external
value,
            setProps,
            dataframe,
            is_focused,
            columns,
            selected_cell,
            active_cell,
        } = this.props;

        const {notEditable} = this.state;
        const isActive = active_cell[0] === idx &amp;&amp; active_cell[1] === i;

        let innerCell;
        if (
            !R.has('type', columns[i]) ||
            R.contains(columns[i].type, ['numeric', 'text'])
        ) {
            innerCell = (
                <input value="{value}" type="text" id="{`${c.id}-${idx}`}"> (this.textInput = el)}
                    onChange={e =&gt; {
                        if (notEditable) {
                            return;
                        }
                        if (isSelected) {
                            const newDataframe = R.set(
                                R.lensPath([idx, c.id]),
github SeanCannon / prettycats / lib / predicates / arrays.js View on Github external
'use strict';

const R  = require('ramda'),
      __ = require('./_private.js');

module.exports = {
  isArray                : R.is(Array),
  isArrayOfLength        : __.ofLength(Array, 'identical'),
  isArrayOfLengthAtLeast : __.ofLength(Array, 'gte'),
  isArrayOfLengthAtMost  : __.ofLength(Array, 'lte'),
  isArrayLongerThan      : __.ofLength(Array, 'gt'),
  isArrayShorterThan     : __.ofLength(Array, 'lt'),
  isArrayContaining      : R.contains(R.__),
  isEmptyArray           : R.allPass([R.is(Array), R.isEmpty])
};
github plotly / react-chart-editor / src / components / widgets / MapboxStyleUrlController.js View on Github external
return (
        <div>
          {title}
          <span data-hint="{tooltip}">
            <i>
          </i></span><i>
        </i></div><i>
      );
    }

    let viewJsonButton = null;
    if (
      R.contains(valueType, [VALUE_TYPES.MAPBOX_ATLAS, VALUE_TYPES.JSON]) &amp;&amp;
      value
    ) {
      let buttonText;
      if (valueType === VALUE_TYPES.MAPBOX_ATLAS) {
        buttonText = "View Mapbox Style JSON";
      } else {
        buttonText = "Rich JSON Editor";
      }

      viewJsonButton = menuItem(
        <div>
          {buttonText}
        </div>
      );
    }
</i>
github coderplanets / coderplanets_web / containers / VideoEditor / SourceOptions.js View on Github external
const SourceOptions = ({ active, sourceOnSelect }) =&gt; {
  if (!active) active = ''

  const otherOption =
    !R.contains(
      trimLower(active),
      R.map(trimLower, R.pluck('title', recommands))
    ) &amp;&amp; !R.isEmpty(active)

  return (
    
      {recommands.map(s =&gt; (
github jdiaz5513 / capnp-ts / packages / capnpc-ts / src / json / interface / type.ts View on Github external
isPointer(type: IType): boolean {
    return R.contains(Type.which(type), Type._pointerTypes);
  },
github infinitered / reactotron / src / Stores / SessionStore.js View on Github external
isCommandHidden(commandType) {
    return contains(commandType, this.commandsHiddenInTimeline)
  }
github Nevon / express-physical / src / response / validate / rules / dependent-on.js View on Github external
module.exports = ({ type }) =>
  contains(type, DEPENDENT_ON_REQUIRED_TYPES)
    ? [[isString, "DependentOn should be a string"], [notEmpty, EMPTY_MESSAGE]]
    : [[isNil, NOT_NIL_MESSAGE]];