How to use the rambdax.complement function in rambdax

To help you get started, we’ve selected a few rambdax 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 Nozbe / WatermelonDB / src / QueryDescription / index.js View on Github external
export function buildQueryDescription(conditions: Condition[]): QueryDescription {
  const [join, whereConditions] = getJoins(conditions)

  return { join, where: whereConditions }
}

export function queryWithoutDeleted(query: QueryDescription): QueryDescription {
  const { join, where: whereConditions } = query

  return {
    join: [...join, ...joinsWithoutDeleted(join)],
    where: [...whereConditions, whereNotDeleted],
  }
}

const isNotObject = complement(isObject)

const searchForColumnComparisons: any => boolean = cond([
  [is(Array), any(value => searchForColumnComparisons(value))], // dig deeper into arrays
  [isNotObject, F], // bail if primitive value
  [has('column'), T], // bingo!
  [
    T,
    pipe(
      // dig deeper into objects
      getValues,
      any(value => searchForColumnComparisons(value)),
    ),
  ],
])

export function hasColumnComparisons(conditions: Where[]): boolean {
github selfrefactor / useful-javascript-libraries / src / indexProve.js View on Github external
if (createData) await createDataJSON()
  if (score) await createScores()
  if (!createReadme) return

  const { repoData } = readJSONSync(REPO_DATA)
  const sorted = sort((a, b) => b.score - a.score, repoData)
  const reposRaw = uniqWith((a, b) => a.name === b.name, sorted)
  const awesomeRepos = reposRaw.filter(isAwesomeRepo)
  const repos = reject(isAwesomeRepo, reposRaw)

  const jsRelated = repos.filter(isJS)
  const jsLibs = jsRelated.filter(isLibrary)
  const reactLibs = jsRelated.filter(prop('isReact'))
  const tsLibs = jsRelated.filter(prop('isTypescript'))
  const jsProjects = jsRelated.filter(complement(prop('isLibrary')))
  const otherLibs = repos.filter(complement(isJS))

  const jsContent = createReadmePartial(jsLibs)
  const awesomeContent = createReadmePartial(awesomeRepos)
  const reactContent = createReadmePartial(reactLibs)
  const tsContent = createReadmePartial(tsLibs)
  const jsProjectsContent = createReadmePartial(jsProjects)
  const otherContent = createReadmePartial(otherLibs)

  const jsTitle = template(TITLE, {
    num : jsLibs.length,
    tag : 'Javascript',
  })
  const awesomeTitle = template(AWESOME_TITLE, {
    num : awesomeRepos.length,
    tag : 'Awesome lists',
  })
github selfrefactor / useful-javascript-libraries / src / indexProve.js View on Github external
if (updateSecondary) await updateSecondaryFn()
  if (createData) await createDataJSON()
  if (score) await createScores()
  if (!createReadme) return

  const { repoData } = readJSONSync(REPO_DATA)
  const sorted = sort((a, b) => b.score - a.score, repoData)
  const reposRaw = uniqWith((a, b) => a.name === b.name, sorted)
  const awesomeRepos = reposRaw.filter(isAwesomeRepo)
  const repos = reject(isAwesomeRepo, reposRaw)

  const jsRelated = repos.filter(isJS)
  const jsLibs = jsRelated.filter(isLibrary)
  const reactLibs = jsRelated.filter(prop('isReact'))
  const tsLibs = jsRelated.filter(prop('isTypescript'))
  const jsProjects = jsRelated.filter(complement(prop('isLibrary')))
  const otherLibs = repos.filter(complement(isJS))

  const jsContent = createReadmePartial(jsLibs)
  const awesomeContent = createReadmePartial(awesomeRepos)
  const reactContent = createReadmePartial(reactLibs)
  const tsContent = createReadmePartial(tsLibs)
  const jsProjectsContent = createReadmePartial(jsProjects)
  const otherContent = createReadmePartial(otherLibs)

  const jsTitle = template(TITLE, {
    num : jsLibs.length,
    tag : 'Javascript',
  })
  const awesomeTitle = template(AWESOME_TITLE, {
    num : awesomeRepos.length,
    tag : 'Awesome lists',