How to use the ramda.equals 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 cypress-io / cypress-documentation / cy_scripts / should-deploy.js View on Github external
* @returns boolean
*/
const isEnvVariableOn = (name) => {
  const value = process.env[name]

  if (!value) {
    return false
  }

  return value === 'true'
    || value === 'TRUE'
    || value === 'on'
    || value === '1'
    || value === 'yes'
}
const isForced = process.argv.some(equals('--force')) || isEnvVariableOn('FORCE_DEPLOY')

const isValidEnvironment = is.oneOf(['staging', 'production'])

/* eslint-disable no-console */

/**
 * Checks if current Git branch (develop, master, hot-fix-1)
 * is allowed to deploy to the target environment
 *
 * @param env {string} Target environment, like "staging" or "production"
 */
function isRightBranch (env) {
  la(is.unemptyString(env), 'expected environment name', env)

  // allow multiple branches to deploy to staging environment,
  // add to the keys in this object
github char0n / ramda-adjunct / test / lensSatisfies.js View on Github external
it('tests currying', function() {
    assert.isTrue(
      RA.lensSatisfies(equals('bar'))(lensProp('foo'))({ foo: 'bar' })
    );
    assert.isTrue(
      RA.lensSatisfies(equals('bar'), lensProp('foo'))({ foo: 'bar' })
    );
    assert.isTrue(
      RA.lensSatisfies(equals('bar'))(lensProp('foo'))({ foo: 'bar' })
    );
  });
});
github rung-tools / rung-cli / src / db.js View on Github external
return getPackage()
        .then(({ name }) => read(name))
        .then(render)
        .tap(console.log.bind(console))
        .catch(() => reject(new Error('Unable to read database')));
}

function cliClear() {
    return getPackage()
        .then(({ name }) => clear(name))
        .catch(() => reject(new Error('Unable to clear database')));
}

export default pipe(prop('option'), cond([
    [equals('read'), cliRead],
    [equals('clear'), cliClear],
    [T, option => reject(new Error(`Unknown option ${option}`))]
]));
github Soluto / tweek / services / editor-new / src / pages / context / components / FixedKeys / FixedKeys.js View on Github external
componentWillReceiveProps(nextProps) {
    if (!R.equals(this.props.fixedKeys, nextProps.fixedKeys)) {
      const keys = calculateKeys(nextProps.fixedKeys);
      this.setState({
        keys,
        hasChanges: false,
      });
    }
  }
github linode / manager / src / features / Domains / DomainRecords.tsx View on Github external
componentDidUpdate(prevProps: CombinedProps) {
    if (
      !equals(prevProps.domainRecords, this.props.domainRecords) ||
      !equals(prevProps.domain, this.props.domain)
    ) {
      this.setState({ types: this.generateTypes() });
    }
  }
github will-adkins / Tri-Track / app / src / action-creators / workouts.js View on Github external
const duration =
      getState().newWorkout.data.sec +
      getState().newWorkout.data.hr * 3600 +
      getState().newWorkout.data.min * 60

    const distance = getState().newWorkout.data.distanceMi
    const newPace =
      Number.isNaN(duration / distance) || equals(duration / distance, Infinity)
        ? 0
        : duration / distance
    dispatch({
      type: NEW_WORKOUT_FORM_UPDATED,
      payload: { paceSecPerMi: newPace }
    })

    if (equals(category, 'Swim')) {
      const stroke = getState().newWorkout.data.stroke
      const newCalories = dispatch(
        caloriesBurned(category, distance, duration, stroke)
      )

      dispatch({
        type: NEW_WORKOUT_FORM_UPDATED,
        payload: { calories: newCalories }
      })
      return
    }

    const newCalories = dispatch(caloriesBurned(category, distance, duration))

    dispatch({
      type: NEW_WORKOUT_FORM_UPDATED,
github rvpanoz / luna / app / components / packages / TableList.js View on Github external
'secondary'
                            )
                          )
                        ],
                        [
                          Requals('dependencies'),
                          Ralways(
                            this.renderTooltipIcon(
                              CodeIcon,
                              'dependency',
                              'secondary'
                            )
                          )
                        ],
                        [
                          Requals('devDependencies'),
                          Ralways(
                            this.renderTooltipIcon(
                              BuildIcon,
                              'devDependency',
                              'primary'
                            )
                          )
                        ],
                        [
                          Requals('optionalDependencies'),
                          Ralways(
                            this.renderTooltipIcon(
                              OptIcon,
                              'optionalDependency',
                              'error'
                            )
github MCS-Lite / mcs-lite / packages / mcs-lite-ui / src / DataChannelAdapter / DataChannelAdapter.js View on Github external
() => (
          
        ),
      ],

      /**
       * HEX
       *
       * @author Michael Hsu
       */

      [
        R.equals('HEX_CONTROL'),
        () => (
           eventHandler({ type: 'SUBMIT', id, values })}
            onChange={e =>
              eventHandler({
                type: 'CHANGE',
                id,
                values: { value: e.target.value },
              })
            }
            onClear={() => eventHandler({ type: 'CLEAR', id, values: {} })}
          />
        ),
      ],
github ubyssey / dispatch / dispatch / static / manager / src / js / components / inputs / ItemSelectInput.js View on Github external
removeValue(id) {
    const selected = this.getSelected()

    if (this.props.many) {
      this.props.onChange(
        R.remove(
          R.findIndex(R.equals(id), selected),
          1,
          selected
        )
      )
    } else {
      this.props.onChange(null)
    }
  }