ramda#complement TypeScript Examples

The following examples show how to use ramda#complement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: fieldManager.ts    From react-js-tutorial with MIT License 6 votes vote down vote up
getDiagonals = (gameField: GameFieldType, bottomToTop = true) => {
  const Ylength = gameField.length;
  const Xlength = gameField[0].length;
  const maxLength = Math.max(Xlength, Ylength);
  const result: string[][] = [];
  for (let k = 0; k <= 2 * maxLength; k++) {
    for (let y = 0; y <= Ylength - 1; y++) {
      const x = k - (bottomToTop ? Ylength - y : y);
      if (x >= 0 && x < Xlength && gameField[y][x]) {
        if (!result[k]) {
          result[k] = [];
        }
        result[k].push(gameField[y][x]);
      }
    }
  }
  return filter(complement(isNil), result);
}
Example #2
Source File: proxy.ts    From the-fake-backend with ISC License 6 votes vote down vote up
/**
   * Get the routes with overridden proxy.
   *
   * @return Overridden proxy routes
   */
  getOverriddenProxyRoutes() {
    const current = this.getCurrent();

    return this.routeManager
      .getAll()
      .filter(
        both(
          propSatisfies(complement(equals(undefined)), 'proxy'),
          pathSatisfies(complement(equals(current?.name)), ['proxy', 'name'])
        )
      );
  }
Example #3
Source File: overrides.ts    From the-fake-backend with ISC License 5 votes vote down vote up
isNotEmpty = complement(either(isNil, isEmpty))