How to use ramda-adjunct - 10 common examples

To help you get started, we’ve selected a few ramda-adjunct 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 char0n / page-objects / test / e2e / support / WebElementEnhanced.js View on Github external
get(target, propKey) {
    // calling methods on WebElementEnhanced API
    if (isFunction(target[propKey])) {
      return async function (...args) {
        return target[propKey](...args);
      };
    }

    // calling methods on the original WebElement API
    return async function (...args) {
      return target.webElement[propKey](...args);
    };
  },
};
github Undistraction / gatsby-starter-skeleton / src / components / shared / MarkdownContent.jsx View on Github external
import FootnoteRef from './Footnotes/FootnoteRef'
import Footnotes from './Footnotes/Footnotes'
import HorizontalRule from './HorizontalRule'
import Table from './Table'
import ContentLink from './links/ContentLink'
import OrderedList from './lists/OrderedList'
import UnorderedList from './lists/UnorderedList'
import ContentTitlePrimary from './titles/ContentTitlePrimary'
import ContentTitleSecondary from './titles/ContentTitleSecondary'
import ContentTitleTertiary from './titles/ContentTitleTertiary'

const hrefIsBackref = test(/^#fnref/)
const isClassedAsFootnoteRef = test(/footnote-ref/)
const isClassedAsFootnotes = test(/footnotes/)
const idIsFootnote = test(/^fn-/)
const lhasIdProp = lensSatisfies(idIsFootnote, lensPath([`props`, `id`]))
const isListOfFootnotes = pipe(
  filter(both(isPlainObj, lhasIdProp)),
  isNotEmpty
)

/* eslint-disable react/display-name, react/prop-types */
const resolveAnchor = theme => ({ className, href, ...rest }) => {
  let Component

  if (isClassedAsFootnoteRef(className)) {
    Component = FootnoteRef
  }

  if (hrefIsBackref(href)) {
    return null
  }
github teambit / bit / src / consumer / bit-json / abstract-bit-json.js View on Github external
getBackwardCompatibleEnv(type: EnvType): ?Compilers | ?Testers | ?string {
    const envObj = this.getEnvsByType(type);
    if (!envObj) return undefined;
    if (Object.keys(envObj).length !== 1) return envObj; // it has more than one id, it's >= v13
    const envId = Object.keys(envObj)[0];
    if (
      RA.isNilOrEmpty(envObj[envId].rawConfig) &&
      RA.isNilOrEmpty(envObj[envId].options) &&
      RA.isNilOrEmpty(envObj[envId].files)
    ) {
      return envId;
    }
    return envObj;
  }
github teambit / bit / src / consumer / config / abstract-config.ts View on Github external
static convertEnvToStringIfPossible(envObj: Envs | null | undefined): string | null | undefined | Envs {
    if (!envObj) return undefined;
    if (Object.keys(envObj).length !== 1) return envObj; // it has more than one id
    const envId = Object.keys(envObj)[0];
    if (
      RA.isNilOrEmpty(envObj[envId].rawConfig) &&
      RA.isNilOrEmpty(envObj[envId].options) &&
      RA.isNilOrEmpty(envObj[envId].files)
    ) {
      return envId;
    }
    return envObj;
  }
github Svehla / node-graphql-boilerplate / src / gql / models / Comment / subscriptions / newCommentSubscription.ts View on Github external
() => pubsub.asyncIterator(SubsTypes.NewComment), (payload, variables = {}, context) => {
        // TODO: can't add context in playground and test subscription without frontend
        // disable auth for dev env?
        if (isNilOrEmpty(context.user)) {
          return false
        }
        const globalReportId = variables.input && variables.input.reportId
        const reportId = Number(fromGlobalId(globalReportId).id)
        return payload.report_id === reportId
      }
    ),
github teambit / bit / src / consumer / bit-json / abstract-bit-json.js View on Github external
getBackwardCompatibleEnv(type: EnvType): ?Compilers | ?Testers | ?string {
    const envObj = this.getEnvsByType(type);
    if (!envObj) return undefined;
    if (Object.keys(envObj).length !== 1) return envObj; // it has more than one id, it's >= v13
    const envId = Object.keys(envObj)[0];
    if (
      RA.isNilOrEmpty(envObj[envId].rawConfig) &&
      RA.isNilOrEmpty(envObj[envId].options) &&
      RA.isNilOrEmpty(envObj[envId].files)
    ) {
      return envId;
    }
    return envObj;
  }
github Undistraction / cssapi-mq / src / renderers / cssRenderers / queryRenderer.js View on Github external
map(element => {
    if (isArray(element)) {
      // Only add prefix if no media type is declared
      if (arrayContainsMediaType(element)) {
        return element
      }
      return [defaultMediaType, ...element]
    }
    if (containsMediaType(element)) {
      return element
    }
    return joinAnd([defaultMediaType, element])
  })(elements)
github DFEAGILEDEVOPS / MTC / tslib / src / functions / check-marker / check-marker.v1.ts View on Github external
private async validateData (functionBindings: ICheckMarkerFunctionBindings, validatedCheck: ReceivedCheckTableEntity, logger: ILogger): Promise {
    if (RA.isNilOrEmpty(validatedCheck.answers)) {
      await this.updateReceivedCheckWithMarkingError(validatedCheck, 'answers property not populated')
      return
    }
    let parsedAnswersJson: any
    try {
      // tsc does not recognise the RA.IsNilOrEmpty check above
      // therefore we use the exclamanation to assert non null guarantee
      parsedAnswersJson = JSON.parse(validatedCheck.answers!)
    } catch (error) {
      logger.error(error)
      return this.updateReceivedCheckWithMarkingError(validatedCheck, 'answers data is not valid JSON')
    }

    if (!RA.isArray(parsedAnswersJson)) {
      return this.updateReceivedCheckWithMarkingError(validatedCheck, 'answers data is not an array')
    }

    const checkCode = validatedCheck.RowKey
    let rawCheckForm

    try {
      rawCheckForm = await this.sqlService.getCheckFormDataByCheckCode(checkCode)
    } catch (error) {
      logger.error(error)
      return this.updateReceivedCheckWithMarkingError(validatedCheck, `checkForm lookup failed:${error.message}`)
    }

    if (R.isNil(rawCheckForm)) {
      return this.updateReceivedCheckWithMarkingError(validatedCheck, 'associated checkForm could not be found by checkCode')
    }
github Undistraction / cssapi-mq / src / errors2.js View on Github external
// -----------------------------------------------------------------------------
// Utils
// -----------------------------------------------------------------------------

const constructError = construct(Error)

const throwError = error => {
  throw error
}

const throwNewError = compose(throwError, constructError)

export const throwErrorWithMessage = compose(
  throwNewError,
  joinWithSpace,
  appendFlipped([ERROR_PREFIX])
)

export const throwErrorWithPrefixedMessage = prefix =>
  compose(throwErrorWithMessage, joinWithSpace, appendFlipped([prefix]))

// -----------------------------------------------------------------------------
// Prefixed Errors
// -----------------------------------------------------------------------------

export const throwConfigureError = compose(
  throwErrorWithPrefixedMessage(CONFIGURE_PREFIX),
  argumentsFailureRenderer
)

export const throwAPIMediaTypeError = compose(
  throwErrorWithPrefixedMessage(API_MEDIA_TYPE_PREFIX),
github Undistraction / cssapi / src / build / expandData.js View on Github external
const [prefix, keyName] = splitOnColon(dataNodeItem)
    const dataNodeName = has(prefix, sourceData)
      ? prefix
      : resolveDataAlias(prefix)
    if (isUndefined(dataNodeName)) {
      const availableKeys = without([SCOPES, ALIASES])(
        concat(keys(sourceData), keys(config.data[ALIASES]))
      )
      throwDataError(unrecognisedDataPrefixError(prefix, availableKeys))
    }
    const dataNode = prop(dataNodeName, sourceData)
    if (isUndefined(dataNode))
      throwDataError(missingDataNodeError(dataNodeName))

    const resolvedValue = prop(keyName, dataNode)
    if (isUndefined(resolvedValue))
      throwDataError(missingDataItemKeyError(dataNodeName, keyName))

    // eslint-disable-next-line no-use-before-define
    return expandDataNodeItem(sourceData)(resolvedValue)
  }