How to use the fp-ts/lib/Option.isSome function in fp-ts

To help you get started, we’ve selected a few fp-ts 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 devexperts / dx-platform / packages / react-kit / src / components / DateInput / DateInput.tsx View on Github external
incrementIcon,
			decrementIcon,
			theme,
			ButtonIcon,
			SteppableInput,
			dateFormatType,
			value: { day, month, year },
		} = this.props;

		const yearClassName = this.getSectionClassName(ActiveSection.Year);

		// check if "X" clear button should be visible - at least one part of date should be set
		const onClear = isSome(day) || isSome(month) || isSome(year) ? this.onClear : undefined;

		const innerClassName = classnames(theme.inner, {
			[theme.inner_isFilled as string]: isSome(day) && isSome(month) && isSome(year),
		});

		return (
github devexperts / dx-platform / packages / react-kit / src / components / DateInput / DateInput.tsx View on Github external
clearIcon,
			calendarIcon,
			Calendar,
			incrementIcon,
			decrementIcon,
			theme,
			ButtonIcon,
			SteppableInput,
			dateFormatType,
			value: { day, month, year },
		} = this.props;

		const yearClassName = this.getSectionClassName(ActiveSection.Year);

		// check if "X" clear button should be visible - at least one part of date should be set
		const onClear = isSome(day) || isSome(month) || isSome(year) ? this.onClear : undefined;

		const innerClassName = classnames(theme.inner, {
			[theme.inner_isFilled as string]: isSome(day) && isSome(month) && isSome(year),
		});

		return (
github teamdigitale / io-functions / lib / compute_visible_services.ts View on Github external
function reduceServicesToVisibleServices(
  visibleServicesObj: StrMap,
  service: RetrievedService
): StrMap {
  // we use an in-memory object (map)
  // to temporary store visible services
  const maybeVisibleService = lookup(service.serviceId, visibleServicesObj);
  if (
    !service.isVisible &&
    isSome(maybeVisibleService) &&
    service.version > maybeVisibleService.value.version
  ) {
    // if the service is not visible anymore
    // delete it from the visible services list
    return remove(service.serviceId, visibleServicesObj);
  } else if (
    // if the service is visible and we don't have a related
    // cached visible service yet...
    service.isVisible &&
    (isNone(maybeVisibleService) ||
      // ... or if the updated service is visible and the version
      // is greater than the stored version of the cached visible service
      service.version > maybeVisibleService.value.version)
  ) {
    // store the visible service into the object (map)
    return insert(
github devexperts / dx-platform / packages / react-kit / src / components / TimeInput / TimeInput.tsx View on Github external
activeSection: Section.PeriodType,
								});
							}
							this.secondInput = false;
						} else {
							this.secondInput = true;
						}
						this.updateTime(hours, some(newMinutes), seconds, periodType);
					}
				}
				break;
			}
			case Section.Seconds: {
				let newSeconds;
				if (this.secondInput) {
					newSeconds = isSome(seconds) ? Number(`${seconds.value % 10}${digit}`) : digit;
				} else {
					newSeconds = digit;
					this.secondInput = true;
				}
				this.updateTime(hours, minutes, some(newSeconds), periodType);
				break;
			}
		}
	}
github mikearnaldi / matechs-effect / packages / rpc / src / index.ts View on Github external
.bindL("ret", ({ res }) =>
            isSome(res.body)
              ? T.completed((res.body.value as RPCResponse).value)
              : T.raiseError(new Error("empty response"))
          )
github buildo / avenger / lib / index.js View on Github external
ObservableCache.prototype.emitLoadingEvent = function (a) {
        this.log('emitting LOADING event for %o', a);
        var subject = this.getSubject(a);
        if (Option_1.isSome(subject.value.data)) {
            subject.next(new CacheEvent(true, subject.value.data));
        }
        else {
            subject.next(LOADING);
        }
    };
    ObservableCache.prototype.emitPayloadEvent = function (a, p) {
github elastic / kibana / x-pack / legacy / plugins / actions / server / actions_config.ts View on Github external
function isWhitelisted({ whitelistedHosts }: ActionsKibanaConfig, hostname: string): boolean {
  return (
    Array.isArray(whitelistedHosts) &&
    isSome(
      fromNullable(
        whitelistedHosts.find(
          whitelistedHostname =>
            doesValueWhitelistAnyHostname(whitelistedHostname) || whitelistedHostname === hostname
        )
      )
    )
  );
}
github mikearnaldi / matechs-effect / packages / effect / src / original / support / completable.ts View on Github external
listen(f: FunctionN<[A], void>): Lazy {
    if (o.isSome(this.completed)) {
      f(this.completed.value);
    }
    this.listeners.push(f);
    return () => {
      this.listeners = this.listeners.filter(cb => cb !== f);
    };
  }
}