How to use the ramda.prop 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 wavesplatform / data-service / src / services / transactions / data / pg / transformResult.js View on Github external
[either(isNil, isEmpty), always([])],
  [
    T,
    compose(
      // sort by position in tx, then remove it
      map(
        evolve({
          data: compose(
            map(omit(['positionInTx'])),
            sortBy(prop('positionInTx'))
          ),
        })
      ),
      map(reduce(appendRowToTx, { data: [] })),
      values,
      groupBy(prop('id'))
    ),
  ],
]);

module.exports = dataEntriesToTxs;
github lingui / js-lingui / packages / cli / src / api / formats / po.js View on Github external
return item
  })
)

const getMessageKey = R.prop("msgid")
const getTranslations = R.prop("msgstr")
const getExtractedComments = R.prop("extractedComments")
const getTranslatorComments = R.prop("comments")
const getOrigins = R.prop("references")
const getFlags = R.compose(
  R.map(R.trim),
  R.keys,
  R.dissoc("obsolete"), // backward-compatibility, remove in 3.x
  R.prop("flags")
)
const isObsolete = R.either(R.path(["flags", "obsolete"]), R.prop("obsolete"))

const deserialize = R.map(
  R.applySpec({
    translation: R.compose(
      R.head,
      R.defaultTo([]),
      getTranslations
    ),
    description: R.compose(
      R.head,
      R.defaultTo([]),
      getExtractedComments
    ),
    comments: item =>
      R.concat(getTranslatorComments(item), R.tail(getExtractedComments(item))),
    obsolete: isObsolete,
github vtex / toolbelt / src / modules / sponsor / setEdition.ts View on Github external
export default async (edition: string) => {
  const previousConf = conf.getAll()
  const previousAccount = previousConf.account
  const sponsorClient = new Sponsor(getIOContext(), IOClientOptions)
  const data = await sponsorClient.getSponsorAccount()
  const sponsorAccount = R.prop('sponsorAccount', data)
  if (!sponsorAccount) {
    await promptSwitchToAccount('vtex', true)
  } else if (previousAccount !== sponsorAccount) {
    await promptSwitchToAccount(sponsorAccount, false)
  }
  const sponsorClientForSponsorAccount = new Sponsor(getIOContext(), IOClientOptions)
  await sponsorClientForSponsorAccount.setEdition(previousAccount, edition)
  log.info(`Successfully set new edition in account ${chalk.blue(previousAccount)}.`)
  await switchToPreviousAccount(previousConf)
}
github andreloureiro / cyclejs-starter / js / components / Router / index.js View on Github external
'/hello': Hello,
    '*': NotFound
  });

  const page$ = match$.map(({path, value}) => value(merge(sources, {
    path: router.path(path)
  })));

  const makeLink = (path, label) => a({props: {href: path}, style: {padding: '1em'}}, label);

  const nav$ = xs.of(nav({style: {marginBottom: '1em'}}, [
    makeLink('/bmi', 'BMI'),
    makeLink('/hello', 'Hello')
  ]));

  const view$ = page$.map(prop('DOM')).flatten();

  const vdom$ = xs.combine(nav$, view$)
    .map(([navDom, viewDom]) => div([navDom, viewDom]));

  return {
    DOM: vdom$
  }
}
github amazeeio / lagoon / cli / src / commands / environments.js View on Github external
export async function handler({ clog, cerr, argv }: Args): Promise {
  const projectName = R.prop('project', argv) || R.prop('project', config);

  if (projectName == null) {
    return printProjectConfigurationError(cerr);
  }

  return listEnvironments({ projectName, clog, cerr });
}
github wavesplatform / wavesplatform.com / src / common / containers / StressTest / epic.js View on Github external
const balanceUpdate = action$ =>
    receiveFromSocket(socket)('balanceUpdate')
      .takeUntil(action$.ofType(ERROR))
      .map(prop('balance'))
      .map(updateConfirmedTxs);
github git-toni / reposplit / src / utils / repo.js View on Github external
let attrSort = (attr) => R.sortBy(R.compose(R.toLower, R.prop(attr)))
let nameSort = attrSort('name')
github Flyr1Q / simple-math-ast / src / tokenize / rules.js View on Github external
import { pipe, prop, append, map } from "ramda";

import { UNKNOWN_RULE } from "./unknown";

const transformKeyToRegExp = ({ key, ...rest }) => ({
  key: new RegExp(key, "g"),
  ...rest
});

export const rules = pipe(
  prop("rules"),
  append(UNKNOWN_RULE),
  map(transformKeyToRegExp)
);