How to use the ramda.merge 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 apache / incubator-weex-cli / packages / @weex / core / src / toolbox / parameter-tools.ts View on Github external
export function parseParams(commandArray: string | string[], extraOpts: Options = {}): IParameters {
  // use the command line args if not passed in
  if (is(String, commandArray)) {
    commandArray = (commandArray as string).split(COMMAND_DELIMITER)
  }

  // remove the first 2 args if it comes from process.argv
  if (equals(commandArray, process.argv)) {
    commandArray = commandArray.slice(2)
  }

  // chop it up yargsParse!
  const parsed = yargsParse(commandArray)
  const array = parsed._.slice()
  delete parsed._
  const options = merge(parsed, extraOpts)
  return { array, options }
}
github oreqizer / redux-forms / packages / redux-forms-react / src / field.ts View on Github external
render() {
      const { name, _field } = this.props;

      // Wait until field is initialized
      if (!_field) {
        return null;
      }

      const inputProps = merge(_field, {
        name,
        onChange: this.handleChange,
        onFocus: this.handleFocus,
        onBlur: this.handleBlur,
      });

      const { input, meta, rest } = fieldProps(merge(inputProps, this.props));

      // TODO SFC not compatibile with class... wtf TS
      return React.createElement(Component as any, merge(rest, {
        input,
        meta,
      }));
    }
  }
github sweet-js / sweet-core / src / load-syntax.js View on Github external
export function expandCompiletime(term, context) {
  // each compiletime value needs to be expanded with a fresh
  // environment and in the next higher phase
  let syntaxExpander = new TermExpander(
    _.merge(context, {
      phase: context.phase + 1,
      env: new Env(),
      store: context.store,
    }),
  );

  return syntaxExpander.expand(term);
}
github wavesplatform / data-service / src / db / adapter / transactions / exchange / index.js View on Github external
many(filters = {}) {
    const withDefaults = merge({ limit: 100 });

    const filtersModified = withDefaults(filters);

    return dbT
      .any(sql.transactions.exchange.many(filtersModified))
      .map(map(Maybe.fromNullable))
      .mapRejected(
        errorFactory({
          request: 'transactions.exchange.many',
          params: filters,
        })
      );
  },
});
github zendesk / linksf / components / OrganizationEdit / OrganizationEdit.js View on Github external
newPhone = () => {
    const { organization } = this.state
    const newPhones = [...organization.phones]
    const newOrganization = {}

    newPhones.push(blankPhone())
    newOrganization.phones = newPhones

    const updatedOrganization = R.merge(organization, newOrganization)

    this.setState({ organization: updatedOrganization })
  }
github zendesk / volunteer_portal / app / javascript / pages / Event / index.js View on Github external
createSignup: (event, currentUser) =>
        mutate({
          variables: { eventId: event.id },
          optimisticResponse: {
            __typename: 'Mutation',
            createSignup: {
              __typename: 'Signup',
              event: R.merge(event, {
                users: R.append(currentUser, event.users),
              }),
            },
          },
        }),
    }),
github speckjs / speckjs / src / speck.js View on Github external
var build = function build(file, options) {
  options = options ? R.merge(defaultOptions, options) : defaultOptions;
  var output;
  var tests = comments.parse(file.content).tests;
  var testsReadyToAssemble = tests.map(function(test) {
    var testDetails;
    if (test.assertions.length) {
      testDetails = extract.extractTestDetails(test.assertions);
    } else {
      testDetails = '';
    }
    var utilData = tempUtils.prepDataForTemplating(options.testFW, file.name, test, testDetails);
    var jsTestString;
    if (options.testFW === 'jasmine') {
      jsTestString = tempUtils.addTestDataToBaseTemplateJasmine(utilData, jasmineTemps.base);
    }
    if (options.testFW === 'tape') {
      jsTestString = tempUtils.addTestDataToBaseTemplate(utilData, tapeTemps.base, tapeTemps.plan);
github TryStarboard / Starboard / webpack.config.delayed-job.js View on Github external
'use strict';

const join = require('path').join;
const merge = require('ramda').merge;
const base = require('./webpack.config.backend-base');

module.exports = merge({
  entry: './source/delayed-job/index.js',
  output: {
    filename: 'delayed-job.js',
    path: join(__dirname, 'build'),
    libraryTarget: 'commonjs2',
  },
}, base);
github serverless / components / registry / aws-sqs / src / index.js View on Github external
  reduce((result, key) => merge(result, { [capitalizeString(key)]: obj[key] }), {}, keys(obj))
github vtex-apps / store-graphql / node / resolvers / checkout / paymentTokenResolver.ts View on Github external
export default async (body: any, ioContext: any) => {
  const { data: { orderFormId, paymentToken } } = body
  const checkout = createClient(ioContext.account, orderFormId, ioContext.authToken)

  const response = await checkout.addToken(paymentToken)

  const { data: { paymentData: { availableTokens } } } = response
  const tokensToRemove = reject(propEq('tokenId', paymentToken.tokenId), availableTokens)

  if (tokensToRemove.length === 0) {
    return { data: merge(body.data, response.data) }
  }

  const lastDeleteResponse = await mapSeries(tokensToRemove, ({ tokenId }: any) => checkout.removeToken(tokenId)).then(last)
  return { data: merge(body.data, lastDeleteResponse.data) }
}